From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754692AbcKUOhm (ORCPT ); Mon, 21 Nov 2016 09:37:42 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:51172 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753928AbcKUOhl (ORCPT ); Mon, 21 Nov 2016 09:37:41 -0500 Date: Mon, 21 Nov 2016 15:37:16 +0100 From: Peter Zijlstra To: Steven Rostedt Cc: Jiri Olsa , "Paul E. McKenney" , linux-kernel@vger.kernel.org, Ingo Molnar , Josh Triplett , Andi Kleen , Jan Stancek , Borislav Petkov Subject: Re: [BUG] msr-trace.h:42 suspicious rcu_dereference_check() usage! Message-ID: <20161121143716.GG3092@twins.programming.kicks-ass.net> References: <20161121005343.GB1891@krava> <20161121092850.GF3102@twins.programming.kicks-ass.net> <20161121093424.GA9814@krava> <20161121125830.GE3092@twins.programming.kicks-ass.net> <20161121091543.45f49945@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161121091543.45f49945@gandalf.local.home> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 21, 2016 at 09:15:43AM -0500, Steven Rostedt wrote: > On Mon, 21 Nov 2016 13:58:30 +0100 > Peter Zijlstra wrote: > > > On Mon, Nov 21, 2016 at 10:34:25AM +0100, Jiri Olsa wrote: > > > > > > diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c > > > > index 0888a879120f..d6c6aa80675f 100644 > > > > --- a/arch/x86/kernel/process.c > > > > +++ b/arch/x86/kernel/process.c > > > > @@ -357,7 +357,7 @@ static void amd_e400_idle(void) > > > > if (!amd_e400_c1e_detected) { > > > > u32 lo, hi; > > > > > > > > - rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); > > > > + RCU_NONIDLE(rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi)); > > > > > > > > if (lo & K8_INTP_C1E_ACTIVE_MASK) { > > > > amd_e400_c1e_detected = true; > > > > OK, so while looking at this again, I don't like this ether :/ > > > > Problem with this one is that it always adds the RCU fiddling overhead, > > even when we're not tracing. > > > > I could do an rdmsr_notrace() for this one, dunno if its important. > > But that would neglect the point of tracing rdmsr. What about: > > /* tracepoints require RCU enabled */ > if (trace_read_msr_enabled()) > RCU_NONIDLE(rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi)); > else > rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); Yeah, but this one does a printk() when it hits the contidion it checks for, so not tracing it would be fine I think. Also, Boris, why do we need to redo that rdmsr until we see that bit set? Can't we simply do the rdmsr once and then be done with it?