Re: [patch 05/14] percpu: Use a Kconfig variable to configure arch specific percpu setup

Jeremy Fitzhardinge
2007-11-29T05:29:29Z

Christoph Lameter wrote:
> x86_64 can use a 32 bit offset instead of a 64 bit addres because it uses
> the small model. A load of a 64 bit address would require much more
> expensive instructions. A load of a 64 bit address is currently avoided
> through the use of the pda that contains the full 64 bit address in the
> data_offset field. Operations on per cpu data on x86_64 must therefore
> first load data_offset via gs and then add the per cpu address to this
> offset. Then the per cpu operation is performed on that address.
>

Hm. Certainly a non-one-instruction access would be considerably less
useful than one that is, because of preemption issues.

(In general you need to pin yourself to a cpu if you're using percpu
data, but sometimes it doesn't matter. In particular, the reason I'm
interested in this at all is because Xen puts its interrupt mask flag in
per-cpu data, and a single instruction means that masking interrupts
[=disable preemption] can be done in one instruction with no scope for
preemption in the middle doing something unexpected.)

> In order to avoid this situation through one instruction we need a small
> 32 bit offset relative to gs. Otherwise we cannot get away from the PDA
> and the use of data_offset.
>

Hm, yes, I see. Dratted large address space. What's wrong with 4G
anyway? ;)

Anyway, I can see the problem with my thinking about this so far.

J