]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0076-relay-Fix-timer-madness.patch
Fix memguard and related syscalls
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0076-relay-Fix-timer-madness.patch
1 From 15bdf68bea3b376dc7700b6c4a468fff40405a6b Mon Sep 17 00:00:00 2001
2 From: Ingo Molnar <mingo@elte.hu>
3 Date: Fri, 3 Jul 2009 08:44:07 -0500
4 Subject: [PATCH 076/366] relay: Fix timer madness
5
6 remove timer calls (!!!) from deep within the tracing infrastructure.
7 This was totally bogus code that can cause lockups and worse.  Poll
8 the buffer every 2 jiffies for now.
9
10 Signed-off-by: Ingo Molnar <mingo@elte.hu>
11 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
12 ---
13  kernel/relay.c | 14 +++++---------
14  1 file changed, 5 insertions(+), 9 deletions(-)
15
16 diff --git a/kernel/relay.c b/kernel/relay.c
17 index 0b4570c..60684be 100644
18 --- a/kernel/relay.c
19 +++ b/kernel/relay.c
20 @@ -336,6 +336,10 @@ static void wakeup_readers(unsigned long data)
21  {
22         struct rchan_buf *buf = (struct rchan_buf *)data;
23         wake_up_interruptible(&buf->read_wait);
24 +       /*
25 +        * Stupid polling for now:
26 +        */
27 +       mod_timer(&buf->timer, jiffies + 1);
28  }
29  
30  /**
31 @@ -353,6 +357,7 @@ static void __relay_reset(struct rchan_buf *buf, unsigned int init)
32                 init_waitqueue_head(&buf->read_wait);
33                 kref_init(&buf->kref);
34                 setup_timer(&buf->timer, wakeup_readers, (unsigned long)buf);
35 +               mod_timer(&buf->timer, jiffies + 1);
36         } else
37                 del_timer_sync(&buf->timer);
38  
39 @@ -736,15 +741,6 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length)
40                 else
41                         buf->early_bytes += buf->chan->subbuf_size -
42                                             buf->padding[old_subbuf];
43 -               smp_mb();
44 -               if (waitqueue_active(&buf->read_wait))
45 -                       /*
46 -                        * Calling wake_up_interruptible() from here
47 -                        * will deadlock if we happen to be logging
48 -                        * from the scheduler (trying to re-grab
49 -                        * rq->lock), so defer it.
50 -                        */
51 -                       mod_timer(&buf->timer, jiffies + 1);
52         }
53  
54         old = buf->data;
55 -- 
56 1.9.1
57