Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10264056ybi; Wed, 24 Jul 2019 19:37:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqynS7ldyQPH8aWLMEwzIgOU1rYxw7kLA6tPfvWc3+dF07vrUpDAo++sD0kVs6LNDjpvqdkx X-Received: by 2002:a65:4c4d:: with SMTP id l13mr43172024pgr.156.1564022248732; Wed, 24 Jul 2019 19:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564022248; cv=none; d=google.com; s=arc-20160816; b=XJ74ex3Mxoi79hCU34jCS5bHhF8Se4cKdQCelz4eE8prBlYf4Ln3ezrBM26zj3uJ9h bB5lnOdF0P6Vk1E+s2VT53PKdNmGOZ+RZc5e9A8BePi4c2ijxNcj/6SBvR3JKbrEZK9N fPvZfKYCpBNFognz+wUr32DYO6rk2gblQ1jsLfbICL0GuvoX+aQqURlSO3mUYi1h5Sfn fzLZ2TG5JvlH9Yu6eH2jykLk1J3f43Om4AG5liEkypUA57O6jjjBFaGwv1x7fNl4oyvy o6ms+RaJOsDR2womwfYJeiIuzPCt4TATyBcgKHrea5+1llOat9uNGOXP3Qe3CboL+azu i7+g== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BQTeXoPLZvTHy1LLWacW4GOPDM6wa53fd55fdvDAo+w=; b=ZYaMDRRvOSJNkp8NJoJgO5Fq/W6f5rJrAItnbX/4/bVTG1/GoobQcS4315DI78qAmT ApAuw44jeS2bL268kglCpid8IvjeDbRAAnAtm+Cc6Vm83iAS8i5L+0/c/MC+nJsEc9jD NJNkSxOhpAM108uhFFAo65hhoMnV+a2Aa5eJyGnNgO8GPev558AUSSzRvZrwDd0Ba7AL ZFfEr6aAGaw3/7UiOB56A1Qf061MVumQeLX65f5kUCg2MzlAqaSrdjMW5ogPj+aZJOrI urYJSJ5yLNpTx8kf/CWKz7/7de8P1z6Sfjcp9Daambvoo597+cbj2mpK55TderVsR39a 9zUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IIcAgPZg; 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 t143si18196565pgb.542.2019.07.24.19.37.14; Wed, 24 Jul 2019 19:37:28 -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=@kernel.org header.s=default header.b=IIcAgPZg; 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 S2389732AbfGXTj7 (ORCPT + 99 others); Wed, 24 Jul 2019 15:39:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:41038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388525AbfGXTj4 (ORCPT ); Wed, 24 Jul 2019 15:39:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 893A620665; Wed, 24 Jul 2019 19:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997196; bh=wLasL/pUJqvVePSzj70gWRxbCi16JyQ7xzLGqc936FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IIcAgPZgY+RYwCqTTTb6WHz3gDXg64pcDb3/SMS4qgPk1K2aWEcfIevgc7FKAz89c DtnhNEhp8BAqok8+RltdaFHBFxRkzSqRi7qYik826jFu+WI2clriHp2PvJ45oRBtK6 ZiAFoe3QZ729c9WGC9poFpZLf9U3d0wUxAjhkZfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kim Phillips , "Peter Zijlstra (Intel)" , Alexander Shishkin , Arnaldo Carvalho de Melo , Borislav Petkov , Gary Hook , "H. Peter Anvin" , Janakarajan Natarajan , Jiri Olsa , Linus Torvalds , Martin Liska , Namhyung Kim , Pu Wen , Stephane Eranian , Suravee Suthikulpanit , Thomas Gleixner , Vince Weaver , Ingo Molnar Subject: [PATCH 5.2 355/413] perf/x86/amd/uncore: Do not set ThreadMask and SliceMask for non-L3 PMCs Date: Wed, 24 Jul 2019 21:20:46 +0200 Message-Id: <20190724191801.113101726@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kim Phillips commit 16f4641166b10e199f0d7b68c2c5f004fef0bda3 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- arch/x86/events/amd/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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 * 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)