[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFULd4Zyv7KVo=pO5wEXbuh6bFmAkx=Hgx+LqDuLxAD+nTYS6Q@mail.gmail.com>
Date: Sat, 21 Oct 2023 17:11:58 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Andy Lutomirski <luto@...nel.org>,
Brian Gerst <brgerst@...il.com>,
Denys Vlasenko <dvlasenk@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Nadav Amit <namit@...are.com>
Subject: Re: [PATCH -tip v2] x86/percpu: Introduce const-qualified const_pcpu_hot
On Sat, Oct 21, 2023 at 5:00 PM Ingo Molnar <mingo@...nel.org> wrote:
>
>
> * Uros Bizjak <ubizjak@...il.com> wrote:
>
> > arch/x86/include/asm/current.h | 7 +++++++
> > arch/x86/include/asm/percpu.h | 6 +++---
> > arch/x86/include/asm/processor.h | 3 +++
> > arch/x86/kernel/cpu/common.c | 1 +
> > arch/x86/kernel/vmlinux.lds.S | 1 +
> > include/linux/compiler.h | 2 +-
> > 6 files changed, 16 insertions(+), 4 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/current.h b/arch/x86/include/asm/current.h
> > index a1168e7b69e5..0538d2436673 100644
> > --- a/arch/x86/include/asm/current.h
> > +++ b/arch/x86/include/asm/current.h
> > @@ -36,8 +36,15 @@ static_assert(sizeof(struct pcpu_hot) == 64);
> >
> > DECLARE_PER_CPU_ALIGNED(struct pcpu_hot, pcpu_hot);
> >
> > +/* const-qualified alias to pcpu_hot, aliased by linker. */
> > +DECLARE_PER_CPU_ALIGNED(const struct pcpu_hot __percpu_seg_override,
> > + const_pcpu_hot);
>
> The aliasing makes me a bit nervous. Could we at least prefix it a bit more
> prominently, like const__pcpu_hot? That way it's immediately obvious at all
> usage sites that it's "special".
Sure, it can be renamed. The symbol - although aliased - may be used
in a general way. It is const-qualified and placed in __seg_gs address
space, so all the rules for const and __seg_gs qualifications apply.
However, the values are not that constant, and can be changed behind
the scenes via the pcpu_hot R/W alias.
Uros.
Powered by blists - more mailing lists