This commit adds a destination CPU to __call_single_data, and is inspired by an earlier commit by Peter Zijlstra. This version adds #ifdef to permit use by 32-bit systems and supplying the destination CPU for all smp_call_function*() requests, not just smp_call_function_single(). If need be, 32-bit systems could be accommodated by shrinking the flags field to 16 bits (the atomic_t variant is currently unused) and by providing only eight bits for CPU on such systems. It is not clear that the addition of the fields to __call_single_node are really needed. [ paulmck: Apply Boqun Feng feedback on 32-bit builds. ] Link: https://lore.kernel.org/lkml/20200615164048.GC2531@hirez.programming.kicks-ass.net/ Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Unified · Split
| @@ -26,6 +26,9 @@ struct __call_single_data { · 25 unmodified lines | |||
| 26 | struct { | 26 | struct { |
| 27 | struct llist_node llist; | 27 | struct llist_node llist; |
| 28 | unsigned int flags; | 28 | unsigned int flags; |
| 29 | #ifdef CONFIG_64BIT | ||
| 30 | u16 src, dst; | ||
| 31 | #endif | ||
| 29 | }; | 32 | }; |
| 30 | }; | 33 | }; |
| 31 | smp_call_func_t func; | 34 | smp_call_func_t func; |
| @@ -61,6 +61,9 @@ struct __call_single_node { · 60 unmodified lines | |||
| 61 | unsigned int u_flags; | 61 | unsigned int u_flags; |
| 62 | atomic_t a_flags; | 62 | atomic_t a_flags; |
| 63 | }; | 63 | }; |
| 64 | #ifdef CONFIG_64BIT | ||
| 65 | u16 src, dst; | ||
| 66 | #endif | ||
| 64 | }; | 67 | }; |
| 65 | 68 | ||
| 66 | #endif /* __LINUX_SMP_TYPES_H */ | 69 | #endif /* __LINUX_SMP_TYPES_H */ |
| @@ -375,6 +375,9 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info, · 374 unmodified lines | |||
| 375 | 375 | ||
| 376 | csd->func = func; | 376 | csd->func = func; |
| 377 | csd->info = info; | 377 | csd->info = info; |
| 378 | #ifdef CONFIG_64BIT | ||
| 379 | csd->dst = cpu; | ||
| 380 | #endif | ||
| 378 | 381 | ||
| 379 | err = generic_exec_single(cpu, csd); | 382 | err = generic_exec_single(cpu, csd); |
| 380 | 383 | ||
| @@ -540,6 +543,9 @@ static void smp_call_function_many_cond(const struct cpumask *mask, · 159 unmodified lines | |||
| 540 | csd->flags |= CSD_TYPE_SYNC; | 543 | csd->flags |= CSD_TYPE_SYNC; |
| 541 | csd->func = func; | 544 | csd->func = func; |
| 542 | csd->info = info; | 545 | csd->info = info; |
| 546 | #ifdef CONFIG_64BIT | ||
| 547 | csd->dst = cpu; | ||
| 548 | #endif | ||
| 543 | if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) | 549 | if (llist_add(&csd->llist, &per_cpu(call_single_queue, cpu))) |
| 544 | __cpumask_set_cpu(cpu, cfd->cpumask_ipi); | 550 | __cpumask_set_cpu(cpu, cfd->cpumask_ipi); |
| 545 | } | 551 | } |