linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Bu, Yitian" <ybu@qti.qualcomm.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>,
	"a.p.zijlstra@chello.nl" <a.p.zijlstra@chello.nl>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mingo@kernel.org" <mingo@kernel.org>
Subject: [PATCH] Fix rq->lock vs logbuf_lock unlock race
Date: Mon, 18 Feb 2013 12:53:37 +0000	[thread overview]
Message-ID: <E807E903FE6CBE4D95E420FBFCC273B827413C@nasanexd01h.na.qualcomm.com> (raw)

This patch is for kernel V3.7.9

>From 8796f4a2175a323aaa49ea8dd0fe68678dd5dccd Mon Sep 17 00:00:00 2001
From: ybu <ybu@qti.qualcomm.com>
Date: Mon, 18 Feb 2013 19:52:01 +0800
Subject: [PATCH] Fix rq->lock vs logbuf_lock unlock race

fix up the fallout from commit 07354eb1a74d1 ("locking printk:
Annotate logbuf_lock as raw")
Release console_sem after unlocking the logbuf_lock avoids some lock
inversion troubles between logbuf_lock and rq->lock.

Change-Id: I782c1d16e0e82bd156699f0f205f19781c4819e0
Signed-off-by: ybu <ybu@qti.qualcomm.com>
---
 kernel/printk.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index f8e0b5a..3a49454 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1356,9 +1356,9 @@ static int console_trylock_for_printk(unsigned int cpu)
 		}
 	}
 	logbuf_cpu = UINT_MAX;
+	raw_spin_unlock(&logbuf_lock);
 	if (wake)
 		up(&console_sem);
-	raw_spin_unlock(&logbuf_lock);
 	return retval;
 }
 
-- 
1.7.9.5


             reply	other threads:[~2013-02-18 12:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18 12:53 Bu, Yitian [this message]
2013-02-18 14:17 ` [tip:core/printk] printk: Fix rq-> lock vs logbuf_lock unlock lock inversion tip-bot for Bu, Yitian
2013-02-20  8:45 ` [PATCH] Fix rq->lock vs logbuf_lock unlock race Peter Zijlstra
2013-02-20  9:38   ` Bu, Yitian
2013-02-20 10:19     ` Peter Zijlstra
2013-02-20 11:24       ` Bu, Yitian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E807E903FE6CBE4D95E420FBFCC273B827413C@nasanexd01h.na.qualcomm.com \
    --to=ybu@qti.qualcomm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).