Received: by 10.223.176.46 with SMTP id f43csp2595981wra; Thu, 25 Jan 2018 12:18:08 -0800 (PST) X-Google-Smtp-Source: AH8x227QH5GmjZ/f/jShw9azz2fBf8M97qv5jY0JRRjY30B9mvYptAmDJN0LgyepD8F3hjaIolt5 X-Received: by 10.98.205.72 with SMTP id o69mr14658357pfg.104.1516911488116; Thu, 25 Jan 2018 12:18:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516911488; cv=none; d=google.com; s=arc-20160816; b=Vuz0YNI7e+OENdsrWBHCxOuDKzX4B75YgIwYWQPDZG/U+WtdLlWTLfI+/2i5sznMZQ IBOXi3dfx4ElsQt3tHbcKJ30RNbU3RVT4l9uPb6212zaQPVuZcSJRDhIg/hWKG4FHnVT UkJ+W+CL7kVMZb44or2pks+YBTPB8TTpw0+Z9pIOO+47E/UMoFMfwyXxuTqqgZwqB21q IT4YnzJd4Tam2r/D9anuyd2AILkv6iffjaip92xKXw/THGJbdttvwErwCBpU5PLilA4v eCEnnM+UtGJ1ToESV7XA4PQ07sqzdkQm96+VyxeHoQY1b6w+SZJ03/qo1+qMnASyVaR2 0uhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=oR6u8WwtFi2y47/u6yVzLtjIQxPFu4nevHu7Duxmu8A=; b=biEk0rurcaKYtITlLAxE/k3IvVe3N8yk3aqI4BKwIfic+kdZMzO110Ra8ex4MICawa RW8i2Mow0AXhjLqmj42NgfGGbr10icQgQuPZWv5x0p223z1HC4N3cB8Uwrk+rV7ZEHz7 eulisqCtk6UmnFwaXTBQndgkVK2uVnraXQ2SUnG8jHuNy+tPbv6jbgxLXt0fLFDLeJFf Lz1NUmFOlXW0CkAXRHq7/4cH2A5VgiBAkYnM49hxkuebZQl2X4IgKjA3RocyIk5+VOWO aibIftW5MuWpOdP1j924rmbNG9S943eBHbGLLniO7xJfp9zSTgkfeBeRXKuy/ubW81eG ppIA== 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 e2si1947084pgv.810.2018.01.25.12.17.52; Thu, 25 Jan 2018 12:18:08 -0800 (PST) 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 S1751447AbeAYUPm (ORCPT + 99 others); Thu, 25 Jan 2018 15:15:42 -0500 Received: from mga14.intel.com ([192.55.52.115]:52332 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbeAYUO1 (ORCPT ); Thu, 25 Jan 2018 15:14:27 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2018 12:14:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,413,1511856000"; d="scan'208";a="169164979" Received: from otc-lr-04.jf.intel.com ([10.54.39.128]) by orsmga004.jf.intel.com with ESMTP; 25 Jan 2018 12:14:21 -0800 From: kan.liang@intel.com To: tglx@linutronix.de, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: acme@kernel.org, eranian@google.com, ak@linux.intel.com, Kan Liang Subject: [PATCH V6 2/8] perf/x86/intel/uncore: correct fixed counter index check for NHM Date: Thu, 25 Jan 2018 12:13:42 -0800 Message-Id: <1516911228-5293-2-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516911228-5293-1-git-send-email-kan.liang@intel.com> References: <1516911228-5293-1-git-send-email-kan.liang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang 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. Reviewed-by: Thomas Gleixner Signed-off-by: Kan Liang --- No changes since V5 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 93e7a83..173e267 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); -- 2.7.4