Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp904472img; Thu, 21 Mar 2019 11:22:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv85GtcH9XcKFjn2EeNlbUotE+1SvVnP291Zn9w9CCInrgCNJd4Ebh8tBl5nk5/nXjHEPP X-Received: by 2002:a17:902:586:: with SMTP id f6mr4869540plf.68.1553192571034; Thu, 21 Mar 2019 11:22:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553192571; cv=none; d=google.com; s=arc-20160816; b=n08sX62DnaiqrhliA1HR/lkR82byW/2ws4oo1S4MYJ346q6tY2VXTpDlqzNE/1uC85 faCUmoxtvalT/ewyNQ3OILbqZjYDofRJfAf8b4yY+AgnM0aKi/ztyrXNQ/nUtxzJPW85 h0g03xKz8FnbE35lf2UnjDJLE2fI+JE3iGuafiHfa7L8up8uGoOpru7WHjNmNBsR9aVs g0BMZhHLelkUirUQoH4ERPL7vBSCgZUWPjWJTakmRCd67ZwsQc8XpN85J0VhJ8W4f+i9 tacfOGUo0oGhXaZ0lHr5mpQZnq2a5Mz3v/w5bVG5lyFoIef4leS/TdRfvwTx4pWExL9H 5bqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2Dq+aEiq3y83GeScl43j8vQc0O8xl6udcje1rD+sKWs=; b=cX+dL5gDQT+J2ESaxRm/U0eA4O+CDVwS+O/JzQpPIOp1T/eXBVoUjtee3fH6pxSI8X Yy7ticRO56GDz8HARlzw++yjuZzJi75hfBRxx8jMKgMJkOPNgDSkJGCctJ8W4gtvsDD4 oVBMELx3RIfpQKTR0KkBYqRAn6qTSKuMfp/Nc0d15tofroMv8Ggd/UHfY5nGzl/x/22W 2g8Aye3TWt8s2f2Zeb3LCTAHgJDymyjf2FHoozlntvK90mRtRjrHfoPCSlsi81mSPZHU Z2KDi56d3N6taPj0soOJPKvopdaMpA7Js9EYlwUdOvx2pLAkjsWwj1v1TwO9d9rO8rg8 SAtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=VFLv5OxY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si4503064pgt.357.2019.03.21.11.22.36; Thu, 21 Mar 2019 11:22:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=VFLv5OxY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728716AbfCUSUT (ORCPT + 99 others); Thu, 21 Mar 2019 14:20:19 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35464 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728439AbfCUSUT (ORCPT ); Thu, 21 Mar 2019 14:20:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2Dq+aEiq3y83GeScl43j8vQc0O8xl6udcje1rD+sKWs=; b=VFLv5OxY5CJt6JK7/913rkVwX Kf1teyefXWaR5Zzx486MHBKpalwPKZLddWaHwWclkeQa4XfQua5Tf39LUwwjCUbMxDqiNCeprL2i5 6WD5d9Cf/4+Oz+XvmtC/apMxvMYZQINt6cnVeDvvHXCcsPvEEgOwVekq9dLKI4ma/wPOqvHhEiSV1 fYgtvl+4dwWmVtWUAEdHFmhTE3hrtvr1J6pGSrJyQlCXvHAkWybuXTwiRTRIsKKiG7iqxpDiDxQ2O MKrBpoLqz2mpT8S2t+A4RoDJLcBhZ7Q7Y1WCBK0Qd2N+Uq9c/Al8itxM5L+7rT0O5x40qqouN0Hyb 3U04l4ldw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h72IX-0000Tg-9w; Thu, 21 Mar 2019 18:20:13 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4288F203CBE13; Thu, 21 Mar 2019 19:20:11 +0100 (CET) Date: Thu, 21 Mar 2019 19:20:11 +0100 From: Peter Zijlstra To: Thomas Gleixner Cc: Stephane Eranian , Ingo Molnar , Jiri Olsa , LKML , tonyj@suse.com, nelson.dsouza@intel.com Subject: Re: [PATCH 1/8] perf/x86/intel: Fix memory corruption Message-ID: <20190321182011.GT5996@hirez.programming.kicks-ass.net> References: <20190319110549.GC5996@hirez.programming.kicks-ass.net> <20190319182041.GO5996@hirez.programming.kicks-ass.net> <20190320222220.GA2490@worktop.programming.kicks-ass.net> <20190321123849.GN6521@hirez.programming.kicks-ass.net> <20190321171047.GR5996@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 21, 2019 at 06:17:01PM +0100, Thomas Gleixner wrote: > On Thu, 21 Mar 2019, Peter Zijlstra wrote: > > On Thu, Mar 21, 2019 at 05:45:41PM +0100, Thomas Gleixner wrote: > > > On Thu, 21 Mar 2019, Peter Zijlstra wrote: > > > > Subject: perf/x86/intel: Initialize TFA MSR > > > > > > > > Stephane reported that we don't initialize the TFA MSR, which could lead > > > > to trouble if the RESET value is not 0 or on kexec. > > > > > > That sentence doesn't parse. > > > > > > Stephane reported that the TFA MSR is not initialized by the kernel, but > > > the TFA bit could set by firmware or as a leftover from a kexec, which > > > makes the state inconsistent. > > > > > > > Reported-by: Stephane Eranian > > > > Signed-off-by: Peter Zijlstra (Intel) > > > > --- > > > > arch/x86/events/intel/core.c | 6 ++++++ > > > > 1 file changed, 6 insertions(+) > > > > > > > > diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c > > > > index 8baa441d8000..2d3caf2d1384 100644 > > > > --- a/arch/x86/events/intel/core.c > > > > +++ b/arch/x86/events/intel/core.c > > > > @@ -3575,6 +3575,12 @@ static void intel_pmu_cpu_starting(int cpu) > > > > > > > > cpuc->lbr_sel = NULL; > > > > > > > > + if (x86_pmu.flags & PMU_FL_TFA) { > > > > + WARN_ON_ONCE(cpuc->tfa_shadow); > > > > > > Hmm. I wouldn't warn here as this is a legit state for kexec/kdump and I > > > don't think we can figure out whether this comes directly from the > > > firmware. > > > > Even on kexec, the cpuc will be freshly allocated and zerod I think. We > > only inherit hardware state, not software state. > > Ouch, misread the patch of course ... What about cpu hotplug? Does that > free/alloc or reuse? re-use I think, but since we kill all events before taking the CPU down, it _should_ have cleared the MSR while doing that. Might be best to have someone test this.. someone with ucode and a machine etc.. :-)