[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whk1WOVzHdoQDm0wM+8ZrpG+zLucWCHhWAcs5OV7M6Q7Q@mail.gmail.com>
Date: Thu, 12 Oct 2023 12:40:52 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Nadav Amit <namit@...are.com>
Cc: Uros Bizjak <ubizjak@...il.com>,
"the arch/x86 maintainers" <x86@...nel.org>,
Linux Kernel Mailing List <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>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()
On Thu, 12 Oct 2023 at 12:32, Nadav Amit <namit@...are.com> wrote:
>
> If you refer to the difference between DECLARE_PER_CPU_ALIGNED() and
> DECLARE_PER_CPU() - that’s just a silly mistake that I made porting my
> old patch (I also put “const” in the wrong place of the declaration, sorry).
Yes, the only difference is the ALIGNED and the 'const', but I think
also the alias attribute.
However, I'd be happier if we had just one place that declares them, not two.
Even if the two were identical, it seems wrong to have two
declarations for the same thing.
> The “trick” that the patch does is to expose a new const_pcpu_hot symbol that has
> a “const” qualifier. For compilation units from which the symbol is effectively
> constant, we use const_pcpu_hot. The compiler then knows that the value would not
> change.
Oh, I don't disagree with that part.
I just don't see why the 'asm' version would have any difference. For
that too, the compiler should see that the result of the asm doesn't
change.
So my confusion / worry is not about the const alias. I like that part.
My worry is literally "in other situations we _have_ to use asm(), and
it's not clear why gcc wouldn't do as well for it".
Linus
Powered by blists - more mailing lists