hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
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,13 +23,13 @@
2223 * Kernel threads bound to a single CPU can safely use
2324 * smp_processor_id():
2425 */
25
-#if defined(CONFIG_PREEMPT_RT_BASE) && (defined(CONFIG_SMP) || defined(CONFIG_SCHED_DEBUG))
26
- if (current->migrate_disable)
27
- goto out;
28
-#endif
29
-
3026 if (current->nr_cpus_allowed == 1)
3127 goto out;
28
+
29
+#ifdef CONFIG_SMP
30
+ if (current->migration_disabled)
31
+ goto out;
32
+#endif
3233
3334 /*
3435 * It is valid to assume CPU-locality during early bootup:
....@@ -41,6 +42,7 @@
4142 */
4243 preempt_disable_notrace();
4344
45
+ instrumentation_begin();
4446 if (!printk_ratelimit())
4547 goto out_enable;
4648
....@@ -51,18 +53,19 @@
5153 dump_stack();
5254
5355 out_enable:
56
+ instrumentation_end();
5457 preempt_enable_no_resched_notrace();
5558 out:
5659 return this_cpu;
5760 }
5861
59
-notrace unsigned int debug_smp_processor_id(void)
62
+noinstr unsigned int debug_smp_processor_id(void)
6063 {
6164 return check_preemption_disabled("smp_processor_id", "");
6265 }
6366 EXPORT_SYMBOL(debug_smp_processor_id);
6467
65
-notrace void __this_cpu_preempt_check(const char *op)
68
+noinstr void __this_cpu_preempt_check(const char *op)
6669 {
6770 check_preemption_disabled("__this_cpu_", op);
6871 }