Messages in this thread | | | From | Uros Bizjak <> | Date | Wed, 11 Oct 2023 09:45:36 +0200 | Subject | Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr() |
| |
On Wed, Oct 11, 2023 at 9:27 AM Uros Bizjak <ubizjak@gmail.com> wrote:
> > IOW, something like > > > > static __always_inline unsigned long new_cpu_offset(void) > > { > > unsigned long res; > > asm(ALTERNATIVE( > > "movq " __percpu_arg(1) ",%0", > > "rdgsbase %0", > > X86_FEATURE_FSGSBASE) > > : "=r" (res) > > : "m" (this_cpu_off)); > > return res; > > } > > > > would presumably work together with your __seg_gs stuff. > > I have zero experience with rdgsbase insn, but the above is not > dependent on __seg_gs, so (the movq part at least) would also work in > the current mainline. To work together with __seg_gs stuff, > this_cpu_offset should be enclosed in __my_cpu_var. Also, if rdgsbase > is substituted with rdfsbase, it will also work for 32-bit targets.
In fact, rdgsbase is available only for 64-bit targets.
Uros.
| |