[lkml]   [2012]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] x86, mce: Fix rcu splat in drain_mce_log_buffer()
    On Sun, Feb 12, 2012 at 09:41:33AM -0800, Paul E. McKenney wrote:
    > On Mon, Feb 06, 2012 at 05:18:02PM +0100, Borislav Petkov wrote:
    > > On Fri, Jan 13, 2012 at 01:44:35PM -0800, Paul E. McKenney wrote:
    > > > Looks good to me, but I do need to defer to people who know this code
    > > > better than do I. The key thing that (from what I can see) makes
    > > > rcu_dereference() unnecessary is that the smp_rmb() used in conjunction
    > > > with polling the .finished field takes care of ordering.
    > >
    > > Right, this was me trying hard not to screw up touching,
    > > thus trying to use the rcu_dereference_index_check() primitive without
    > > thinking it through too much. But you're right, I'm polling the
    > > ->finished field 4 times (totally arbitrary, btw) which should suffice
    > > while the mce_log() routine above writes those entries.
    > >
    > > Although, the question still remains, since mce_log() accesses
    > > through the rcu_dereference_index_check() primitive,
    > > shouldn't I do it the same way?
    > I don't claim to be an mce_log() expert, but when I looked it over,
    > I didn't see a need for rcu_dereference_index_check(). Unless I am
    > confused (quite possible), the memory barriers are sufficient.
    > The rcu_read_lock() and rcu_read_unlock() seem to be needed to avoid
    > premature freeing, though.

    Looka ere:

    commit f56e8a0765cc4374e02f4e3a79e2427b5096b075
    Author: Paul E. McKenney <>
    Date: Fri Mar 5 15:03:27 2010 -0800

    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.


    +#define rcu_dereference_check_mce(p) \
    + rcu_dereference_check((p), \
    + rcu_read_lock_sched_held() || \
    + lockdep_is_held(&mce_read_mutex))

    So I guess the check is to see that we're rather holding the
    mce_chrdev_read_mutex when accessing this from userspace (the mcelog
    userspace thing).

    I can't comment on the RCU-sched thing because I don't know it that
    well. It has to do with extended CPU idle times but why do we require to
    be in RCU read-side critical section when accessing the index? Hmmm, I
    think a guy called Paul should know :-) ...



    Advanced Micro Devices GmbH
    Einsteinring 24, 85609 Dornach
    GM: Alberto Bozzo
    Reg: Dornach, Landkreis Muenchen
    HRB Nr. 43632 WEEE Registernr: 129 19551

     \ /
      Last update: 2012-02-16 11:19    [W:0.024 / U:11.128 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site