| .. | .. |
|---|
| 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 (cpumask_equal(¤t->cpus_allowed, cpumask_of(this_cpu))) |
|---|
| 26 | + if (current->nr_cpus_allowed == 1) |
|---|
| 26 | 27 | goto out; |
|---|
| 27 | 28 | |
|---|
| 28 | 29 | /* |
|---|
| .. | .. |
|---|
| 36 | 37 | */ |
|---|
| 37 | 38 | preempt_disable_notrace(); |
|---|
| 38 | 39 | |
|---|
| 40 | + instrumentation_begin(); |
|---|
| 39 | 41 | if (!printk_ratelimit()) |
|---|
| 40 | 42 | goto out_enable; |
|---|
| 41 | 43 | |
|---|
| .. | .. |
|---|
| 46 | 48 | dump_stack(); |
|---|
| 47 | 49 | |
|---|
| 48 | 50 | out_enable: |
|---|
| 51 | + instrumentation_end(); |
|---|
| 49 | 52 | preempt_enable_no_resched_notrace(); |
|---|
| 50 | 53 | out: |
|---|
| 51 | 54 | return this_cpu; |
|---|
| 52 | 55 | } |
|---|
| 53 | 56 | |
|---|
| 54 | | -notrace unsigned int debug_smp_processor_id(void) |
|---|
| 57 | +noinstr unsigned int debug_smp_processor_id(void) |
|---|
| 55 | 58 | { |
|---|
| 56 | 59 | return check_preemption_disabled("smp_processor_id", ""); |
|---|
| 57 | 60 | } |
|---|
| 58 | 61 | EXPORT_SYMBOL(debug_smp_processor_id); |
|---|
| 59 | 62 | |
|---|
| 60 | | -notrace void __this_cpu_preempt_check(const char *op) |
|---|
| 63 | +noinstr void __this_cpu_preempt_check(const char *op) |
|---|
| 61 | 64 | { |
|---|
| 62 | 65 | check_preemption_disabled("__this_cpu_", op); |
|---|
| 63 | 66 | } |
|---|