Re: [PATCH 1/5] MIPS: Introduce irq_stack
From: Matt Redfearn
Date: Wed Dec 07 2016 - 04:26:01 EST
Hi Jason,
On 06/12/16 22:13, Jason A. Donenfeld wrote:
On Fri, Dec 2, 2016 at 2:39 PM, Matt Redfearn <matt.redfearn@xxxxxxxxxx> wrote:
+void *irq_stack[NR_CPUS];
I'm curious why you implemented it this way rather than using
DEFINE_PER_CPU and the related percpu helper functions.
Because in the IRQ entry point in assembler we have to look up the
address of this CPU's IRQ stack. Doing so with a simple array can be
done with fewer instructions than a per-cpu variable. The kernel stack
pointer for each CPU is held in a similar array.
MIPS does not have a particularly optimized per-cpu implementation with
the per-cpu offset being held somewhere easily accessible, so right now
it has be looked up from the __per_cpu_offset array, and then applied to
the per-cpu pointer. Obviously doing the first lookup is analogous to
what I am doing, and the subsequent application to the per-cpu pointer
would be additional instructions.
Thanks,
Matt