blob: 404348e2c5f698f93a112e269d679b88883f53ae [file] [log] [blame]
Arvind M8e87d852018-01-29 00:04:29 -08001From b4529c9b8e7324ca4ad11fdf03da729c37d92f17 Mon Sep 17 00:00:00 2001
Allen Martin685e0f82016-07-26 19:34:29 -07002From: Ingo Molnar <mingo@elte.hu>
3Date: Fri, 3 Jul 2009 08:44:07 -0500
Arvind M10268e72017-12-04 22:18:06 -08004Subject: [PATCH 076/366] relay: Fix timer madness
Allen Martin685e0f82016-07-26 19:34:29 -07005
6remove timer calls (!!!) from deep within the tracing infrastructure.
7This was totally bogus code that can cause lockups and worse. Poll
8the buffer every 2 jiffies for now.
9
10Signed-off-by: Ingo Molnar <mingo@elte.hu>
11Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Allen Martin685e0f82016-07-26 19:34:29 -070012---
13 kernel/relay.c | 14 +++++---------
14 1 file changed, 5 insertions(+), 9 deletions(-)
15
16diff --git a/kernel/relay.c b/kernel/relay.c
Ishan Mittalb7998262017-01-17 16:11:50 +053017index 0b4570c..60684be 100644
Allen Martin685e0f82016-07-26 19:34:29 -070018--- 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--
Arvind M10268e72017-12-04 22:18:06 -0800561.9.1
Allen Martin685e0f82016-07-26 19:34:29 -070057