xen/percpu: Cleanup
cover xen/percpu: Cleanup
This is all cleanup which I got tangled in as part of the TSS xpti v2 fix, before deciding that this is far too invasive to backport, whereas the TSS fix itself really does want backporting.
This series is based on:
https://lore.kernel.org/xen-devel/[email protected]/T/#t
but is not intended for backport to previous versions of Xen.
Andrew Cooper (4):
arm/percpu: Move {get,set}_processor_id() into smp.h xen/percpu: Drop unused xen/percpu.h includes xen/percpu: Drop unused asm/percpu.h includes xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
xen/arch/arm/xen.lds.S | 1 - xen/arch/x86/acpi/cpufreq/cpufreq.c | 1 - xen/arch/x86/acpi/cpufreq/powernow.c | 1 - xen/arch/x86/cpu/mcheck/mce.h | 3 ++- xen/arch/x86/crash.c | 1 - xen/arch/x86/xen.lds.S | 1 - xen/common/core_parking.c | 2 +- xen/drivers/cpufreq/cpufreq.c | 2 +- xen/include/asm-arm/percpu.h | 11 ----------- xen/include/asm-arm/smp.h | 8 ++++++++ xen/include/asm-x86/asm_defns.h | 1 - xen/include/asm-x86/cpuid.h | 2 +- xen/include/asm-x86/i387.h | 1 - xen/include/asm-x86/irq.h | 2 +- xen/include/asm-x86/percpu.h | 5 ----- xen/include/xen/kexec.h | 1 - xen/include/xen/multicall.h | 1 - xen/include/xen/percpu.h | 6 ++++++ xen/include/xen/rcupdate.h | 1 - xen/include/xen/rwlock.h | 1 + xen/include/xen/spinlock.h | 1 - xen/xsm/flask/include/avc.h | 3 ++- 22 files changed, 23 insertions(+), 33 deletions(-)
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/4 arm/percpu: Move {get, set}_processor_id() into smp.h
For cleanup purposes, it is necessary for asm/percpu.h to not use DECLARE_PER_CPU() itself. asm/smp.h is arguably a better place for it to live anyway.
---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
--- xen/include/asm-arm/percpu.h | 6 ------ xen/include/asm-arm/smp.h | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-)
xen/include/asm-arm/percpu.h +0 -6
@@ -25,12 +25,6 @@ void percpu_init_areas(void);#define DECLARE_PER_CPU (type, name) extern __typeof__(type) per_cpu__##name -DECLARE_PER_CPU(unsigned int, cpu_id); -#define get_processor_id () (this_cpu(cpu_id)) -#define set_processor_id (id) do { \ - WRITE_SYSREG(__per_cpu_offset[id], TPIDR_EL2); \ - this_cpu(cpu_id) = (id); \ -} while(0)#endif #endif /* __ARM_PERCPU_H__ */
xen/include/asm-arm/smp.h +8 -0
@@ -7,11 +7,19 @@#include <asm/current.h> #endif +DECLARE_PER_CPU(unsigned int, cpu_id);DECLARE_PER_CPU (cpumask_var_t, cpu_sibling_mask);DECLARE_PER_CPU (cpumask_var_t, cpu_core_mask);#define cpu_is_offline (cpu) unlikely(!cpu_online(cpu)) +#define get_processor_id () this_cpu(cpu_id) +#define set_processor_id (id) \ +do { \ + WRITE_SYSREG(__per_cpu_offset[(id)], TPIDR_EL2); \ + this_cpu(cpu_id) = (id); \ +} while ( 0 ) +#define raw_smp_processor_id () (get_processor_id())/*
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/4] arm/percpu: Move {get, set}_processor_id() into smp.h
Hi Andrew,
Thank you for looking into this.
Quoted 3 lines · Andrew Cooper
For cleanup purposes, it is necessary for
asm/percpu.hto not useDECLARE_PER_CPU()itself.asm/smp.his arguably a better place for it to live anyway.
I have noticed that a lot of arch helpers called by common code are defined in different headers. The most offenders are in mm.h and page.h.
Looking at x86, the two helpers are defined in current.h. So I think it would make sense to define them at the same places. I don't have a particular preference between smp.h and current.h, just want some consistency :).
FWIW, Xen build nicely when the helpers are moved in current.h:
xen/include/asm-arm/current.h +7 -0
@@ -39,6 +39,13 @@ static inline struct cpu_info *get_cpu_info(void)#define reset_stack_and_jump (fn) switch_stack_and_jump(get_cpu_info(), fn) +DECLARE_PER_CPU(unsigned int, cpu_id); +#define get_processor_id () (this_cpu(cpu_id)) +#define set_processor_id (id) do { \ + WRITE_SYSREG(__per_cpu_offset[id], TPIDR_EL2); \ + this_cpu(cpu_id) = (id); \ +} while(0) +#endif #endif /* __ARM_CURRENT_H__ */
xen/include/asm-arm/percpu.h +0 -6
@@ -27,12 +27,6 @@ void percpu_init_areas(void);#define DECLARE_PER_CPU (type, name) extern __typeof__(type) per_cpu__##name -DECLARE_PER_CPU(unsigned int, cpu_id); -#define get_processor_id () (this_cpu(cpu_id)) -#define set_processor_id (id) do { \ - WRITE_SYSREG(__per_cpu_offset[id], TPIDR_EL2); \ - this_cpu(cpu_id) = (id); \ -} while(0)#endif #endif /* __ARM_PERCPU_H__ */
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/4] arm/percpu: Move {get, set}_processor_id() into smp.h
Quoted 11 lines · Julien Grall
Hi Andrew,
Thank you for looking into this.
Quoted 3 lines · Andrew Cooper
For cleanup purposes, it is necessary for
asm/percpu.hto not useDECLARE_PER_CPU()itself.asm/smp.his arguably a better place for it to live anyway.I have noticed that a lot of arch helpers called by common code are defined in different headers. The most offenders are in
mm.handpage.h.
Those are massive rats nests. At least we're slowly making progress on the outskirts.
Lonterm, I'd like to get to a position where the only time you'd ever include an asm/ header is either from the common header itself, or for headers unique to the current architecture. I expect this to simplify things massively.
Quoted 7 lines
Looking at x86, the two helpers are defined in
current.h. So I think it would make sense to define them at the same places. I don't have a particular preference betweensmp.handcurrent.h, just want some consistency :).FWIW, Xen build nicely when the helpers are moved in
current.h:
I did consider current.h, but couldn't decide and flipped a coin.
I'm perfectly happy to put it here if that's what you'd prefer.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 1/4] arm/percpu: Move {get, set}_processor_id() into smp.h
Hi Andrew,
Quoted 27 lines · Andrew Cooper
Quoted 11 lines · Julien Grall
Hi Andrew,
Thank you for looking into this.
Quoted 3 lines · Andrew Cooper
For cleanup purposes, it is necessary for
asm/percpu.hto not useDECLARE_PER_CPU()itself.asm/smp.his arguably a better place for it to live anyway.I have noticed that a lot of arch helpers called by common code are defined in different headers. The most offenders are in
mm.handpage.h.Those are massive rats nests. At least we're slowly making progress on the outskirts.
Lonterm, I'd like to get to a position where the only time you'd ever include an asm/ header is either from the common header itself, or for headers unique to the current architecture. I expect this to simplify things massively.
Quoted 6 lines
Looking at x86, the two helpers are defined in
current.h. So I think it would make sense to define them at the same places. I don't have a particular preference betweensmp.handcurrent.h, just want some consistency :).
Quoted 5 lines
Quoted 1 line
FWIW, Xen build nicely when the helpers are moved in
current.h:I did consider
current.h, but couldn't decide and flipped a coin.I'm perfectly happy to put it here if that's what you'd prefer.
I would prefer consistency with x86 so, current.h :). Feel free to re-use the diff I provided and add my acked-by.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/4 xen/percpu: Drop unused xen/percpu.h includes
In reply to Andrew CooperNone of these headers use any PER_CPU() infrastructure.
xen/rwlock.h however does, and picked it up transitively via xen/spinlock.h, so include it properly.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
--- xen/include/asm-x86/i387.h | 1 - xen/include/xen/multicall.h | 1 - xen/include/xen/rcupdate.h | 1 - xen/include/xen/rwlock.h | 1 + xen/include/xen/spinlock.h | 1 - 5 files changed, 1 insertion(+), 4 deletions(-)
xen/include/asm-x86/i387.h +0 -1
@@ -12,7 +12,6 @@#define __ASM_I386_I387_H#include <xen/types.h> -#include <xen/percpu.h> /* Byte offset of the stored word size within the FXSAVE area/portion. */ #define FPU_WORD_SIZE_OFFSET 511
xen/include/xen/multicall.h +0 -1
@@ -5,7 +5,6 @@#ifndef __XEN_MULTICALL_H__#define __XEN_MULTICALL_H__ -#include <xen/percpu.h> #ifdef CONFIG_COMPAT #include <compat/xen.h> #endif
xen/include/xen/rcupdate.h +0 -1
@@ -33,7 +33,6 @@#include <xen/cache.h> #include <xen/spinlock.h> -#include <xen/percpu.h> #include <xen/cpumask.h> #include <xen/preempt.h>
xen/include/xen/rwlock.h +1 -0
@@ -1,6 +1,7 @@#ifndef __RWLOCK_H__#define __RWLOCK_H__ +#include <xen/percpu.h> #include <xen/spinlock.h> #include <asm/atomic.h>
xen/include/xen/spinlock.h +0 -1
@@ -4,7 +4,6 @@#include <asm/system.h> #include <asm/spinlock.h> #include <asm/types.h> -#include <xen/percpu.h> #ifndef NDEBUG struct lock_debug {
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/4] xen/percpu: Drop unused xen/percpu.h includes
Quoted 6 lines · Andrew Cooper
None of these headers use any
PER_CPU()infrastructure.
xen/rwlock.hhowever does, and picked it up transitively viaxen/spinlock.h, so include it properly.Signed-off-by Andrew Cooper <[email protected]>
Thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Jan Beulich
Acked-byRe: [Xen-devel] [PATCH 2/4] xen/percpu: Drop unused xen/percpu.h includes
Quoted 9 lines · Roger Pau Monné
Quoted 6 lines · Andrew Cooper
None of these headers use any
PER_CPU()infrastructure.
xen/rwlock.hhowever does, and picked it up transitively viaxen/spinlock.h, so include it properly.Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Roger Pau Monné <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 3/4 xen/percpu: Drop unused asm/percpu.h includes
In reply to Andrew CooperThese files either don't use any PER_CPU() infrastructure at all, or use DEFINE_PER_CPU_*(). This is declared in xen/percpu.h, not asm/percpu.h, which means that xen/percpu.h is included via a different path.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
--- xen/arch/arm/xen.lds.S | 1 - xen/arch/x86/acpi/cpufreq/cpufreq.c | 1 - xen/arch/x86/acpi/cpufreq/powernow.c | 1 - xen/arch/x86/crash.c | 1 - xen/arch/x86/xen.lds.S | 1 - xen/common/core_parking.c | 2 +- xen/drivers/cpufreq/cpufreq.c | 2 +- xen/include/asm-x86/asm_defns.h | 1 - xen/include/xen/kexec.h | 1 - 9 files changed, 2 insertions(+), 9 deletions(-)
xen/arch/arm/xen.lds.S +0 -1
@@ -4,7 +4,6 @@ #include <xen/cache.h> #include <asm/page.h> -#include <asm/percpu.h> #undef ENTRY #undef ALIGN
xen/arch/x86/acpi/cpufreq/cpufreq.c +0 -1
@@ -38,7 +38,6 @@#include <asm/msr.h> #include <asm/io.h> #include <asm/processor.h> -#include <asm/percpu.h> #include <asm/cpufeature.h> #include <acpi/acpi.h> #include <acpi/cpufreq/cpufreq.h>
xen/arch/x86/acpi/cpufreq/powernow.c +0 -1
@@ -32,7 +32,6 @@#include <asm/msr.h> #include <asm/io.h> #include <asm/processor.h> -#include <asm/percpu.h> #include <asm/cpufeature.h> #include <acpi/acpi.h> #include <acpi/cpufreq/cpufreq.h>
xen/arch/x86/crash.c +0 -1
@@ -10,7 +10,6 @@#include <asm/atomic.h> #include <asm/elf.h> -#include <asm/percpu.h> #include <xen/types.h> #include <xen/irq.h> #include <asm/nmi.h>
xen/arch/x86/xen.lds.S +0 -1
@@ -3,7 +3,6 @@ #include <xen/cache.h> #include <asm/page.h> -#include <asm/percpu.h> #undef ENTRY #undef ALIGN
xen/common/core_parking.c +1 -1
@@ -19,7 +19,7 @@#include <xen/cpu.h> #include <xen/init.h> #include <xen/cpumask.h> -#include <asm/percpu.h> +#include <asm/smp.h> #define CORE_PARKING_INCREMENT 1
xen/drivers/cpufreq/cpufreq.c +1 -1
@@ -41,7 +41,7 @@#include <asm/bug.h> #include <asm/io.h> #include <asm/processor.h> -#include <asm/percpu.h> +#include <acpi/acpi.h> #include <acpi/cpufreq/cpufreq.h>
xen/include/asm-x86/asm_defns.h +0 -1
@@ -7,7 +7,6 @@#include <asm/asm-offsets.h> #endif #include <asm/bug.h> -#include <asm/percpu.h> #include <asm/x86-defns.h> #include <xen/stringify.h> #include <asm/cpufeature.h>
xen/include/xen/kexec.h +0 -1
@@ -4,7 +4,6 @@#ifdef CONFIG_KEXEC #include <public/kexec.h> -#include <asm/percpu.h> #include <xen/elfcore.h> #include <xen/kimage.h>
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 3/4] xen/percpu: Drop unused asm/percpu.h includes
Hi Andrew,
Quoted 5 lines · Andrew Cooper
These files either don't use any
PER_CPU()infrastructure at all, or use DEFINE_PER_CPU_*(). This is declared inxen/percpu.h, notasm/percpu.h, which means thatxen/percpu.his included via a different path.Signed-off-by Andrew Cooper <[email protected]>
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 3/4] xen/percpu: Drop unused asm/percpu.h includes
In reply to Andrew CooperQuoted 5 lines · Andrew Cooper
These files either don't use any
PER_CPU()infrastructure at all, or use DEFINE_PER_CPU_*(). This is declared inxen/percpu.h, notasm/percpu.h, which means thatxen/percpu.his included via a different path.Signed-off-by Andrew Cooper <[email protected]>
Thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 3/4] xen/percpu: Drop unused asm/percpu.h includes
In reply to Andrew CooperQuoted 5 lines · Andrew Cooper
These files either don't use any
PER_CPU()infrastructure at all, or use DEFINE_PER_CPU_*(). This is declared inxen/percpu.h, notasm/percpu.h, which means thatxen/percpu.his included via a different path.Signed-off-by Andrew Cooper <[email protected]>
with a remark:
xen/common/core_parking.c line 23
Quoted 9 lines
xen/common/core_parking.c +1
-1@@ -19,7 +19,7 @@#include <xen/cpu.h> #include <xen/init.h> #include <xen/cpumask.h> -#include <asm/percpu.h> +#include <asm/smp.h>
I don't believe in such blank lines to be overly useful, especially when ...
xen/include/xen/kexec.h line 8
Quoted 9 lines
xen/include/xen/kexec.h +0
-1@@ -4,7 +4,6 @@#ifdef CONFIG_KEXEC #include <public/kexec.h> -#include <asm/percpu.h> #include <xen/elfcore.h> #include <xen/kimage.h>
... this model isn't being followed consistently.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 4/4 xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
In reply to Andrew CooperThese macros are identical across the architectures, and shouldn't be separate from the DEFINE_PER_CPU*() infrastructure.
This converts the final asm/percpu.h includes, which were all using DECLARE_PER_CPU(), to include xen/percpu.h instead.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
--- xen/arch/x86/cpu/mcheck/mce.h | 3 ++- xen/include/asm-arm/percpu.h | 5 ----- xen/include/asm-x86/cpuid.h | 2 +- xen/include/asm-x86/irq.h | 2 +- xen/include/asm-x86/percpu.h | 5 ----- xen/include/xen/percpu.h | 6 ++++++ xen/xsm/flask/include/avc.h | 3 ++- 7 files changed, 12 insertions(+), 14 deletions(-)
xen/arch/x86/cpu/mcheck/mce.h +2 -1
@@ -3,12 +3,13 @@#define _MCE_H#include <xen/init.h> +#include <xen/percpu.h> #include <xen/sched.h> #include <xen/smp.h> +#include <asm/types.h> #include <asm/traps.h> #include <asm/atomic.h> -#include <asm/percpu.h> #include "x86_mca.h" #include "mctelem.h"
xen/include/asm-arm/percpu.h +0 -5
@@ -10,9 +10,6 @@ extern char __per_cpu_start[], __per_cpu_data_end[];extern unsigned long __per_cpu_offset[NR_CPUS ];void percpu_init_areas (void ); -#define __DEFINE_PER_CPU (attr, type, name) \ - attr __typeof__(type) per_cpu_ ## name -#define per_cpu (var, cpu) \ (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))#define this_cpu (var) \
@@ -23,8 +20,6 @@ void percpu_init_areas(void);#define this_cpu_ptr (var) \ (*RELOC_HIDE(var, READ_SYSREG(TPIDR_EL2))) -#define DECLARE_PER_CPU (type, name) extern __typeof__(type) per_cpu__##name -#endif #endif /* __ARM_PERCPU_H__ */
xen/include/asm-x86/cpuid.h +1 -1
@@ -2,11 +2,11 @@#define __X86_CPUID_H__#include <asm/cpufeatureset.h> -#include <asm/percpu.h> #ifndef __ASSEMBLY__#include <xen/types.h> #include <xen/kernel.h> +#include <xen/percpu.h> #include <xen/lib/x86/cpu-policy.h> #include <xen/lib/x86/cpuid.h>
xen/include/asm-x86/irq.h +1 -1
@@ -6,10 +6,10 @@#include <asm/atomic.h> #include <asm/numa.h> #include <xen/cpumask.h> +#include <xen/percpu.h> #include <xen/smp.h> #include <asm/hvm/irq.h> #include <irq_vectors.h> -#include <asm/percpu.h> extern unsigned int nr_irqs_gsi;extern unsigned int nr_irqs;
xen/include/asm-x86/percpu.h +0 -5
@@ -7,17 +7,12 @@ extern unsigned long __per_cpu_offset[NR_CPUS];void percpu_init_areas (void );#endif -#define __DEFINE_PER_CPU (attr, type, name) \ - attr __typeof__(type) per_cpu_ ## name -/* var is in discarded region: offset to particular copy we want */ #define per_cpu (var, cpu) \ (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))#define this_cpu (var) \ (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset)) -#define DECLARE_PER_CPU (type, name) extern __typeof__(type) per_cpu__##name -#define this_cpu_ptr (var) \ (*RELOC_HIDE(var, get_cpu_info()->per_cpu_offset))
xen/include/xen/percpu.h +6 -0
@@ -3,6 +3,12 @@#include <asm/percpu.h> +#define DECLARE_PER_CPU (type, name) \ + extern __typeof__(type) per_cpu__ ## name + +#define __DEFINE_PER_CPU (attr, type, name) \ + attr __typeof__(type) per_cpu_ ## name +/* * Separate out the type, so (int[3], foo) works. *
xen/xsm/flask/include/avc.h +2 -1
@@ -11,8 +11,9 @@#include <xen/errno.h> #include <xen/lib.h> +#include <xen/percpu.h> #include <xen/spinlock.h> -#include <asm/percpu.h> +#include "flask.h" #include "av_permissions.h" #include "security.h"
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
Hi Andrew,
Quoted 7 lines · Andrew Cooper
These macros are identical across the architectures, and shouldn't be separate from the DEFINE_PER_CPU*() infrastructure.
This converts the final
asm/percpu.hincludes, which were all usingDECLARE_PER_CPU(), to includexen/percpu.hinstead.Signed-off-by Andrew Cooper <[email protected]>
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
In reply to Andrew CooperQuoted 7 lines · Andrew Cooper
These macros are identical across the architectures, and shouldn't be separate from the DEFINE_PER_CPU*() infrastructure.
This converts the final
asm/percpu.hincludes, which were all usingDECLARE_PER_CPU(), to includexen/percpu.hinstead.Signed-off-by Andrew Cooper <[email protected]>
Thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
In reply to Andrew CooperQuoted 5 lines · Andrew Cooper
xen/include/xen/percpu.h +0
-0@@ -3,6 +3,12 @@#include <asm/percpu.h>
xen/include/xen/percpu.h line 14
Quoted 10 lines
xen/include/xen/percpu.h +6
-0+#define DECLARE_PER_CPU (type, name) \ + extern __typeof__(type) per_cpu__ ## name + +#define __DEFINE_PER_CPU (attr, type, name) \ + attr __typeof__(type) per_cpu_ ## name +/* * Separate out the type, so (int[3], foo) works. *
By moving things here you render stale the remainder of the comment in context above: No per-arch symbol name prefix is going to be possible anymore. I'm not against it, but this comment would then want adjusting. What's not immediately clear to me is whether the two-stage concatenation of an underscore each is then still necessary.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Andrew Cooper
xen/include/xen/percpu.h +0
-0@@ -3,6 +3,12 @@#include <asm/percpu.h>
Quoted 15 lines
xen/include/xen/percpu.h line 14
Quoted 9 lines
xen/include/xen/percpu.h +6
-0+#define DECLARE_PER_CPU (type, name) \ + extern __typeof__(type) per_cpu__ ## name + +#define __DEFINE_PER_CPU (attr, type, name) \ + attr __typeof__(type) per_cpu_ ## name +/* * Separate out the type, so (int[3], foo) works. * By moving things here you render stale the remainder of the comment in context above: No per-arch symbol name prefix is going to be possible anymore. I'm not against it, but this comment would then want adjusting. What's not immediately clear to me is whether the two-stage concatenation of an underscore each is then still necessary.
Yes it is still necessary. See the TSS thread for why.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
Quoted 24 lines · Andrew Cooper
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Andrew Cooper
xen/include/xen/percpu.h +0
-0@@ -3,6 +3,12 @@#include <asm/percpu.h> Quoted 15 lines
xen/include/xen/percpu.h line 14
Quoted 9 lines
xen/include/xen/percpu.h +6
-0+#define DECLARE_PER_CPU (type, name) \ + extern __typeof__(type) per_cpu__ ## name + +#define __DEFINE_PER_CPU (attr, type, name) \ + attr __typeof__(type) per_cpu_ ## name +/* * Separate out the type, so (int[3], foo) works. * By moving things here you render stale the remainder of the comment in context above: No per-arch symbol name prefix is going to be possible anymore. I'm not against it, but this comment would then want adjusting. What's not immediately clear to me is whether the two-stage concatenation of an underscore each is then still necessary.
Quoted 1 line
Yes it is still necessary. See the TSS thread for why.
No, that thread doesn't explain it. From an initial look I think two-stage expansion is still necessary, but it could then be _ ## name on the first and per_cpu ## name on the second (i.e. no double underscore in the middle anymore). Of course there may be reasons why we actually _want_ a double underscore there.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Andrew Cooper
Quoted 22 lines · Jan Beulich
Quoted 5 lines · Andrew Cooper
xen/include/xen/percpu.h +0
-0@@ -3,6 +3,12 @@#include <asm/percpu.h> xen/include/xen/percpu.h line 14
Quoted 10 lines
xen/include/xen/percpu.h +6
-0+#define DECLARE_PER_CPU (type, name) \ + extern __typeof__(type) per_cpu__ ## name + +#define __DEFINE_PER_CPU (attr, type, name) \ + attr __typeof__(type) per_cpu_ ## name +/* * Separate out the type, so (int[3], foo) works. * By moving things here you render stale the remainder of the comment in context above: No per-arch symbol name prefix is going to be possible anymore. I'm not against it, but this comment would then want adjusting. What's not immediately clear to me is whether the two-stage concatenation of an underscore each is then still necessary.
Quoted 3 lines
Quoted 1 line
Yes it is still necessary. See the TSS thread for why.
No, that thread doesn't explain it. From an initial look I think two-stage expansion is still necessary
It is about preventing 'name' being expanded, due to the mess with cpumask_scratch, which requires a ## at least at the top level.
I personally think that fixing cpumask_scratch is the right way to go, but I specifically didn't touch that so as to avoid wreaking havoc with Juergen's core-scheduling series.
Quoted 3 lines
, but it could then be
_ ## name on the first andper_cpu## name on the second (i.e. no double underscore in the middle anymore).
Hmm, probably, but...
Quoted 2 lines
Of course there may
be reasons why we actually _want_ a double underscore there.
... I don't have the effort or energy - but most importantly, time - to rewrite Xen from scratch.
If there is a concrete reason why dropping the double underscore is good/necessary/other, then it should be present as its own patch, not crowbarred into an unrelated cleanup patch.
Until then, the inertia of "because its already like this" wins.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
Quoted 45 lines · Andrew Cooper
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Andrew Cooper
Quoted 22 lines · Jan Beulich
Quoted 5 lines · Andrew Cooper
xen/include/xen/percpu.h +0
-0@@ -3,6 +3,12 @@#include <asm/percpu.h> xen/include/xen/percpu.h line 14
Quoted 10 lines
xen/include/xen/percpu.h +6
-0+#define DECLARE_PER_CPU (type, name) \ + extern __typeof__(type) per_cpu__ ## name + +#define __DEFINE_PER_CPU (attr, type, name) \ + attr __typeof__(type) per_cpu_ ## name +/* * Separate out the type, so (int[3], foo) works. * By moving things here you render stale the remainder of the comment in context above: No per-arch symbol name prefix is going to be possible anymore. I'm not against it, but this comment would then want adjusting. What's not immediately clear to me is whether the two-stage concatenation of an underscore each is then still necessary.
Quoted 3 lines
Quoted 1 line
Yes it is still necessary. See the TSS thread for why.
No, that thread doesn't explain it. From an initial look I think two-stage expansion is still necessary
It is about preventing 'name' being expanded, due to the mess with
cpumask_scratch, which requires a ## at least at the top level.I personally think that fixing
cpumask_scratchis the right way to go, but I specifically didn't touch that so as to avoid wreaking havoc with Juergen's core-scheduling series.Quoted 3 lines
, but it could then be
_ ## name on the first andper_cpu## name on the second (i.e. no double underscore in the middle anymore).Hmm, probably, but...
Quoted 2 lines
Of course there may
be reasons why we actually _want_ a double underscore there.
Quoted 8 lines
... I don't have the effort or energy - but most importantly, time - to rewrite Xen from scratch.
If there is a concrete reason why dropping the double underscore is good/necessary/other, then it should be present as its own patch, not crowbarred into an unrelated cleanup patch.
Until then, the inertia of "because its already like this" wins.
And this is all fine, as long as the comment in question continues to reflect reality after this change.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 4/4] xen/percpu: Make DECLARE_PER_CPU() and __DEFINE_PER_CPU() common
In reply to Andrew CooperQuoted 29 lines · Andrew Cooper
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Andrew Cooper
Quoted 22 lines · Jan Beulich
Quoted 5 lines · Andrew Cooper
xen/include/xen/percpu.h +0
-0@@ -3,6 +3,12 @@#include <asm/percpu.h> xen/include/xen/percpu.h line 14
Quoted 10 lines
xen/include/xen/percpu.h +6
-0+#define DECLARE_PER_CPU (type, name) \ + extern __typeof__(type) per_cpu__ ## name + +#define __DEFINE_PER_CPU (attr, type, name) \ + attr __typeof__(type) per_cpu_ ## name +/* * Separate out the type, so (int[3], foo) works. * By moving things here you render stale the remainder of the comment in context above: No per-arch symbol name prefix is going to be possible anymore. I'm not against it, but this comment would then want adjusting. What's not immediately clear to me is whether the two-stage concatenation of an underscore each is then still necessary.
Quoted 3 lines
Quoted 1 line
Yes it is still necessary. See the TSS thread for why.
No, that thread doesn't explain it. From an initial look I think two-stage expansion is still necessary
Quoted 6 lines
It is about preventing 'name' being expanded, due to the mess with
cpumask_scratch, which requires a ## at least at the top level.I personally think that fixing
cpumask_scratchis the right way to go, but I specifically didn't touch that so as to avoid wreaking havoc with Juergen's core-scheduling series.
I appreciate that, but I don't think a large series like mine should block efforts to make Xen cleaner.
Especially this case should be rather easy to handle, as there is no change of the logic of the patches to be expected.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel