]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0233-perf-Make-swevent-hrtimer-run-in-irq-instead-of-soft.patch
Fix memguard and related syscalls
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0233-perf-Make-swevent-hrtimer-run-in-irq-instead-of-soft.patch
1 From 7995eb12475bb2a58fe3ced3ab87bcfd5314ca1c Mon Sep 17 00:00:00 2001
2 From: Yong Zhang <yong.zhang@windriver.com>
3 Date: Wed, 11 Jul 2012 22:05:21 +0000
4 Subject: [PATCH 233/366] perf: Make swevent hrtimer run in irq instead of
5  softirq
6
7 Otherwise we get a deadlock like below:
8
9 [ 1044.042749] BUG: scheduling while atomic: ksoftirqd/21/141/0x00010003
10 [ 1044.042752] INFO: lockdep is turned off.
11 [ 1044.042754] Modules linked in:
12 [ 1044.042757] Pid: 141, comm: ksoftirqd/21 Tainted: G        W    3.4.0-rc2-rt3-23676-ga723175-dirty #29
13 [ 1044.042759] Call Trace:
14 [ 1044.042761]  <IRQ>  [<ffffffff8107d8e5>] __schedule_bug+0x65/0x80
15 [ 1044.042770]  [<ffffffff8168978c>] __schedule+0x83c/0xa70
16 [ 1044.042775]  [<ffffffff8106bdd2>] ? prepare_to_wait+0x32/0xb0
17 [ 1044.042779]  [<ffffffff81689a5e>] schedule+0x2e/0xa0
18 [ 1044.042782]  [<ffffffff81071ebd>] hrtimer_wait_for_timer+0x6d/0xb0
19 [ 1044.042786]  [<ffffffff8106bb30>] ? wake_up_bit+0x40/0x40
20 [ 1044.042790]  [<ffffffff81071f20>] hrtimer_cancel+0x20/0x40
21 [ 1044.042794]  [<ffffffff8111da0c>] perf_swevent_cancel_hrtimer+0x3c/0x50
22 [ 1044.042798]  [<ffffffff8111da31>] task_clock_event_stop+0x11/0x40
23 [ 1044.042802]  [<ffffffff8111da6e>] task_clock_event_del+0xe/0x10
24 [ 1044.042805]  [<ffffffff8111c568>] event_sched_out+0x118/0x1d0
25 [ 1044.042809]  [<ffffffff8111c649>] group_sched_out+0x29/0x90
26 [ 1044.042813]  [<ffffffff8111ed7e>] __perf_event_disable+0x18e/0x200
27 [ 1044.042817]  [<ffffffff8111c343>] remote_function+0x63/0x70
28 [ 1044.042821]  [<ffffffff810b0aae>] generic_smp_call_function_single_interrupt+0xce/0x120
29 [ 1044.042826]  [<ffffffff81022bc7>] smp_call_function_single_interrupt+0x27/0x40
30 [ 1044.042831]  [<ffffffff8168d50c>] call_function_single_interrupt+0x6c/0x80
31 [ 1044.042833]  <EOI>  [<ffffffff811275b0>] ? perf_event_overflow+0x20/0x20
32 [ 1044.042840]  [<ffffffff8168b970>] ? _raw_spin_unlock_irq+0x30/0x70
33 [ 1044.042844]  [<ffffffff8168b976>] ? _raw_spin_unlock_irq+0x36/0x70
34 [ 1044.042848]  [<ffffffff810702e2>] run_hrtimer_softirq+0xc2/0x200
35 [ 1044.042853]  [<ffffffff811275b0>] ? perf_event_overflow+0x20/0x20
36 [ 1044.042857]  [<ffffffff81045265>] __do_softirq_common+0xf5/0x3a0
37 [ 1044.042862]  [<ffffffff81045c3d>] __thread_do_softirq+0x15d/0x200
38 [ 1044.042865]  [<ffffffff81045dda>] run_ksoftirqd+0xfa/0x210
39 [ 1044.042869]  [<ffffffff81045ce0>] ? __thread_do_softirq+0x200/0x200
40 [ 1044.042873]  [<ffffffff81045ce0>] ? __thread_do_softirq+0x200/0x200
41 [ 1044.042877]  [<ffffffff8106b596>] kthread+0xb6/0xc0
42 [ 1044.042881]  [<ffffffff8168b97b>] ? _raw_spin_unlock_irq+0x3b/0x70
43 [ 1044.042886]  [<ffffffff8168d994>] kernel_thread_helper+0x4/0x10
44 [ 1044.042889]  [<ffffffff8107d98c>] ? finish_task_switch+0x8c/0x110
45 [ 1044.042894]  [<ffffffff8168b97b>] ? _raw_spin_unlock_irq+0x3b/0x70
46 [ 1044.042897]  [<ffffffff8168bd5d>] ? retint_restore_args+0xe/0xe
47 [ 1044.042900]  [<ffffffff8106b4e0>] ? kthreadd+0x1e0/0x1e0
48 [ 1044.042902]  [<ffffffff8168d990>] ? gs_change+0xb/0xb
49
50 Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
51 Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
52 Cc: Steven Rostedt <rostedt@goodmis.org>
53 Link: http://lkml.kernel.org/r/1341476476-5666-1-git-send-email-yong.zhang0@gmail.com
54 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
55 Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
56 ---
57  kernel/events/core.c | 1 +
58  1 file changed, 1 insertion(+)
59
60 diff --git a/kernel/events/core.c b/kernel/events/core.c
61 index bc6371b..bbb71da 100644
62 --- a/kernel/events/core.c
63 +++ b/kernel/events/core.c
64 @@ -7240,6 +7240,7 @@ static void perf_swevent_init_hrtimer(struct perf_event *event)
65  
66         hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
67         hwc->hrtimer.function = perf_swevent_hrtimer;
68 +       hwc->hrtimer.irqsafe = 1;
69  
70         /*
71          * Since hrtimers have a fixed rate, we can do a static freq->period
72 -- 
73 1.9.1
74