RE: [PATCH 5/6] x86/gsseg: move load_gs_index() to its own header file

From: Li, Xin3
Date: Fri Oct 07 2022 - 18:41:53 EST


> On October 7, 2022 8:40:41 AM PDT, Brian Gerst <brgerst@xxxxxxxxx> wrote:
> >On Thu, Oct 6, 2022 at 12:13 PM Xin Li <xin3.li@xxxxxxxxx> wrote:
> >>
> >> From: "H. Peter Anvin (Intel)" <hpa@xxxxxxxxx>
> >>
> >> <asm/cpufeature.h> depends on <asm/special_insns.h>, so in order to
> >> be able to use alternatives in native_load_gs_index(), factor it out
> >> into a separate header file.
> >>
> >> Signed-off-by: H. Peter Anvin (Intel) <hpa@xxxxxxxxx>
> >> Signed-off-by: Xin Li <xin3.li@xxxxxxxxx>
> >
> >This could be moved into <asm/segment.h> instead of creating a new header
> file.

Good suggestion. However I still prefer to keep GS segment in its own header file,
1) it's a special segment for x86_64 kernel, and it's more readable to keep it separated.
2) segment.h is included in too many files, but gsseg.h only 4 files. We avoid header pollution.

Maybe we should even factor GS segment out of segment.h for x86_64.

Xin

> >
> >--
> >Brian Gerst
>
> At least at the time I wrote the code, it could not, without creating yet another
> circular header file dependency.