| .. | .. |
|---|
| 5 | 5 | * DEBUG_PREEMPT variant of smp_processor_id(). |
|---|
| 6 | 6 | */ |
|---|
| 7 | 7 | #include <linux/export.h> |
|---|
| 8 | +#include <linux/kprobes.h> |
|---|
| 8 | 9 | #include <linux/sched.h> |
|---|
| 9 | 10 | |
|---|
| 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) |
|---|
| 12 | 13 | { |
|---|
| 13 | 14 | int this_cpu = raw_smp_processor_id(); |
|---|
| 14 | 15 | |
|---|
| .. | .. |
|---|
| 22 | 23 | * Kernel threads bound to a single CPU can safely use |
|---|
| 23 | 24 | * smp_processor_id(): |
|---|
| 24 | 25 | */ |
|---|
| 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 | | - |
|---|
| 30 | 26 | if (current->nr_cpus_allowed == 1) |
|---|
| 31 | 27 | goto out; |
|---|
| 28 | + |
|---|
| 29 | +#ifdef CONFIG_SMP |
|---|
| 30 | + if (current->migration_disabled) |
|---|
| 31 | + goto out; |
|---|
| 32 | +#endif |
|---|
| 32 | 33 | |
|---|
| 33 | 34 | /* |
|---|
| 34 | 35 | * It is valid to assume CPU-locality during early bootup: |
|---|
| .. | .. |
|---|
| 41 | 42 | */ |
|---|
| 42 | 43 | preempt_disable_notrace(); |
|---|
| 43 | 44 | |
|---|
| 45 | + instrumentation_begin(); |
|---|
| 44 | 46 | if (!printk_ratelimit()) |
|---|
| 45 | 47 | goto out_enable; |
|---|
| 46 | 48 | |
|---|
| .. | .. |
|---|
| 51 | 53 | dump_stack(); |
|---|
| 52 | 54 | |
|---|
| 53 | 55 | out_enable: |
|---|
| 56 | + instrumentation_end(); |
|---|
| 54 | 57 | preempt_enable_no_resched_notrace(); |
|---|
| 55 | 58 | out: |
|---|
| 56 | 59 | return this_cpu; |
|---|
| 57 | 60 | } |
|---|
| 58 | 61 | |
|---|
| 59 | | -notrace unsigned int debug_smp_processor_id(void) |
|---|
| 62 | +noinstr unsigned int debug_smp_processor_id(void) |
|---|
| 60 | 63 | { |
|---|
| 61 | 64 | return check_preemption_disabled("smp_processor_id", ""); |
|---|
| 62 | 65 | } |
|---|
| 63 | 66 | EXPORT_SYMBOL(debug_smp_processor_id); |
|---|
| 64 | 67 | |
|---|
| 65 | | -notrace void __this_cpu_preempt_check(const char *op) |
|---|
| 68 | +noinstr void __this_cpu_preempt_check(const char *op) |
|---|
| 66 | 69 | { |
|---|
| 67 | 70 | check_preemption_disabled("__this_cpu_", op); |
|---|
| 68 | 71 | } |
|---|