Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp850616img; Thu, 21 Mar 2019 10:13:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZahTPnTCfaqc5oZdIUD8CU2KIEBiaJrRF8HuAMj5CARK7Dnx68Y+YsL98voTNHURi99sz X-Received: by 2002:a63:c00c:: with SMTP id h12mr4325233pgg.423.1553188421666; Thu, 21 Mar 2019 10:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553188421; cv=none; d=google.com; s=arc-20160816; b=dsJ+Fgk3FePzR3w3bMUts5JANDCXqYm2PdcDNDhGJzZNer5GoUyj6YuuqgS5fJidp8 bMDDrXBUlaavYiIhuOxaUDpaaEJEUGCGeIxygR1E59iEdYdWvFR+ZuDB+rYBbQGhdAr+ pVshNosVGuv6vqMBFm+onsehNda0CEgilLBGRRL1bKoHyzh/coeXA1Fmh+jOYyiWQvGj /fbZDGF9rQWmZR+ssSL9EpKjv6tg3WjtZR7AgojCOr1o06n7+V7RveRdVueedfxFVGtd JwAGvVozM1HIAWbq4N08oaDqpwg9AoBn5ANjDpCFjylCKdl2+n7y7U6UMlDRkWohQfL3 r7ng== 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=xNyOZXrWAtPZ1Pw6VvzcHPhU01Cq5JVMiHnSKeEqNzk=; b=Dy6tkPvt3a0GynQkP5BAM2tmTeoNf+f9KsO2wthGhyES1pPiXuGtepdHQqsO6cI0z1 d6caT7T7STMdilzodZpJ0ZitgkLiCLCdacOqNPR7vK5aPEAJtD77K7nwwDGN63ByGzd2 05RqOQaqRzuUTN4Fjye8B1q/6B5Cd7BFWeXg35sURq5qwYhmFo+/WBUcd78PhFy82y1W Xg6aeKwFcdV1JRB4jNNBLCNO+dSZ/afuNZQod+C7kwHPeg7EOA0sRBNr1JUj3s/DmlaN 8eBbc8rWCMBgbagbJtzlTnffH7jJnngUqSDlPheVK6nyjWnh5v9QnDZyBEZJR8nVP0XG Ta0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Mr0gAm2R; 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 z18si4550408pgf.66.2019.03.21.10.13.23; Thu, 21 Mar 2019 10:13:41 -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=Mr0gAm2R; 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 S1728608AbfCURKz (ORCPT + 99 others); Thu, 21 Mar 2019 13:10:55 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42848 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728396AbfCURKy (ORCPT ); Thu, 21 Mar 2019 13:10:54 -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=xNyOZXrWAtPZ1Pw6VvzcHPhU01Cq5JVMiHnSKeEqNzk=; b=Mr0gAm2Ry5c1fjgPSFiZaMvBb i63YW6CLS6mGk11+HM0FDO6xUIlCA/zvwyMPVlDfCqhvMfMjidq/0+4vqLIe0yBGDI9MVVERW1DgR f/39TCb7hCQnWSXV7OktmC7gUYimEC79/XEj6gTmjZc303iRBkevoFGHXkGIt/7lcefGnp/I7xwWN ze6uWIbHq4WrypvpnNQNBAjMhTIsqafLuhdm95lV3hJp2YnJDRkWq879Y872mhQ0CMGT0/cDsE7xD P/8/3ELj3BnV/y0sj/TSBAJJ71vc5ausCZtjyEQlPLbOVsQlNAtyUZbJhNm5SlysHJLxUEUpl32Hy PfzPMht+w==; 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 1h71DO-0003SG-I8; Thu, 21 Mar 2019 17:10:50 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B07D2286836CF; Thu, 21 Mar 2019 18:10:47 +0100 (CET) Date: Thu, 21 Mar 2019 18:10:47 +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: <20190321171047.GR5996@hirez.programming.kicks-ass.net> References: <20190314130113.919278615@infradead.org> <20190314130705.441549378@infradead.org> <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> 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 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.