public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Davidlohr Bueso <dave@gnu.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mce: fix RCU lockdep from mce_log()
Date: Sun, 7 Nov 2010 05:39:50 -0800	[thread overview]
Message-ID: <20101107133950.GV15561@linux.vnet.ibm.com> (raw)
In-Reply-To: <20101106185350.GA23824@basil.fritz.box>

On Sat, Nov 06, 2010 at 07:53:50PM +0100, Andi Kleen wrote:
> On Fri, Nov 05, 2010 at 06:44:59PM -0300, Davidlohr Bueso wrote:
> > Hi,
> > 
> > Please review this patch, I am not very familiar with MCE/RCU so I'm not sure that this is the correct fix (otherwise consider it a bug report :)).
> > This does "fix" the message though and I can use MCE normally.
> 
> The patch is certainly not correct. The variable needs to be read
> independently of the mutex.

This code is simply checking the value of the pointer, and therefore
need not protect any actual dereferences.  So why not replace the
rcu_dereference_check_mce() with rcu_access_pointer()?  If this is
OK, please see the patch below.

BTW, assigning the value returned by rcu_access_pointer() into a
variable often indicates a bug.  ;-)

							Thanx, Paul

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 7a35b72..4d29d50 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1625,7 +1625,7 @@ out:
 static unsigned int mce_poll(struct file *file, poll_table *wait)
 {
 	poll_wait(file, &mce_wait, wait);
-	if (rcu_dereference_check_mce(mcelog.next))
+	if (rcu_access_pointer(mcelog.next))
 		return POLLIN | POLLRDNORM;
 	if (!mce_apei_read_done && apei_check_mce())
 		return POLLIN | POLLRDNORM;

  reply	other threads:[~2010-11-07 13:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-05 21:44 [PATCH] mce: fix RCU lockdep from mce_log() Davidlohr Bueso
2010-11-05 21:48 ` Davidlohr Bueso
2010-11-06 18:53 ` Andi Kleen
2010-11-07 13:39   ` Paul E. McKenney [this message]
2010-11-08 11:30     ` Davidlohr Bueso
2010-11-08 13:17       ` Paul E. McKenney
2010-11-10 13:44         ` [PATCH] mce: fix RCU lockdep from mce_poll() Davidlohr Bueso
2011-03-29  9:45         ` [PATCH] mce: fix RCU lockdep from mce_log() Zdenek Kabelac
2011-03-31  1:14           ` Davidlohr Bueso
2011-03-31  1:37             ` Andi Kleen
2011-03-31  2:13               ` [PATCH] mce: fix RCU lockdep from mce_poll() Davidlohr Bueso
2011-03-31  9:30                 ` [tip:x86/urgent] x86, mce: Fix " tip-bot for Davidlohr Bueso
2011-03-31 10:03                   ` Zdenek Kabelac
2011-03-31 16:41                     ` Paul E. McKenney
2011-03-31 21:32                       ` Zdenek Kabelac
2011-03-31 22:50                         ` Paul E. McKenney

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=20101107133950.GV15561@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=andi@firstfloor.org \
    --cc=dave@gnu.org \
    --cc=linux-kernel@vger.kernel.org \
    /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