Arvind M | 8e87d85 | 2018-01-29 00:04:29 -0800 | [diff] [blame] | 1 | From b4529c9b8e7324ca4ad11fdf03da729c37d92f17 Mon Sep 17 00:00:00 2001 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 2 | From: Ingo Molnar <mingo@elte.hu> |
| 3 | Date: Fri, 3 Jul 2009 08:44:07 -0500 |
Arvind M | 10268e7 | 2017-12-04 22:18:06 -0800 | [diff] [blame] | 4 | Subject: [PATCH 076/366] relay: Fix timer madness |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 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> |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 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 |
Ishan Mittal | b799826 | 2017-01-17 16:11:50 +0530 | [diff] [blame] | 17 | index 0b4570c..60684be 100644 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 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 | -- |
Arvind M | 10268e7 | 2017-12-04 22:18:06 -0800 | [diff] [blame] | 56 | 1.9.1 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 57 | |