From c232299695715aee05d7084aaeb15a81be84bdef Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Tue, 10 May 2022 22:41:24 -0700 Subject: [PATCH] smp: Make generic_exec_single() public generic_exec_single() is quite handy for sending asynchronous IPIs without the baggage that comes with smp_call_function_single_async(). Make it public so that it can be (carefully) utilized. Signed-off-by: Sultan Alsawaf Signed-off-by: Kazuki Hashimoto --- include/linux/smp.h | 2 ++ kernel/smp.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/smp.h b/include/linux/smp.h index e21278d66a4b..b0de11140ee3 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -101,6 +101,8 @@ extern void smp_cpus_done(unsigned int max_cpus); /* * Call a function on all other processors */ +int generic_exec_single(int cpu, struct __call_single_data *csd, + smp_call_func_t func, void *info); void smp_call_function(smp_call_func_t func, void *info, int wait); void smp_call_function_many(const struct cpumask *mask, smp_call_func_t func, void *info, bool wait); diff --git a/kernel/smp.c b/kernel/smp.c index 767a156b1bd2..67d671709b9e 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -128,7 +128,8 @@ static __always_inline void csd_lock(call_single_data_t *csd) static __always_inline void csd_unlock(call_single_data_t *csd) { - WARN_ON(!(csd->flags & CSD_FLAG_LOCK)); + if (!(csd->flags & CSD_FLAG_LOCK)) + return; /* * ensure we're all done before releasing data: @@ -145,7 +146,7 @@ extern void send_call_function_single_ipi(int cpu); * for execution on the given CPU. data must already have * ->func, ->info, and ->flags set. */ -static int generic_exec_single(int cpu, call_single_data_t *csd, +int generic_exec_single(int cpu, call_single_data_t *csd, smp_call_func_t func, void *info) { if (cpu == smp_processor_id()) {