On Thu, Aug 21, 2025 at 2:38 AM Menglong Dong <menglong8.dong@xxxxxxxxx> wrote: > > The include/generated/asm-offsets.h is generated in Kbuild during > compiling from arch/SRCARCH/kernel/asm-offsets.c. When we want to > generate another similar offset header file, circular dependency can > happen. Is there a way to avoid all this churn? > For example, we want to generate a offset file include/generated/test.h, > which is included in include/sched/sched.h. If we generate asm-offsets.h > first, it will fail, as include/sched/sched.h is included in asm-offsets.c if so, may be don't add "static inline void migrate_disable()" to sched.h and instead add it to preempt.h and it will avoid this issue? > and include/generated/test.h doesn't exist; If we generate test.h first, > it can't success neither, as include/generated/asm-offsets.h is included > by it. > > In x86_64, the macro COMPILE_OFFSETS is used to avoid such circular > dependency. We can generate asm-offsets.h first, and if the > COMPILE_OFFSETS is defined, we don't include the "generated/test.h". > > And we define the macro COMPILE_OFFSETS for all the asm-offsets.c for this > purpose.