Received: by 10.192.165.148 with SMTP id m20csp260942imm; Thu, 3 May 2018 19:41:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr5gvNuNXjiTKyUru32lS3JEk4aKtZ94V9me/MhDqKckT1qBQtRIq/b1huNymjBjixYS7Fw X-Received: by 2002:a63:b253:: with SMTP id t19-v6mr21466433pgo.212.1525401718859; Thu, 03 May 2018 19:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525401718; cv=none; d=google.com; s=arc-20160816; b=R7/A2alVsaIbSiXnNT/gSt2ILF0miDKdDVEHZkxtlFfic0YasD/thQ54PIaT1XG50p wuygv67HPYaSxYjqd4Kkb+68s5fzSJ5jdsLkKb03tcI6qbKcv2gtI9FxRfXJJFbVGmEU tXCw0GeZEAhf0cxfDD6vuyXoUYiF52UjZcbG6jpcExA0lNmZKu2dOmr8epKGO85xPl5d W+JLITb4N93hk9u8Gz86Z6WySFYdL7osBLB1Cic8zQGcWnwFZuY4HWMBRfHhFpJVaYI7 acbV7EUNE0MziFCnbrDkA3TXeh8VAa19qBOvSkC2tE8DuLRGMMtkh+0gL5YONhZYxGFF hnKQ== 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=MbJ7+dPsJTuD/g3HagzUkwpmWhzyTbwR+1GC6fKo3uI=; b=OYtNmj9uSIZoCbGeUXTFN3Bk/TFUMP/K12ioRj5AXYsnbgJ7IIATbfGyCUh7obxVDP sCAtqBBlIbcjKPjuuMVQPmDWDtATuVd4ECdTP8zoKLC6jMghmmQr56SoNn+UtGTeckJ9 93BlesxG/D3EstY2jWaqF+GXa8DzCKiIeF6kvVPo0ykU7yb8dSoORESejxPe2j7hvqNF xKwHwWIg7c/2voF+gZYQIbxEyxbWRWneZPlG/jppZUrAO5/qNWUk5f+w3yWpvrmqueWr adLzHZTn7q8bYO/zXUb0F08k357Ug75WszeT44fv61PkyBFT37zD5UKIulJRimgnGzX2 kKHw== 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 a34-v6si6980625pld.281.2018.05.03.19.41.43; Thu, 03 May 2018 19:41:58 -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 S1751392AbeEDClf (ORCPT + 99 others); Thu, 3 May 2018 22:41:35 -0400 Received: from mga11.intel.com ([192.55.52.93]:18418 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751214AbeEDCla (ORCPT ); Thu, 3 May 2018 22:41:30 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 19:41:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,360,1520924400"; d="scan'208";a="221513529" Received: from otc-lr-04.jf.intel.com ([10.54.39.15]) by orsmga005.jf.intel.com with ESMTP; 03 May 2018 19:41:29 -0700 From: kan.liang@intel.com To: peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: acme@kernel.org, eranian@google.com, ak@linux.intel.com, Kan Liang Subject: [RESEND PATCH V7 2/8] perf/x86/intel/uncore: Correct fixed counter index check for NHM Date: Thu, 3 May 2018 11:25:07 -0700 Message-Id: <1525371913-10597-2-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525371913-10597-1-git-send-email-kan.liang@intel.com> References: <1525371913-10597-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 V6. 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