RE: [PATCH v3 4/6] x86/gsseg: move local_irq_save/restore() into asm_load_gs_index()

From: Li, Xin3
Date: Tue Oct 18 2022 - 13:26:03 EST


> > static inline void native_load_gs_index(unsigned int selector) {
> > - unsigned long flags;
> > -
> > - local_irq_save(flags);
> > asm_load_gs_index(selector);
> > - local_irq_restore(flags);
> > }
>
> static inline void native_load_gs_index(unsigned int selector) {
> unsigned long flags;
>
> if (cpu_feature_enabled(LKGS)) {
> native_lkgs(selector);
> } else {
> local_irq_save(flags);
> asm_load_gs_index(selector);
> local_irq_restore(flags);
> }
> }
>
> For paravirt enabled kernels we want during feature detection:
>
> if (cpu_feature_enabled(LKGS)))
> pv_ops.cpu.load_gs_index = native_lkgs;

If we use static_cpu_has in native_load_gs_index
if (static_cpu_has(X86_FEATURE_LKGS)) {
native_lkgs(selector);
}

We don't have to change pv_ops.cpu.load_gs_index, right?

Thanks!
Xin

>
> No?
>
> Thanks,
>
> tglx