[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADxym3ZoAW6Wfn-TYBFeEPnPbb-Xqc=ZWpAmoL4Bzea83UuJnw@mail.gmail.com>
Date: Wed, 27 Aug 2025 14:22:39 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>, Steven Rostedt <rostedt@...dmis.org>,
Benjamin Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, Eduard <eddyz87@...il.com>,
Song Liu <song@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
tzimmermann@...e.de, simona.vetter@...ll.ch,
Jani Nikula <jani.nikula@...el.com>, LKML <linux-kernel@...r.kernel.org>,
bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH v3 1/3] arch: add the macro COMPILE_OFFSETS to all the asm-offsets.c
On Wed, Aug 27, 2025 at 11:04 AM Alexei Starovoitov
<alexei.starovoitov@...il.com> wrote:
>
> On Thu, Aug 21, 2025 at 2:38 AM Menglong Dong <menglong8.dong@...il.com> 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?
It's hard to avoid this churn. Take bounds.c for example, it defines
the macro __GENERATING_BOUNDS_H. For the header files that
it includes, it will exclude almost all the unnecessary code in
page-flags.h, mmzone.h if __GENERATING_BOUNDS_H is defined.
We can't use this approach, as it's hard to decide what to exclude
in sched.h.
We can't add migrate_disable or __migrate_disable to preempt.h,
as struct task is used in it, which is not available in preempt.h :/
I think this stuff can be reused in the feature if someone wants
to add such an offset.
Thanks!
Menglong Dong
>
> > 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.
Powered by blists - more mailing lists