Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756380AbcCUPFU (ORCPT ); Mon, 21 Mar 2016 11:05:20 -0400 Received: from www.linutronix.de ([62.245.132.108]:44256 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755967AbcCUPFS (ORCPT ); Mon, 21 Mar 2016 11:05:18 -0400 Date: Mon, 21 Mar 2016 16:03:46 +0100 (CET) From: Thomas Gleixner To: Peter Zijlstra cc: "Liang, Kan" , LKML , "x86@kernel.org" , Stephane Eranian , Borislav Petkov , "Andi Kleen (ak@linux.intel.com)" Subject: Re: [patch 2/4] x86/perf/intel/cstate: Sanitize probing In-Reply-To: <20160321144218.GW6344@twins.programming.kicks-ass.net> Message-ID: References: <20160320185527.763205536@linutronix.de> <20160320185623.500381872@linutronix.de> <37D7C6CF3E00A74B8858931C1DB2F077058A7665@SHSMSX103.ccr.corp.intel.com> <20160321144218.GW6344@twins.programming.kicks-ass.net> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 855 Lines: 37 On Mon, 21 Mar 2016, Peter Zijlstra wrote: > On Mon, Mar 21, 2016 at 02:19:27PM +0000, Liang, Kan wrote: > > > > - /* Probe the cstate events. */ > > > - for (i = 0; i < max_event_nr; i++) { > > > - if (!msr[i].test(i) || rdmsrl_safe(msr[i].msr, &val)) > > > - msr[i].attr = NULL; > > > - } > > > > I think we need to update msr[i].attr as well. > > Because in cstate_pmu_event_init we still need it to do check. > > Yeah, this is exploding on all sides.. Gah crap. Why did this not explode in my face? Delta patch below. Thanks, tglx --- a/arch/x86/events/intel/cstate.c +++ b/arch/x86/events/intel/cstate.c @@ -553,6 +553,8 @@ static bool __init cstate_probe_msr(cons if (!rdmsrl_safe(msr[bit].msr, &val)) { *attrs++ = &msr[bit].attr->attr.attr; found = true; + } else { + msr[bit].attr = NULL; } } *attrs = NULL;