diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-03-05 18:03:27 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-11 07:38:02 -0500 |
commit | f56e8a0765cc4374e02f4e3a79e2427b5096b075 (patch) | |
tree | 2139fc459bfe2d7d72843d4fa0fa946f0cd33cd4 /arch/x86/kernel | |
parent | 007b09243b099811124f69d492adeebe9e439f96 (diff) |
x86/mce: Fix RCU lockdep splats
Create an rcu_dereference_check_mce() that checks for RCU-sched
read side and mce_read_mutex being held on update side. Replace
uses of rcu_dereference() in arch/x86/kernel/cpu/mcheck/mce.c
with this new macro.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
LKML-Reference: <1267830207-9474-3-git-send-email-paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index a8aacd4b513c..4442e9e898c2 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -46,6 +46,11 @@ | |||
46 | 46 | ||
47 | #include "mce-internal.h" | 47 | #include "mce-internal.h" |
48 | 48 | ||
49 | #define rcu_dereference_check_mce(p) \ | ||
50 | rcu_dereference_check((p), \ | ||
51 | rcu_read_lock_sched_held() || \ | ||
52 | lockdep_is_held(&mce_read_mutex)) | ||
53 | |||
49 | #define CREATE_TRACE_POINTS | 54 | #define CREATE_TRACE_POINTS |
50 | #include <trace/events/mce.h> | 55 | #include <trace/events/mce.h> |
51 | 56 | ||
@@ -158,7 +163,7 @@ void mce_log(struct mce *mce) | |||
158 | mce->finished = 0; | 163 | mce->finished = 0; |
159 | wmb(); | 164 | wmb(); |
160 | for (;;) { | 165 | for (;;) { |
161 | entry = rcu_dereference(mcelog.next); | 166 | entry = rcu_dereference_check_mce(mcelog.next); |
162 | for (;;) { | 167 | for (;;) { |
163 | /* | 168 | /* |
164 | * When the buffer fills up discard new entries. | 169 | * When the buffer fills up discard new entries. |
@@ -1500,7 +1505,7 @@ static ssize_t mce_read(struct file *filp, char __user *ubuf, size_t usize, | |||
1500 | return -ENOMEM; | 1505 | return -ENOMEM; |
1501 | 1506 | ||
1502 | mutex_lock(&mce_read_mutex); | 1507 | mutex_lock(&mce_read_mutex); |
1503 | next = rcu_dereference(mcelog.next); | 1508 | next = rcu_dereference_check_mce(mcelog.next); |
1504 | 1509 | ||
1505 | /* Only supports full reads right now */ | 1510 | /* Only supports full reads right now */ |
1506 | if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce)) { | 1511 | if (*off != 0 || usize < MCE_LOG_LEN*sizeof(struct mce)) { |
@@ -1565,7 +1570,7 @@ timeout: | |||
1565 | static unsigned int mce_poll(struct file *file, poll_table *wait) | 1570 | static unsigned int mce_poll(struct file *file, poll_table *wait) |
1566 | { | 1571 | { |
1567 | poll_wait(file, &mce_wait, wait); | 1572 | poll_wait(file, &mce_wait, wait); |
1568 | if (rcu_dereference(mcelog.next)) | 1573 | if (rcu_dereference_check_mce(mcelog.next)) |
1569 | return POLLIN | POLLRDNORM; | 1574 | return POLLIN | POLLRDNORM; |
1570 | return 0; | 1575 | return 0; |
1571 | } | 1576 | } |