Skip to contentSkip to conversation

relay-fix-timer-madness.patch removed from -mm tree

to-be-updated [email protected] 1 participant 1 message Jul 30, 2013 Relay

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: [to-be-updated] relay-fix-timer-madness.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 30 Jul 2013 15:43:59 -0700

The patch titled
Subject: relay: fix timer madness
has been removed from the -mm tree. Its filename was
relay-fix-timer-madness.patch

This patch was dropped because an updated version will be merged

------------------------------------------------------
From: Ingo Molnar <[email protected]>
Subject: relay: fix timer madness

When I'm using below ktap script to trace all event tracepoints, without this patch, the system will hang in few seconds, the patch indeed fix the problem as the changelog pointed.

	function eventfun (e) {
        	printf("%d %d\t%s\t%s", cpu(), pid(), execname(), e.annotate)
	}

	kdebug.probe("tp:", eventfun)

	kdebug.probe_end(function () {
        	printf("probe end\n")
	})

This patch is old, I can found the original patch discussion in 2007.
http://marc.info/?l=linux-kernel&m=118544794717162&w=2 (In that mail thread, the patch didn't fix that problem, but it fix the problem I encountered now)

Ingo's original changelog:

Remove timer calls (!!!) from deep within the tracing infrastructure. This was totally bogus code that can cause lockups and worse. Poll the buffer every 2 jiffies for now.

---

 kernel/relay.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
kernel/relay.c renamed from kernel/relay.c~relay-fix-timer-madness +5 -9
diff -puN kernel/relay.c~relay-fix-timer-madness kernel/relay.c
@@ -339,6 +339,10 @@ static void wakeup_readers(unsigned long
 {
 	struct rchan_buf *buf = (struct rchan_buf *)data;
 	wake_up_interruptible(&buf->read_wait);
+	/*
+	 * Stupid polling for now:
+	 */
+	mod_timer(&buf->timer, jiffies + 1);
 }
 
 /**
@@ -356,6 +360,7 @@ static void __relay_reset(struct rchan_b
 		init_waitqueue_head(&buf->read_wait);
 		kref_init(&buf->kref);
 		setup_timer(&buf->timer, wakeup_readers, (unsigned long)buf);
+		mod_timer(&buf->timer, jiffies + 1);
 	} else
 		del_timer_sync(&buf->timer);
 
@@ -739,15 +744,6 @@ size_t relay_switch_subbuf(struct rchan_
 		else
 			buf->early_bytes += buf->chan->subbuf_size -
 					    buf->padding[old_subbuf];
-		smp_mb();
-		if (waitqueue_active(&buf->read_wait))
-			/*
-			 * Calling wake_up_interruptible() from here
-			 * will deadlock if we happen to be logging
-			 * from the scheduler (trying to re-grab
-			 * rq->lock), so defer it.
-			 */
-			mod_timer(&buf->timer, jiffies + 1);
 	}
 
 	old = buf->data;

_

Patches currently in -mm which might be from [email protected] are

include-linux-schedh-dont-use-task-pid-tgid-in-same_thread_group-has_group_leader_pid.patch watchdog-trigger-all-cpu-backtrace-when-locked-up-and-going-to-panic.patch mm-vmstats-tlb-flush-counters.patch mm-vmstats-track-tlb-flush-stats-on-up-too.patch mm-hotplug-x86-disable-arch_memory_probe-by-default.patch kernel-spinlockc-add-default-arch__relax-definitions-for-generic_lockbreak.patch smp-give-warning-when-calling-smp_call_function_many-single-in-serving-irq.patch relay-fix-timer-madness-v2.patch
linux-next.patch
debugging-keep-track-of-page-owners.patch debugging-keep-track-of-page-owners-fix.patch make-frame_pointer-default=y.patch
mutex-subsystem-synchro-test-module.patch