Re: [PATCH] x86/asm: Remove unused COMPILE_OFFSETS macro from asm-offsets.c

From: Vincent MAILHOL
Date: Tue Nov 29 2022 - 05:15:17 EST


On Tue. 29 Nov. 2022 at 04:10, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> On Mon, 28 Nov 2022 18:06:18 +0000
> Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> > > > IIRC, the reason for adding that was because that logic was screwing up
> > > > asm-offsets.c. I'm not sure it screws up kvm-asm-offsets.c though.
> > > >
> > > > This is one of those cases I wish I commented that code better :-/
> > >
> > > I don't think KVM includes linux/ftrace.h or asm/ftrace.h at all.
> >
> > >From include/linux/kvm_host.h
> >
> > #include <linux/ftrace.h>
> >
> > Even if that didn't exist, saying that XYZ never includes a header is a dangerous
> > business, it's all too easy to indirectly include headers in the kernel, now or
> > in the future.

ACK. This is why I relied on the compiler's -Wunused-macros to assert
that COMPILE_OFFSETS can be removed from asm-offsets.c but not from
kvm-asm-offsets.c.
I also asserted that it is
https://git.kernel.org/torvalds/linux/c/debc5a1ec0d1 which removed the
dependency.

> But going back to the original intent of COMPILE_OFFSETS. I believe it was
> because some code that did not work with the auto generation of compiler
> offsets and was a way to hide them.
>
> I do not know if it is still an issue or not today.

This I do not know. I only have the confidence to remove
COMPILE_OFFSETS from asm-offsets.c. Nothing more.