Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1970390ybi; Sat, 13 Jul 2019 04:12:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPpkBT23+r4x9jLnGeMrYFE3dmIfy5jsG8NUcT4L4BwwsSV63gvPi2ffPW1fbcuseHeJqW X-Received: by 2002:a65:49cc:: with SMTP id t12mr15264364pgs.83.1563016351182; Sat, 13 Jul 2019 04:12:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563016351; cv=none; d=google.com; s=arc-20160816; b=0Kg7ZXbSgne9sBzEZpsRSKwO76ejTj6e0Q/FmP/3T2w3zLHCxKww2YlE5epTTGKTam mzxuHlxIXifSS87tt4AVRwEryUgrYUM1/IjWRCrWfIqKRbXnNqYEMmZZRWQdRJpNY0ZQ IOoYyHrKPJb54TdIum6vKF2lxgm7jN1EreGhw8X0Sd6YCEj8/7wevSO+iY3olC2ocSpC hfK574qZDSzfki+LSI+v7j4LBg8mQjYux0QBBeIbz8bQ5zCKE7k1CeloGRIAFa8Rr6nB oVxSCcop7INnAaTbdKRjWL1SOV+CN8CUESd/AtYEhIvHFJj31q/pCDiBCUpGS6RO8+82 WA2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=3xEz6p5aOvGBZ2JJ/xzY6MXlyxphrTDLkgi2kX1X6GU=; b=iYCZi4gYE6vC/LafpGAJgeBzsrLvZAtZhcBA5np9kWx6SgoNbrNC+oAGH+AIDs6toq c+MnwLSDNWrQrVh1hl0jFU/gAqPyHmhdlbrMyzySRw93vCiZ+pbAuyYq32CAXaiTB/cv rELZ9UaSXnHpv11QxJGauUSnusKt5Xtr1H++GWV92uXQkMSbonCNwuYzKdmRwxBFD+ET rhfJzJZCzn+9obfM+swy2qa1cwUqSyiM97bU3W8Pr9MN9vgEZbtW9ZzikaEvsw7I79fA 5P8yAatUm4s1nR51mJTk2CstGru+ntUQQqpzeMyUpCwSx2uE4OJVc9DN9gQudogS449D EhPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019061801 header.b=SHIMaZ1C; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8si10910069pfh.276.2019.07.13.04.12.15; Sat, 13 Jul 2019 04:12:31 -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=pass header.i=@zytor.com header.s=2019061801 header.b=SHIMaZ1C; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbfGMLLp (ORCPT + 99 others); Sat, 13 Jul 2019 07:11:45 -0400 Received: from terminus.zytor.com ([198.137.202.136]:55395 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726755AbfGMLLo (ORCPT ); Sat, 13 Jul 2019 07:11:44 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x6DBAqfV3841685 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 13 Jul 2019 04:10:53 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x6DBAqfV3841685 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019061801; t=1563016254; bh=3xEz6p5aOvGBZ2JJ/xzY6MXlyxphrTDLkgi2kX1X6GU=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=SHIMaZ1CVqGWON1Sc+lWdEKCZaoBxpYwUSQjLHoQQR1zkO1QlWezX2SyYKOGVxLXa zHUhmoPOkk7gWLj7njfSv8UbnvP7fCLx0fwC1UvqdKS1iuASXgtrwicYkXcKPBYuZL HiTnBzzbIoNRUrOYvsKAyQmETPEHRwa2xvCdSDYehYjJAvmIpLwy+FBkpHFP5xw7RO pGv45CLhIVcVC56sWm2DwIpXt794JBprpXUB59s8pFrONKiHUUqNOIJ7o68ZGmfWLP V6vkQJSFEyuRNNCqHfeLIjQgTsGiIGo5EX8aq2m63qt2curdsUtMjljnTKXEkj5WFP g3ehsHGJc4XLA== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x6DBApYL3841681; Sat, 13 Jul 2019 04:10:51 -0700 Date: Sat, 13 Jul 2019 04:10:51 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Kim Phillips Message-ID: Cc: stable@vger.kernel.org, mliska@suse.cz, puwen@hygon.cn, linux-kernel@vger.kernel.org, vincent.weaver@maine.edu, namhyung@kernel.org, mingo@kernel.org, Gary.Hook@amd.com, tglx@linutronix.de, alexander.shishkin@linux.intel.com, peterz@infradead.org, eranian@google.com, acme@redhat.com, Janakarajan.Natarajan@amd.com, kim.phillips@amd.com, Suravee.Suthikulpanit@amd.com, jolsa@redhat.com, torvalds@linux-foundation.org, hpa@zytor.com, bp@alien8.de Reply-To: acme@redhat.com, eranian@google.com, kim.phillips@amd.com, Janakarajan.Natarajan@amd.com, jolsa@redhat.com, Suravee.Suthikulpanit@amd.com, torvalds@linux-foundation.org, hpa@zytor.com, bp@alien8.de, stable@vger.kernel.org, puwen@hygon.cn, linux-kernel@vger.kernel.org, mliska@suse.cz, vincent.weaver@maine.edu, namhyung@kernel.org, Gary.Hook@amd.com, mingo@kernel.org, tglx@linutronix.de, peterz@infradead.org, alexander.shishkin@linux.intel.com In-Reply-To: <20190628215906.4276-1-kim.phillips@amd.com> References: <20190628215906.4276-1-kim.phillips@amd.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/x86/amd/uncore: Do not set 'ThreadMask' and 'SliceMask' for non-L3 PMCs Git-Commit-ID: 16f4641166b10e199f0d7b68c2c5f004fef0bda3 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-1.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 16f4641166b10e199f0d7b68c2c5f004fef0bda3 Gitweb: https://git.kernel.org/tip/16f4641166b10e199f0d7b68c2c5f004fef0bda3 Author: Kim Phillips AuthorDate: Fri, 28 Jun 2019 21:59:20 +0000 Committer: Ingo Molnar CommitDate: Sat, 13 Jul 2019 11:21:26 +0200 perf/x86/amd/uncore: Do not set 'ThreadMask' and 'SliceMask' for non-L3 PMCs The following commit: d7cbbe49a930 ("perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events") enables L3 PMC events for all threads and slices by writing 1's in 'ChL3PmcCfg' (L3 PMC PERF_CTL) register fields. Those bitfields overlap with high order event select bits in the Data Fabric PMC control register, however. So when a user requests raw Data Fabric events (-e amd_df/event=0xYYY/), the two highest order bits get inadvertently set, changing the counter select to events that don't exist, and for which no counts are read. This patch changes the logic to write the L3 masks only when dealing with L3 PMC counters. AMD Family 16h and below Northbridge (NB) counters were not affected. Signed-off-by: Kim Phillips Signed-off-by: Peter Zijlstra (Intel) Cc: Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Borislav Petkov Cc: Gary Hook Cc: H. Peter Anvin Cc: Janakarajan Natarajan Cc: Jiri Olsa Cc: Linus Torvalds Cc: Martin Liska Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Pu Wen Cc: Stephane Eranian Cc: Suravee Suthikulpanit Cc: Thomas Gleixner Cc: Vince Weaver Fixes: d7cbbe49a930 ("perf/x86/amd/uncore: Set ThreadMask and SliceMask for L3 Cache perf events") Link: https://lkml.kernel.org/r/20190628215906.4276-1-kim.phillips@amd.com Signed-off-by: Ingo Molnar --- arch/x86/events/amd/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 85e6984c560b..c2c4ae5fbbfc 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -206,7 +206,7 @@ static int amd_uncore_event_init(struct perf_event *event) * SliceMask and ThreadMask need to be set for certain L3 events in * Family 17h. For other events, the two fields do not affect the count. */ - if (l3_mask) + if (l3_mask && is_llc_event(event)) hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK); if (event->cpu < 0)