Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp553811imm; Thu, 31 May 2018 05:31:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ61Yb/viiCFD7tpRGm+Zty/EcG7oh7OIyXZNraGArU/poD1Jwiq98eR2USQGQOqXQWUnt/ X-Received: by 2002:a17:902:74c8:: with SMTP id f8-v6mr6929312plt.317.1527769898018; Thu, 31 May 2018 05:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527769897; cv=none; d=google.com; s=arc-20160816; b=EicCaOs30lRgNhTFT/w/ec81PA3A34Obdocx3S/oAP75kA1ii+3uyScrZWnEktGvM5 IzcODxfW8988TmrKiZKYQreHDY4zG9CnndE7Ghu1gEobAGhNxseVwC13ijAh6Z3D0Dr1 UGRqw83zEMFc4gFZ3T7+Agb4LnHxDDp3fs8kmu3piml2vtsk8Jvw0HQhWegey7EdqZ54 vQi/afRyYwR/N/KA6c0qin+kOJYsOJHjGHKDBiHnWqH+oimgLfeMZ0n8dHg+feuKkLt4 LIhzjFNiCA6+fSf/U6mEAHkFtiipIJyA1cufupp0K8rnPjIfqfm2uBQWsfJpjihV99IH +WxQ== 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:arc-authentication-results; bh=9/MUiXVzls625fIeBHMCYWAGn1f/+6qeNJ/phiOZfQk=; b=xDTA4j4UYV7wrdc6mybWFpzC96DFOCZBbhIVmF7uGQaGk7a4wcvbt3eb2A+QpSjQFk f+0lu28AYMyAY7x1UVqwj7JGWFBgivILNorxatnhtZub4mExIS7/A78riFWKZZP0n5+p lo7YeHB3zFh58yotv48VCXi8u1gHvQm4r1Mk26fhAqzhM+QtYb6Y3j9+NxdixRz14rA1 dkZMT/M+a0iNVbdOimPYPxE02vvGa59rYQVtwSIacn4Xo4LJe2FCNUu1lbC/9zHIzv4V L7SvY2pRvdwy1pqSeacZEiBJPKbhA0Q+gYp5efyR6+qG1dLRQTyInDOYAeWBYLHK9ugP jmeQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n12-v6si11605875plp.123.2018.05.31.05.31.23; Thu, 31 May 2018 05:31:37 -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; 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 S1754967AbeEaMaz (ORCPT + 99 others); Thu, 31 May 2018 08:30:55 -0400 Received: from terminus.zytor.com ([198.137.202.136]:49561 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754882AbeEaMax (ORCPT ); Thu, 31 May 2018 08:30:53 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w4VCUXxd3562944 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 31 May 2018 05:30:34 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w4VCUXEw3562940; Thu, 31 May 2018 05:30:33 -0700 Date: Thu, 31 May 2018 05:30:33 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Kan Liang Message-ID: Cc: kan.liang@intel.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, tglx@linutronix.de Reply-To: linux-kernel@vger.kernel.org, kan.liang@intel.com, hpa@zytor.com, mingo@kernel.org, peterz@infradead.org, tglx@linutronix.de, torvalds@linux-foundation.org In-Reply-To: <1525371913-10597-2-git-send-email-kan.liang@intel.com> References: <1525371913-10597-2-git-send-email-kan.liang@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86/intel/uncore: Correct fixed counter index check for NHM Git-Commit-ID: d71f11c076c420c4e2fceb4faefa144e055e0935 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=-0.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_48_96 autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) 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: d71f11c076c420c4e2fceb4faefa144e055e0935 Gitweb: https://git.kernel.org/tip/d71f11c076c420c4e2fceb4faefa144e055e0935 Author: Kan Liang AuthorDate: Thu, 3 May 2018 11:25:07 -0700 Committer: Ingo Molnar CommitDate: Thu, 31 May 2018 12:36:28 +0200 perf/x86/intel/uncore: Correct fixed counter index check for NHM For Nehalem and Westmere, there is only one fixed counter for W-Box. There is no index which is bigger than UNCORE_PMC_IDX_FIXED. It is not correct to use >= to check fixed counter. The code quality issue will bring problem when new counter index is introduced. Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Thomas Gleixner Cc: Linus Torvalds Cc: Peter Zijlstra Cc: acme@kernel.org Cc: eranian@google.com Link: http://lkml.kernel.org/r/1525371913-10597-2-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar --- arch/x86/events/intel/uncore_nhmex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore_nhmex.c b/arch/x86/events/intel/uncore_nhmex.c index 93e7a8397cde..173e2674be6e 100644 --- a/arch/x86/events/intel/uncore_nhmex.c +++ b/arch/x86/events/intel/uncore_nhmex.c @@ -246,7 +246,7 @@ static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box, struct p { struct hw_perf_event *hwc = &event->hw; - if (hwc->idx >= UNCORE_PMC_IDX_FIXED) + if (hwc->idx == UNCORE_PMC_IDX_FIXED) wrmsrl(hwc->config_base, NHMEX_PMON_CTL_EN_BIT0); else if (box->pmu->type->event_mask & NHMEX_PMON_CTL_EN_BIT0) wrmsrl(hwc->config_base, hwc->config | NHMEX_PMON_CTL_EN_BIT22);