Message ID | 521647680aa5010629ded799010c8f9e5d22cde3.1694702259.git.oleksii.kurochko@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Introduce stub headers necessary for full Xen build | expand |
On 14.09.2023 16:56, Oleksii Kurochko wrote: > --- /dev/null > +++ b/xen/include/asm-generic/percpu.h > @@ -0,0 +1,35 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +#ifndef __ASM_GENERIC_PERCPU_H__ > +#define __ASM_GENERIC_PERCPU_H__ > + > +#ifndef __ASSEMBLY__ > + > +#include <xen/types.h> > + > +extern char __per_cpu_start[], __per_cpu_data_end[]; > +extern unsigned long __per_cpu_offset[NR_CPUS]; > +void percpu_init_areas(void); > + > +#define per_cpu(var, cpu) \ > + (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) > + > +#define this_cpu(var) \ > + (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[get_processor_id()])) > + > +#define per_cpu_ptr(var, cpu) \ > + (*RELOC_HIDE(var, __per_cpu_offset[cpu])) > +#define this_cpu_ptr(var) \ > + (*RELOC_HIDE(var, get_processor_id())) > + > +#endif > + > +#endif /* __ASM_GENERIC_PERCPU_H__ */ This looks okay, just one request: Please use smp_processor_id(). You may have seen on the Matrix channel that there's the intention to do away with the get_processor_id() alias that's used in only very few places. Jan
On Thu, 2023-10-19 at 12:39 +0200, Jan Beulich wrote: > On 14.09.2023 16:56, Oleksii Kurochko wrote: > > --- /dev/null > > +++ b/xen/include/asm-generic/percpu.h > > @@ -0,0 +1,35 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > +#ifndef __ASM_GENERIC_PERCPU_H__ > > +#define __ASM_GENERIC_PERCPU_H__ > > + > > +#ifndef __ASSEMBLY__ > > + > > +#include <xen/types.h> > > + > > +extern char __per_cpu_start[], __per_cpu_data_end[]; > > +extern unsigned long __per_cpu_offset[NR_CPUS]; > > +void percpu_init_areas(void); > > + > > +#define per_cpu(var, cpu) \ > > + (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) > > + > > +#define this_cpu(var) \ > > + (*RELOC_HIDE(&per_cpu__##var, > > __per_cpu_offset[get_processor_id()])) > > + > > +#define per_cpu_ptr(var, cpu) \ > > + (*RELOC_HIDE(var, __per_cpu_offset[cpu])) > > +#define this_cpu_ptr(var) \ > > + (*RELOC_HIDE(var, get_processor_id())) > > + > > +#endif > > + > > +#endif /* __ASM_GENERIC_PERCPU_H__ */ > > This looks okay, just one request: Please use smp_processor_id(). You > may have seen on the Matrix channel that there's the intention to do > away with the get_processor_id() alias that's used in only very few > places. Thanks. I'll update the patch. ~ Oleksii
diff --git a/xen/include/asm-generic/percpu.h b/xen/include/asm-generic/percpu.h new file mode 100644 index 0000000000..d1069adb61 --- /dev/null +++ b/xen/include/asm-generic/percpu.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __ASM_GENERIC_PERCPU_H__ +#define __ASM_GENERIC_PERCPU_H__ + +#ifndef __ASSEMBLY__ + +#include <xen/types.h> + +extern char __per_cpu_start[], __per_cpu_data_end[]; +extern unsigned long __per_cpu_offset[NR_CPUS]; +void percpu_init_areas(void); + +#define per_cpu(var, cpu) \ + (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu])) + +#define this_cpu(var) \ + (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[get_processor_id()])) + +#define per_cpu_ptr(var, cpu) \ + (*RELOC_HIDE(var, __per_cpu_offset[cpu])) +#define this_cpu_ptr(var) \ + (*RELOC_HIDE(var, get_processor_id())) + +#endif + +#endif /* __ASM_GENERIC_PERCPU_H__ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */
The patch introduces header stub necessry for full Xen build. Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> --- xen/include/asm-generic/percpu.h | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 xen/include/asm-generic/percpu.h