From patchwork Fri Jun 16 15:08:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 109183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1415291vqr; Fri, 16 Jun 2023 08:13:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4qkxs5rtrFpGgxSr3S0aNFia4B/OtGs4WmmLG6xrPnHzcbAAZaIF0INOCH8tsHnfzWn4rG X-Received: by 2002:a05:6808:1144:b0:39b:86f8:f7c0 with SMTP id u4-20020a056808114400b0039b86f8f7c0mr2810614oiu.58.1686928428637; Fri, 16 Jun 2023 08:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686928428; cv=none; d=google.com; s=arc-20160816; b=0ji78yB3VlcWiaLIvNiIe9QH4uzGn+9XGZeD9IfaDp270PKOLhc+mduwUVWgiXk7WJ 1Fw9mVzQz3oJcPzRFBM037ogU2ZP/b5Tay9aEDrJvOzHrC+/Ma9/1I/8bGGdGXmg3OFO eIH9P0VJGnWev/ynCd4io0DoTbx9AmFRyJc1AigjXUjOyIjD9zO8wTHgi4Mh4h3oqwCB CeTInp5S0FCESkOtF13PZEnsB8f0oYw8LPfT2KRsxPboK1xDr69i45Kgh0ZFZUeDVBU0 06OK1094xjlW8/aTsRMH5Dan9PXKAR2iCc4134Qf/S7do3U03xOna2NX22tBcx+o4evL 8HaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=MWN9/UVJSfR8UNKg5ncnrUXsrX5NsjGgJXK/AFJEOIU=; b=wQJBb9FIdWnJSv1be6kl/M3Xr6zCKSi7tTCIeqr/uu3yQNW67J8+2JVFPbZyTxAwLX ifFME9czAGG/fywbfDbJbOP3FC0dr6bG2dhW7R6yZgrVlYCQadM0DgGFgnAHrWUaEfjW 7l3U6dzfoLFR4deKmX2znZNahE9UB4mPSUEXCJuYixqjggFlkaaktn+IoJJIdd3NKHnw 6+FT3SzZbXBlr5KFDBajoyZhB0OeVEOO2b81AwhlZaIL6GNT0SdILJL5qUaQjTOAkUkt 8Jp0fKZhxwnl0GbJyXPRmnuu+IWnNvYBxD/JkaWYaq5jz8G25XIFtYwAme/WMLnJCh3X dc0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0bE4Ms5r; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=mDFCWnYO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a631854000000b0053b8874cee6si15107415pgy.358.2023.06.16.08.13.33; Fri, 16 Jun 2023 08:13:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0bE4Ms5r; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=mDFCWnYO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345885AbjFPPJB (ORCPT + 99 others); Fri, 16 Jun 2023 11:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345846AbjFPPIp (ORCPT ); Fri, 16 Jun 2023 11:08:45 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62310358C; Fri, 16 Jun 2023 08:08:43 -0700 (PDT) Date: Fri, 16 Jun 2023 15:08:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686928121; 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=MWN9/UVJSfR8UNKg5ncnrUXsrX5NsjGgJXK/AFJEOIU=; b=0bE4Ms5rZYj/Ya7VR/VM2vqJn6G9RfZ5d+VdljhLagkZXz6smXDdSnXsj80bET+r49GHa6 v0zcFOIX6i5l5U3LiTTq2BvEurboGW8NBkol4tcH+DxURITI7mczOG2HR94jK0e160OKSR IEQGPC4Qo4w6d5ia48bG2zj2X1xSa1BmiMtW/I+bGHpmsuenS4PZ6bssDRwSLt1om7An4/ QdhxDRYvwLu3DN+hW/P0hr1TNbz66H00U49IaXEwVRty2x+ECbPMbybgmkMF+Rnjap6HD3 2bPUoIR59NFbaa9GOVDSeYhZUhdAJWl2e3oOOGqdOx3b2avnNPDzAyvLxDK7Bg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686928121; 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=MWN9/UVJSfR8UNKg5ncnrUXsrX5NsjGgJXK/AFJEOIU=; b=mDFCWnYOqeaKx4iNd1H/UoIwXlJfwnJXK2vQaNbjJjR5U1pOGCx1Is+eO+C+avWvcEx9C1 dBI2gtFljm3sFjCw== From: "tip-bot2 for Kan Liang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf/x86/intel: Fix the FRONTEND encoding on GNR and MTL Cc: Kan Liang , "Peter Zijlstra (Intel)" , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230615173242.3726364-1-kan.liang@linux.intel.com> References: <20230615173242.3726364-1-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <168692812071.404.11837107430102881683.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768792789828571840?= X-GMAIL-MSGID: =?utf-8?q?1768872664178102998?= The following commit has been merged into the perf/urgent branch of tip: Commit-ID: a6742cb90b567f952a95efa27dee345748d09fc7 Gitweb: https://git.kernel.org/tip/a6742cb90b567f952a95efa27dee345748d09fc7 Author: Kan Liang AuthorDate: Thu, 15 Jun 2023 10:32:42 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 16 Jun 2023 16:46:33 +02:00 perf/x86/intel: Fix the FRONTEND encoding on GNR and MTL When counting a FRONTEND event, the MSR_PEBS_FRONTEND is not correctly set on GNR and MTL p-core. The umask value for the FRONTEND events is changed on GNR and MTL. The new umask is missing in the extra_regs[] table. Add a dedicated intel_gnr_extra_regs[] for GNR and MTL p-core. Fixes: bc4000fdb009 ("perf/x86/intel: Add Granite Rapids") Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20230615173242.3726364-1-kan.liang@linux.intel.com --- arch/x86/events/intel/core.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 89b9c1c..27f3a7b 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -349,6 +349,16 @@ static struct event_constraint intel_spr_event_constraints[] = { EVENT_CONSTRAINT_END }; +static struct extra_reg intel_gnr_extra_regs[] __read_mostly = { + INTEL_UEVENT_EXTRA_REG(0x012a, MSR_OFFCORE_RSP_0, 0x3fffffffffull, RSP_0), + INTEL_UEVENT_EXTRA_REG(0x012b, MSR_OFFCORE_RSP_1, 0x3fffffffffull, RSP_1), + INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), + INTEL_UEVENT_EXTRA_REG(0x02c6, MSR_PEBS_FRONTEND, 0x9, FE), + INTEL_UEVENT_EXTRA_REG(0x03c6, MSR_PEBS_FRONTEND, 0x7fff1f, FE), + INTEL_UEVENT_EXTRA_REG(0x40ad, MSR_PEBS_FRONTEND, 0x7, FE), + INTEL_UEVENT_EXTRA_REG(0x04c2, MSR_PEBS_FRONTEND, 0x8, FE), + EVENT_EXTRA_END +}; EVENT_ATTR_STR(mem-loads, mem_ld_nhm, "event=0x0b,umask=0x10,ldlat=3"); EVENT_ATTR_STR(mem-loads, mem_ld_snb, "event=0xcd,umask=0x1,ldlat=3"); @@ -6496,6 +6506,7 @@ __init int intel_pmu_init(void) case INTEL_FAM6_SAPPHIRERAPIDS_X: case INTEL_FAM6_EMERALDRAPIDS_X: x86_pmu.flags |= PMU_FL_MEM_LOADS_AUX; + x86_pmu.extra_regs = intel_spr_extra_regs; fallthrough; case INTEL_FAM6_GRANITERAPIDS_X: case INTEL_FAM6_GRANITERAPIDS_D: @@ -6506,7 +6517,8 @@ __init int intel_pmu_init(void) x86_pmu.event_constraints = intel_spr_event_constraints; x86_pmu.pebs_constraints = intel_spr_pebs_event_constraints; - x86_pmu.extra_regs = intel_spr_extra_regs; + if (!x86_pmu.extra_regs) + x86_pmu.extra_regs = intel_gnr_extra_regs; x86_pmu.limit_period = spr_limit_period; x86_pmu.pebs_ept = 1; x86_pmu.pebs_aliases = NULL; @@ -6650,6 +6662,7 @@ __init int intel_pmu_init(void) pmu->pebs_constraints = intel_grt_pebs_event_constraints; pmu->extra_regs = intel_grt_extra_regs; if (is_mtl(boot_cpu_data.x86_model)) { + x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX].extra_regs = intel_gnr_extra_regs; x86_pmu.pebs_latency_data = mtl_latency_data_small; extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr;