Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4821575ybc; Fri, 15 Nov 2019 10:35:26 -0800 (PST) X-Google-Smtp-Source: APXvYqwoJKrEPFApntIFHU+13F2dhnyJmHKx2Em75U5L4JdiKgVIHANsqt2We6pFjXEyIt9u6JVa X-Received: by 2002:a17:906:709:: with SMTP id y9mr2656347ejb.321.1573842926605; Fri, 15 Nov 2019 10:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573842926; cv=none; d=google.com; s=arc-20160816; b=IcRTb9Oa9skOo53zXNSJTd4xEvpSCV9VF0o/89SVkSkmJlmV2ZP3y5Hw4HoCq3rykc hb5HpXDrc6gmuc6xxOjehxdUG2EvmbnZYeIMblHw23Bi4mQakcyealM327X5s8Fy1iWk rzhfCQcLyuqED5ygI4kSiqKBlFHFaCJbN1ss05gX6zu7s0H4yvTyOaAGX8/G8q1jlKtj dayuDqiH8K5X7oFoX7rCINSB5ftDYzqUI+wavCf+OE6fHBWFN+5zUP59uNpKPNheDoHQ hZI5GGQYW0PGNFaWmenjKxBnxXgDs4QkIjAwGa5BG6751mQqkf8DGZvBfdX7f2wdReqp Ey2Q== 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; bh=vNQrpP1m+fN5Uw7OKIylN/N3P8q/P897h9UxPEeg+pk=; b=UByJPiFXIG2XVLGAFVRav+r41Ax++9Fk3nG1i7hPftv+zk+48Qi59OAP/JOdCXZDeL foV20bdXFexYHsaQnvBf1Yz0co5Jm4GumAQTVpvIz/GD92T76rxsASTvv5MWhJcrpS2a oduWtFuyD34ywwkuhX9ItvMND9ag0nuY3gO5KwSojWoAxeXCAFklYB5T+I7YymuGTngd Go4fmYLfd4kNVf5g7TIpOheDTA4yebv/rmfd1AqMZwDipe4SggoX4hbIFnmPvYnr5K0D uqnmxmTJerxAjpkKxC8CmAM9wqR8x+mVv8sGst3WWpTiYUhu1P8JJ5QokD0T1NAnOR79 fUWg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ov6si6463996ejb.196.2019.11.15.10.35.02; Fri, 15 Nov 2019 10:35:26 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726956AbfKOSdv (ORCPT + 99 others); Fri, 15 Nov 2019 13:33:51 -0500 Received: from mga12.intel.com ([192.55.52.136]:44102 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfKOSdu (ORCPT ); Fri, 15 Nov 2019 13:33:50 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Nov 2019 10:33:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,309,1569308400"; d="scan'208";a="203460847" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.21]) by fmsmga008.fm.intel.com with ESMTP; 15 Nov 2019 10:33:41 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id C24633010AB; Fri, 15 Nov 2019 10:33:41 -0800 (PST) Date: Fri, 15 Nov 2019 10:33:41 -0800 From: Andi Kleen To: "Liang, Kan" Cc: Peter Zijlstra , acme@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, eranian@google.com Subject: Re: [PATCH] perf/x86/intel: Avoid PEBS_ENABLE MSR access in PMI Message-ID: <20191115183341.GB22747@tassilo.jf.intel.com> References: <20191115133917.24424-1-kan.liang@linux.intel.com> <20191115140739.GM4131@hirez.programming.kicks-ass.net> <3e117702-c07f-bd58-9931-766c2698b5d7@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3e117702-c07f-bd58-9931-766c2698b5d7@linux.intel.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > @@ -2620,6 +2624,15 @@ static int handle_pmi_common(struct pt_regs *regs, > u64 status) > handled++; > x86_pmu.drain_pebs(regs); > status &= x86_pmu.intel_ctrl | GLOBAL_STATUS_TRACE_TOPAPMI; > + > + /* > + * PMI may land after cpuc->enabled=0 in x86_pmu_disable() > and > + * PMI throttle may be triggered for the PMI. > + * For this rare case, intel_pmu_pebs_disable() will not > touch > + * MSR_IA32_PEBS_ENABLE. Explicitly disable the PEBS here. > + */ > + if (unlikely(!cpuc->enabled && !cpuc->pebs_enabled)) > + wrmsrl(MSR_IA32_PEBS_ENABLE, 0); How does the enable_all() code know to reenable it in this case? -Andi