Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-6.15a-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fix from Juergen Gross:
"Just a single fix for the Xen multicall driver avoiding a percpu
variable referencing initdata by its initializer"

* tag 'for-linus-6.15a-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen: fix multicall debug feature

+14 -16
+14 -12
arch/x86/xen/multicalls.c
··· 54 54 55 55 static DEFINE_PER_CPU(struct mc_buffer, mc_buffer); 56 56 static struct mc_debug_data mc_debug_data_early __initdata; 57 - static DEFINE_PER_CPU(struct mc_debug_data *, mc_debug_data) = 58 - &mc_debug_data_early; 59 57 static struct mc_debug_data __percpu *mc_debug_data_ptr; 60 58 DEFINE_PER_CPU(unsigned long, xen_mc_irq_flags); 61 59 62 60 static struct static_key mc_debug __ro_after_init; 63 61 static bool mc_debug_enabled __initdata; 62 + 63 + static struct mc_debug_data * __ref get_mc_debug(void) 64 + { 65 + if (!mc_debug_data_ptr) 66 + return &mc_debug_data_early; 67 + 68 + return this_cpu_ptr(mc_debug_data_ptr); 69 + } 64 70 65 71 static int __init xen_parse_mc_debug(char *arg) 66 72 { ··· 77 71 } 78 72 early_param("xen_mc_debug", xen_parse_mc_debug); 79 73 80 - void mc_percpu_init(unsigned int cpu) 81 - { 82 - per_cpu(mc_debug_data, cpu) = per_cpu_ptr(mc_debug_data_ptr, cpu); 83 - } 84 - 85 74 static int __init mc_debug_enable(void) 86 75 { 87 76 unsigned long flags; 77 + struct mc_debug_data __percpu *mcdb; 88 78 89 79 if (!mc_debug_enabled) 90 80 return 0; 91 81 92 - mc_debug_data_ptr = alloc_percpu(struct mc_debug_data); 93 - if (!mc_debug_data_ptr) { 82 + mcdb = alloc_percpu(struct mc_debug_data); 83 + if (!mcdb) { 94 84 pr_err("xen_mc_debug inactive\n"); 95 85 static_key_slow_dec(&mc_debug); 96 86 return -ENOMEM; ··· 95 93 /* Be careful when switching to percpu debug data. */ 96 94 local_irq_save(flags); 97 95 xen_mc_flush(); 98 - mc_percpu_init(0); 96 + mc_debug_data_ptr = mcdb; 99 97 local_irq_restore(flags); 100 98 101 99 pr_info("xen_mc_debug active\n"); ··· 157 155 trace_xen_mc_flush(b->mcidx, b->argidx, b->cbidx); 158 156 159 157 if (static_key_false(&mc_debug)) { 160 - mcdb = __this_cpu_read(mc_debug_data); 158 + mcdb = get_mc_debug(); 161 159 memcpy(mcdb->entries, b->entries, 162 160 b->mcidx * sizeof(struct multicall_entry)); 163 161 } ··· 237 235 238 236 ret.mc = &b->entries[b->mcidx]; 239 237 if (static_key_false(&mc_debug)) { 240 - struct mc_debug_data *mcdb = __this_cpu_read(mc_debug_data); 238 + struct mc_debug_data *mcdb = get_mc_debug(); 241 239 242 240 mcdb->caller[b->mcidx] = __builtin_return_address(0); 243 241 mcdb->argsz[b->mcidx] = args;
-1
arch/x86/xen/smp_pv.c
··· 305 305 return rc; 306 306 307 307 xen_pmu_init(cpu); 308 - mc_percpu_init(cpu); 309 308 310 309 /* 311 310 * Why is this a BUG? If the hypercall fails then everything can be
-3
arch/x86/xen/xen-ops.h
··· 261 261 */ 262 262 struct multicall_space xen_mc_extend_args(unsigned long op, size_t arg_size); 263 263 264 - /* Do percpu data initialization for multicalls. */ 265 - void mc_percpu_init(unsigned int cpu); 266 - 267 264 extern bool is_xen_pmu; 268 265 269 266 irqreturn_t xen_pmu_irq_handler(int irq, void *dev_id);