Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp315086pxa; Wed, 19 Aug 2020 01:59:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkqjxox6DUH7w5Fp0v1BjoBErgw6PwSkrACD39VA6Wc4nRZuVU33fQ9a2hX9XIbBqPq1Qh X-Received: by 2002:a05:6402:22ab:: with SMTP id cx11mr24450040edb.102.1597827542364; Wed, 19 Aug 2020 01:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597827542; cv=none; d=google.com; s=arc-20160816; b=pbdWMRbLos8ofyOS1bWJAiz9yG+RLFpKWvBTdcjnJGCGFbYqqS6sJdieHctvnRQVFr ZwwuLtTJWIA6MAg6INd8m7oYA81BBqsXSMWwuIYG1EnI6hwDMo1jEJYiBSwYrF33jKu1 Aj7rv6NDb/RaCJLEfYan3aAn2NgYgKl1wwjWV5NYcgctdIWYBrmcdQmSpDe7KfXHX4k0 2rICcHXmAu3grHai7b4yHZ37WLG3RbGUbfYi8CKbT9SNdOots1+0ia25DlD2wuej0hGl K3NUrcBpmsbz9xEGe2nNGMcgcY2onWp5K/aPs2A9NXJxvRd6xUGWkXD9wC8mxsM3EbAr e1ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=xB62ipU3c36GDRZN7Srlw0bVi4SwB21C4BFlAs5SHvk=; b=BXvSnnbfaSdCCfUypYKe+R1b+4Xkg3vm5wbvQiyGsI/EqnBnZWa9HtlVwSUGuNy6T/ aCVOb88st1iQjURwV6Tpml1wUho+Aay08LPqPbax3jEC+16QEi7HBrFqEVb3yP5kOJsK Z0oYx8tGWRzeV/qBchUgDvxE2uixpKxSSOcG2mb27Bq2IikGldy4I0NFq2cqnD4kueCs yCAiNF37x6S0eh+RTxgzgyGiu1+N3dpmWzvOywH84t9YI30tx1Fj5Bdl1Dok/uJDBjOH yR7yYlOpqeG1gjHFI4douWfCer13DekGtO++i0OOxP4qpZeIivIjAp6lKC/I2lflUAq9 wpiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=rRkzvlI3; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=mIs7IXED; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lv10si16252364ejb.522.2020.08.19.01.58.38; Wed, 19 Aug 2020 01:59:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=rRkzvlI3; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=mIs7IXED; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727772AbgHSI4F (ORCPT + 99 others); Wed, 19 Aug 2020 04:56:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbgHSIxv (ORCPT ); Wed, 19 Aug 2020 04:53:51 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 130BDC061347; Wed, 19 Aug 2020 01:52:13 -0700 (PDT) Date: Wed, 19 Aug 2020 08:52:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1597827131; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xB62ipU3c36GDRZN7Srlw0bVi4SwB21C4BFlAs5SHvk=; b=rRkzvlI3XGao8swR9/Z+VrwU/lKGCM2kLoZ7JIl7Aswt906xE6B9lTyhM6T+xNkCLchYgx avOUCnNf0Aine9gRVG9yu8HtWZT0VD+K5LJ2G2OqWG2uJSUOoEIkBi9xG2wC+TR01G2KAK /bQzMms6SuLz9D281L2QRFWIcF6CxoM1NN2kLTODpzyNadsITy2wb0Dfh1tOiXuisTtUgH hDZIizEUPENknXOA7YMfmkcT7IIAFqg0pCdggaGVJa4jFohPzSm6KU7piCnPAT2FUFVyTt 6MDEDbiqJ/Gr+pOZEtPpv1ckU1hsOb9gpfvkl/aAatZngt6JmwM+aGLoGQfpAA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1597827131; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xB62ipU3c36GDRZN7Srlw0bVi4SwB21C4BFlAs5SHvk=; b=mIs7IXEDUmifJtmZOSJeoxHcqGhYAnSuiV0IqTBpX8VY/kE1INkfPY7qNS5dTJ9ZuZDEsA JoZenpk90FaDTdDQ== From: "tip-bot2 for Kan Liang" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/intel: Name the global status bit in NMI handler Cc: Peter Zijlstra , Kan Liang , x86 , LKML In-Reply-To: <20200723171117.9918-3-kan.liang@linux.intel.com> References: <20200723171117.9918-3-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <159782713093.3192.8180456930454502423.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 60a2a271cf05cf046c522e1d7f62116b4bcb32a2 Gitweb: https://git.kernel.org/tip/60a2a271cf05cf046c522e1d7f62116b4bcb32a2 Author: Kan Liang AuthorDate: Thu, 23 Jul 2020 10:11:05 -07:00 Committer: Peter Zijlstra CommitterDate: Tue, 18 Aug 2020 16:34:34 +02:00 perf/x86/intel: Name the global status bit in NMI handler Magic numbers are used in the current NMI handler for the global status bit. Use a meaningful name to replace the magic numbers to improve the readability of the code. Remove a Tab for all GLOBAL_STATUS_* and INTEL_PMC_IDX_FIXED_BTS macros to reduce the length of the line. Suggested-by: Peter Zijlstra Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20200723171117.9918-3-kan.liang@linux.intel.com --- arch/x86/events/intel/core.c | 4 ++-- arch/x86/include/asm/perf_event.h | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 5096347..ac1408f 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2389,7 +2389,7 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status) /* * PEBS overflow sets bit 62 in the global status register */ - if (__test_and_clear_bit(62, (unsigned long *)&status)) { + if (__test_and_clear_bit(GLOBAL_STATUS_BUFFER_OVF_BIT, (unsigned long *)&status)) { u64 pebs_enabled = cpuc->pebs_enabled; handled++; @@ -2410,7 +2410,7 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status) /* * Intel PT */ - if (__test_and_clear_bit(55, (unsigned long *)&status)) { + if (__test_and_clear_bit(GLOBAL_STATUS_TRACE_TOPAPMI_BIT, (unsigned long *)&status)) { handled++; if (unlikely(perf_guest_cbs && perf_guest_cbs->is_in_guest() && perf_guest_cbs->handle_intel_pt_intr)) diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 0c1b137..fd3eba6 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h @@ -225,16 +225,18 @@ struct x86_pmu_capability { * values are used by actual fixed events and higher values are used * to indicate other overflow conditions in the PERF_GLOBAL_STATUS msr. */ -#define INTEL_PMC_IDX_FIXED_BTS (INTEL_PMC_IDX_FIXED + 16) - -#define GLOBAL_STATUS_COND_CHG BIT_ULL(63) -#define GLOBAL_STATUS_BUFFER_OVF BIT_ULL(62) -#define GLOBAL_STATUS_UNC_OVF BIT_ULL(61) -#define GLOBAL_STATUS_ASIF BIT_ULL(60) -#define GLOBAL_STATUS_COUNTERS_FROZEN BIT_ULL(59) -#define GLOBAL_STATUS_LBRS_FROZEN_BIT 58 -#define GLOBAL_STATUS_LBRS_FROZEN BIT_ULL(GLOBAL_STATUS_LBRS_FROZEN_BIT) -#define GLOBAL_STATUS_TRACE_TOPAPMI BIT_ULL(55) +#define INTEL_PMC_IDX_FIXED_BTS (INTEL_PMC_IDX_FIXED + 16) + +#define GLOBAL_STATUS_COND_CHG BIT_ULL(63) +#define GLOBAL_STATUS_BUFFER_OVF_BIT 62 +#define GLOBAL_STATUS_BUFFER_OVF BIT_ULL(GLOBAL_STATUS_BUFFER_OVF_BIT) +#define GLOBAL_STATUS_UNC_OVF BIT_ULL(61) +#define GLOBAL_STATUS_ASIF BIT_ULL(60) +#define GLOBAL_STATUS_COUNTERS_FROZEN BIT_ULL(59) +#define GLOBAL_STATUS_LBRS_FROZEN_BIT 58 +#define GLOBAL_STATUS_LBRS_FROZEN BIT_ULL(GLOBAL_STATUS_LBRS_FROZEN_BIT) +#define GLOBAL_STATUS_TRACE_TOPAPMI_BIT 55 +#define GLOBAL_STATUS_TRACE_TOPAPMI BIT_ULL(GLOBAL_STATUS_TRACE_TOPAPMI_BIT) /* * We model guest LBR event tracing as another fixed-mode PMC like BTS.