[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFULd4bKs9SF95vh94+4wXtJV2TXX7qQ8SwC39X7ZL5JAnWQ4A@mail.gmail.com>
Date: Thu, 5 Sep 2024 14:13:49 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: Xi Ruoyao <xry111@...111.site>
Cc: Huacai Chen <chenhuacai@...nel.org>, loongarch@...ts.linux.dev,
linux-kernel@...r.kernel.org, WANG Xuerui <kernel@...0n.name>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v3] LoongArch/percpu: Simplify _percpu_read() and _percpu_write()
On Thu, Sep 5, 2024 at 1:58 PM Xi Ruoyao <xry111@...111.site> wrote:
>
> On Thu, 2024-09-05 at 19:47 +0800, Huacai Chen wrote:
> > > +#define _percpu_write(size, _pcp, _val) \
> > > +do { \
> > > + unsigned long __pcp_val = __pcpu_cast_##size(_val); \
> > > + \
> > > + if (0) { \
> > > + typeof(_pcp) pto_tmp__; \
> > > + pto_tmp__ = (_val); \
> > > + (void)pto_tmp__; \
> > > + } \
> > Emmm, in V2 I just confirm that whether it is worth to use macro
> > instead of inline functions, I think we don't really need such a
> > checking here. :)
>
> It's still (slighly) better (just from aesthetics view) to use inline
> function instead of macro. Is it possible to clear the header
> dependency and break the circle so we can still use __percpu in arch
> percpu.h instead?
Unfortunately, it is not possible. __percpu will use macros, defined
in <include/percpu.h>, and <include/percpu.h> needs
<loongarch/include/asm/percpu.h>. Up to now, it was enough to include
<include/linux/compiler_types.h>, so it was possible to avoid
unresolved include dependency.
> (Simply removing __percpu from the function parameter list causes many
> warnings with make C=1.)
This, and if/when loongson will use percpu named address checks, it
will break compilation.
FYI, it is possible to implement the same percpu address space checks
for loongson (as for x86) with clang and its address space attribute.
The compiler has to provide __typeof_unqual__ and the arch has to
define
# define __per_cpu_qual __attribute__((address_space(1)))
in its percpu.h file.
But we are not there yet ;)
Uros.
Powered by blists - more mailing lists