[RFC PATCH 4/7] clockevent unbind: use smp_call_func_single_fail

Marcelo Tosatti posted 7 patches 3 years, 6 months ago
There is a newer version of this series
[RFC PATCH 4/7] clockevent unbind: use smp_call_func_single_fail
Posted by Marcelo Tosatti 3 years, 6 months ago
Convert clockevents_unbind from smp_call_function_single
to smp_call_func_single_fail, which will fail in case
the target CPU is tagged as block interference CPU.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: linux-2.6/kernel/time/clockevents.c
===================================================================
--- linux-2.6.orig/kernel/time/clockevents.c
+++ linux-2.6/kernel/time/clockevents.c
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/smp.h>
 #include <linux/device.h>
+#include <linux/sched/isolation.h>
 
 #include "tick-internal.h"
 
@@ -416,9 +417,14 @@ static void __clockevents_unbind(void *a
  */
 static int clockevents_unbind(struct clock_event_device *ced, int cpu)
 {
+	int ret;
 	struct ce_unbind cu = { .ce = ced, .res = -ENODEV };
 
-	smp_call_function_single(cpu, __clockevents_unbind, &cu, 1);
+	block_interf_read_lock();
+	ret = smp_call_func_single_fail(cpu, __clockevents_unbind, &cu, 1);
+	block_interf_read_unlock();
+	if (ret)
+		return ret;
 	return cu.res;
 }