hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/lib/smp_processor_id.c
....@@ -5,10 +5,11 @@
55 * DEBUG_PREEMPT variant of smp_processor_id().
66 */
77 #include <linux/export.h>
8
+#include <linux/kprobes.h>
89 #include <linux/sched.h>
910
10
-notrace static unsigned int check_preemption_disabled(const char *what1,
11
- const char *what2)
11
+noinstr static
12
+unsigned int check_preemption_disabled(const char *what1, const char *what2)
1213 {
1314 int this_cpu = raw_smp_processor_id();
1415
....@@ -22,7 +23,7 @@
2223 * Kernel threads bound to a single CPU can safely use
2324 * smp_processor_id():
2425 */
25
- if (cpumask_equal(&current->cpus_allowed, cpumask_of(this_cpu)))
26
+ if (current->nr_cpus_allowed == 1)
2627 goto out;
2728
2829 /*
....@@ -36,6 +37,7 @@
3637 */
3738 preempt_disable_notrace();
3839
40
+ instrumentation_begin();
3941 if (!printk_ratelimit())
4042 goto out_enable;
4143
....@@ -46,18 +48,19 @@
4648 dump_stack();
4749
4850 out_enable:
51
+ instrumentation_end();
4952 preempt_enable_no_resched_notrace();
5053 out:
5154 return this_cpu;
5255 }
5356
54
-notrace unsigned int debug_smp_processor_id(void)
57
+noinstr unsigned int debug_smp_processor_id(void)
5558 {
5659 return check_preemption_disabled("smp_processor_id", "");
5760 }
5861 EXPORT_SYMBOL(debug_smp_processor_id);
5962
60
-notrace void __this_cpu_preempt_check(const char *op)
63
+noinstr void __this_cpu_preempt_check(const char *op)
6164 {
6265 check_preemption_disabled("__this_cpu_", op);
6366 }