diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_sched_wakeup.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 3c8d61df4474..e303ccb62cdf 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
@@ -26,7 +26,8 @@ static struct task_struct *wakeup_task; | |||
26 | static int wakeup_cpu; | 26 | static int wakeup_cpu; |
27 | static unsigned wakeup_prio = -1; | 27 | static unsigned wakeup_prio = -1; |
28 | 28 | ||
29 | static DEFINE_SPINLOCK(wakeup_lock); | 29 | static raw_spinlock_t wakeup_lock = |
30 | (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; | ||
30 | 31 | ||
31 | static void __wakeup_reset(struct trace_array *tr); | 32 | static void __wakeup_reset(struct trace_array *tr); |
32 | 33 | ||
@@ -56,7 +57,8 @@ wakeup_tracer_call(unsigned long ip, unsigned long parent_ip) | |||
56 | if (unlikely(disabled != 1)) | 57 | if (unlikely(disabled != 1)) |
57 | goto out; | 58 | goto out; |
58 | 59 | ||
59 | spin_lock_irqsave(&wakeup_lock, flags); | 60 | local_irq_save(flags); |
61 | __raw_spin_lock(&wakeup_lock); | ||
60 | 62 | ||
61 | if (unlikely(!wakeup_task)) | 63 | if (unlikely(!wakeup_task)) |
62 | goto unlock; | 64 | goto unlock; |
@@ -71,7 +73,8 @@ wakeup_tracer_call(unsigned long ip, unsigned long parent_ip) | |||
71 | trace_function(tr, data, ip, parent_ip, flags); | 73 | trace_function(tr, data, ip, parent_ip, flags); |
72 | 74 | ||
73 | unlock: | 75 | unlock: |
74 | spin_unlock_irqrestore(&wakeup_lock, flags); | 76 | __raw_spin_unlock(&wakeup_lock); |
77 | local_irq_restore(flags); | ||
75 | 78 | ||
76 | out: | 79 | out: |
77 | atomic_dec(&data->disabled); | 80 | atomic_dec(&data->disabled); |
@@ -145,7 +148,8 @@ wakeup_sched_switch(void *private, void *rq, struct task_struct *prev, | |||
145 | if (likely(disabled != 1)) | 148 | if (likely(disabled != 1)) |
146 | goto out; | 149 | goto out; |
147 | 150 | ||
148 | spin_lock_irqsave(&wakeup_lock, flags); | 151 | local_irq_save(flags); |
152 | __raw_spin_lock(&wakeup_lock); | ||
149 | 153 | ||
150 | /* We could race with grabbing wakeup_lock */ | 154 | /* We could race with grabbing wakeup_lock */ |
151 | if (unlikely(!tracer_enabled || next != wakeup_task)) | 155 | if (unlikely(!tracer_enabled || next != wakeup_task)) |
@@ -174,7 +178,8 @@ wakeup_sched_switch(void *private, void *rq, struct task_struct *prev, | |||
174 | 178 | ||
175 | out_unlock: | 179 | out_unlock: |
176 | __wakeup_reset(tr); | 180 | __wakeup_reset(tr); |
177 | spin_unlock_irqrestore(&wakeup_lock, flags); | 181 | __raw_spin_unlock(&wakeup_lock); |
182 | local_irq_restore(flags); | ||
178 | out: | 183 | out: |
179 | atomic_dec(&tr->data[cpu]->disabled); | 184 | atomic_dec(&tr->data[cpu]->disabled); |
180 | } | 185 | } |
@@ -209,8 +214,6 @@ static void __wakeup_reset(struct trace_array *tr) | |||
209 | struct trace_array_cpu *data; | 214 | struct trace_array_cpu *data; |
210 | int cpu; | 215 | int cpu; |
211 | 216 | ||
212 | assert_spin_locked(&wakeup_lock); | ||
213 | |||
214 | for_each_possible_cpu(cpu) { | 217 | for_each_possible_cpu(cpu) { |
215 | data = tr->data[cpu]; | 218 | data = tr->data[cpu]; |
216 | tracing_reset(data); | 219 | tracing_reset(data); |
@@ -229,9 +232,11 @@ static void wakeup_reset(struct trace_array *tr) | |||
229 | { | 232 | { |
230 | unsigned long flags; | 233 | unsigned long flags; |
231 | 234 | ||
232 | spin_lock_irqsave(&wakeup_lock, flags); | 235 | local_irq_save(flags); |
236 | __raw_spin_lock(&wakeup_lock); | ||
233 | __wakeup_reset(tr); | 237 | __wakeup_reset(tr); |
234 | spin_unlock_irqrestore(&wakeup_lock, flags); | 238 | __raw_spin_unlock(&wakeup_lock); |
239 | local_irq_restore(flags); | ||
235 | } | 240 | } |
236 | 241 | ||
237 | static void | 242 | static void |
@@ -252,7 +257,7 @@ wakeup_check_start(struct trace_array *tr, struct task_struct *p, | |||
252 | goto out; | 257 | goto out; |
253 | 258 | ||
254 | /* interrupts should be off from try_to_wake_up */ | 259 | /* interrupts should be off from try_to_wake_up */ |
255 | spin_lock(&wakeup_lock); | 260 | __raw_spin_lock(&wakeup_lock); |
256 | 261 | ||
257 | /* check for races. */ | 262 | /* check for races. */ |
258 | if (!tracer_enabled || p->prio >= wakeup_prio) | 263 | if (!tracer_enabled || p->prio >= wakeup_prio) |
@@ -274,7 +279,7 @@ wakeup_check_start(struct trace_array *tr, struct task_struct *p, | |||
274 | CALLER_ADDR1, CALLER_ADDR2, flags); | 279 | CALLER_ADDR1, CALLER_ADDR2, flags); |
275 | 280 | ||
276 | out_locked: | 281 | out_locked: |
277 | spin_unlock(&wakeup_lock); | 282 | __raw_spin_unlock(&wakeup_lock); |
278 | out: | 283 | out: |
279 | atomic_dec(&tr->data[cpu]->disabled); | 284 | atomic_dec(&tr->data[cpu]->disabled); |
280 | } | 285 | } |