Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp854347img; Thu, 21 Mar 2019 10:18:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJTTZzB+bWGLxUoByqEkDsq36lK19tlEIgAZ+8es1QCigX9OW5gde0TWjAnHHS5/bbFn0/ X-Received: by 2002:aa7:8d01:: with SMTP id j1mr4510215pfe.122.1553188698051; Thu, 21 Mar 2019 10:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553188698; cv=none; d=google.com; s=arc-20160816; b=Vah+zMeuLXaDKT5TWFaDMQJ551kq2+fbSgrzm6NmFaJHmMQ5jgymgx+pAe4C/6oNrQ 353+Bh61wHca0arUHhWqQPobLU4oNyJdwMViB1CSnuxT8NfeqEF3J0ZKx60c+NUr6SEI HwS8h3YpGTBirZM9iHxl/EkR4Kl4yEUQfBQHPTnJacMsz0rlRwZlhrVDUk111IjZeRc5 4BaxwAuud7jdt81nF0iWL5uq2k7rTwZgeqAIWeGYTcs9zmBQG1JzaHXLjpLR7dn05NuN hHH6xQNrJXeuzcAJYcvU5k2sEMScnFTQ2a9hEJj7r0bxJT9IXWeaT+Zboev8nLxdHTBb X14g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=KvoA5Dc0dMPPmbGIsOHJ8liHQ89GnVmTehfvVcpeNEA=; b=TYvJ/uQdIcqDJRiCDIBhPF5bxUHmBFJVZnbodI4451JK9BqRIknxUfI6bBy0aYJg3y 7mEseCclyy6gq4mWSfIuQ6d5r59RCGWnRcR0c9s9LNcEtID2sJAaP7TYACpy+rIF9qjJ mMpdbj7K5E0r6c+j7oSETDlnqpfbWzqXQxLlugoG/f9n3/YHdie+lQj22vWLSKY91spy o9KsYcsGuyJKbeDAhInFdQY61XJ5Tn4YTLD2ROoCGOpfDvNvNUAKlw50EFaJqKO8sNDi U/TVtTNdsuOQNvA/X9T9h1CrclJGX/sRJQAQ7vpsV23+ubR7ID4EmdE0KHePGTlNCHLU w1mQ== ARC-Authentication-Results: i=1; mx.google.com; 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 u3si4402009pgp.300.2019.03.21.10.18.02; Thu, 21 Mar 2019 10:18:18 -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; 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 S1728640AbfCURRK (ORCPT + 99 others); Thu, 21 Mar 2019 13:17:10 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:38885 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbfCURRJ (ORCPT ); Thu, 21 Mar 2019 13:17:09 -0400 Received: from p5492e2fc.dip0.t-ipconnect.de ([84.146.226.252] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1h71JN-00024V-Sf; Thu, 21 Mar 2019 18:17:02 +0100 Date: Thu, 21 Mar 2019 18:17:01 +0100 (CET) From: Thomas Gleixner To: Peter Zijlstra 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 In-Reply-To: <20190321171047.GR5996@hirez.programming.kicks-ass.net> Message-ID: 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> <20190321171047.GR5996@hirez.programming.kicks-ass.net> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thanks, tglx