Control: tag -1 patch moreinfo

On Tue, 2016-10-18 at 11:19 +0200, Lucas Nussbaum wrote:
> Package: src:linux
> Version: 3.16.36-1+deb8u1
> Severity: normal
> 
> Hi,
> 
> When booting, on about 5% of boots, the system hangs for several minutes
> while waiting for systemd-udev-settle to complete. (systemd-udev-settle
> is triggered by lvm2)
[...]
> It happens on various machines, of various models (all Dell, but I'm not sure
> this is relevant as all our recent machines are Dell machines). A hardware
> issue is unlikely.

I've never seen this and I don't recall any similar reports, so I
suspect it may be triggered by particular drivers or configurations. 
Anyway:

> It is fixed in stretch and unstable.
> 
> I bisected it, and found that commit 6f942a1f264e875c5f3ad6f505d7b500a3e7fa82
> fixed it. That commit is:
> 
> commit 6f942a1f264e875c5f3ad6f505d7b500a3e7fa82
> > Author: Peter Zijlstra <pet...@infradead.org>
> Date:   Wed Sep 24 10:18:46 2014 +0200
> 
>     locking/mutex: Don't assume TASK_RUNNING
[...]
> Unfortunately, the code around this was changed after 3.16, making a backport
> non-trivial.
[...]

It seems simple enough... can you try the attached patch?

Ben.

-- 
Ben Hutchings
No political challenge can be met by shopping. - George Monbiot

From: Peter Zijlstra <pet...@infradead.org>
Date: Wed, 24 Sep 2014 10:18:46 +0200
Subject: locking/mutex: Don't assume TASK_RUNNING
Origin: https://git.kernel.org/linus/6f942a1f264e875c5f3ad6f505d7b500a3e7fa82
Bug-Debian: https://bugs.debian.org/841171

We're going to make might_sleep() test for TASK_RUNNING, because
blocking without TASK_RUNNING will destroy the task state by setting
it to TASK_RUNNING.

There are a few occasions where its 'valid' to call blocking
primitives (and mutex_lock in particular) and not have TASK_RUNNING,
typically such cases are right before we set TASK_RUNNING anyhow.

Robustify the code by not assuming this; this has the beneficial side
effect of allowing optional code emission for fixing the above
might_sleep() false positives.

Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org>
Cc: t...@linutronix.de
Cc: ilya.dryo...@inktank.com
Cc: umgwanakikb...@gmail.com
Cc: Oleg Nesterov <o...@redhat.com>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Link: http://lkml.kernel.org/r/20140924082241.988560...@infradead.org
Signed-off-by: Ingo Molnar <mi...@kernel.org>
[bwh: Backported to 3.16: adjust context]
---
 kernel/locking/mutex.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -480,8 +480,14 @@ static bool mutex_optimistic_spin(struct mutex *lock,
 	 * reschedule now, before we try-lock the mutex. This avoids getting
 	 * scheduled out right after we obtained the mutex.
 	 */
-	if (need_resched())
+	if (need_resched()) {
+		/*
+		 * We _should_ have TASK_RUNNING here, but just in case
+		 * we do not, make it so, otherwise we might get stuck.
+		 */
+		__set_current_state(TASK_RUNNING);
 		schedule_preempt_disabled();
+	}
 #endif
 	spin_lock_mutex(&lock->wait_lock, flags);
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to