On Tue, 26 May 2020 18:11:04 +0200, Peter Zijlstra said: > The recent commit: 90b5363acd47 ("sched: Clean up scheduler_ipi()") > got smp_call_function_single_async() subtly wrong. Even though it will > return -EBUSY when trying to re-use a csd, that condition is not > atomic and still requires external serialization. > kernel/smp.c | 47 ++++++++++++++++++++++++++++++++++++++++------- > --- a/kernel/smp.c > +++ b/kernel/smp.c > @@ -659,6 +685,13 @@ void __init smp_init(void) > BUILD_BUG_ON(offsetof(struct irq_work, flags) != > offsetof(struct __call_single_data, flags)); > > + /* > + * Assert the CSD_TYPE_TTWU layout is similar enough > + * for task_struct to be on the @call_single_queue. > + */ > + BUILD_BUG_ON(offsetof(struct task_struct, wake_entry_type) - offsetof(struct task_struct, wake_entry) != > + offsetof(struct __call_single_data, flags) - offsetof(struct __call_single_data, llist)); > + > idle_threads_init(); > cpuhp_threads_init(); This blows up on a 32-bit ARM allmodconfig: CC kernel/smp.o kernel/smp.c:319:6: warning: no previous prototype for 'flush_smp_call_function_from_idle' [-Wmissing-prototypes] void flush_smp_call_function_from_idle(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ./arch/arm/include/asm/atomic.h:11, from ./include/linux/atomic.h:7, from ./include/linux/llist.h:51, from ./include/linux/irq_work.h:5, from kernel/smp.c:10: kernel/smp.c: In function 'smp_init': ./include/linux/compiler.h:392:38: error: call to '__compiletime_assert_152' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct task_struct, wake_entry_type) - offsetof(struct task_struct, wake_entry) != offsetof(struct __call_single_data, flags) - offsetof(struct __call_single_data, llist) _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ ./include/linux/compiler.h:373:4: note: in definition of macro '__compiletime_assert' prefix ## suffix(); \ ^~~~~~ ./include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:50:2: note: in expansion of macro 'BUILD_BUG_ON_MSG' BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) ^~~~~~~~~~~~~~~~ kernel/smp.c:689:2: note: in expansion of macro 'BUILD_BUG_ON' BUILD_BUG_ON(offsetof(struct task_struct, wake_entry_type) - offsetof(struct task_struct, wake_entry) != ^~~~~~~~~~~~