Received: by 10.213.65.68 with SMTP id h4csp368842imn; Tue, 20 Mar 2018 05:37:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELsZkFEzaEVc+k8edn3DDZBTbbj2mJuk1Ua0S1fd9badz52I+duBVbDI+9hbzkElH1RxeOD8 X-Received: by 2002:a17:902:322:: with SMTP id 31-v6mr16553328pld.122.1521549420521; Tue, 20 Mar 2018 05:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521549420; cv=none; d=google.com; s=arc-20160816; b=QWB/K/ilT7AAH5uJOhqdHgvgQhtydVquy+/QmW8B2vU520tscJzOgH5aLZdQMJeP+u LFZYZ4KOeahqkuPqENjsdmEjUJHpeDdIZKnx3zuyB+C1shr6qb9KyZCvwxyvure0+wX7 Mpjc/25wbGizp6y8LUjwpyJlPZZnala1+IcbilSSy4lvR/Gv1/JyG5Z4W6xmSVo4Zfcv R9TbYrb3vR3HvQRTJuw10G5o246XtZP7P5Gz84KmKW1gIQ0/REHlwcxRxMGBMkSHX/E1 AYzcjRv5d7mQR4s6x7L6ZFI2l2MHO+xqlDLRvgkFLCw/vv/6vIocIhRPTlMON9gO8SB0 hPjQ== 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=CkTOlS5Z/zSbZfa+uCsUZw+qHoPC1dWzjAFYYmBWM+jyQIWgS8Q2ljLaj4ovHdeKpq sbXCHLBGknfshZ+q3O/0Zin/swDEAuWKUmBVSdZdqh45xVjGjBth9k2ao7shf8sm6HUx RrMhZVEncE1wgOJwfuDvHyKbufS/FAOHrn5K/3if9Ys4z4fXJ1cBXBWl0xFbtRAYYCsY L0bCxhOUscT+8klgHxSKXlZUYSv1sXOyfCxOu/sHvFYir4vZLqhxQDczEy6h90AkxzgT g6RzlAgW7PfYNMBUWMOw97mcIQ714Kt1lqs6UzGAIF9lWZYdChiMRQfBBPz8ZBDdY7Tw DBag== 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 u7-v6si1497584plq.460.2018.03.20.05.36.44; Tue, 20 Mar 2018 05:37:00 -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 S1753233AbeCTMdZ (ORCPT + 99 others); Tue, 20 Mar 2018 08:33:25 -0400 Received: from mga18.intel.com ([134.134.136.126]:3060 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753194AbeCTMdW (ORCPT ); Tue, 20 Mar 2018 08:33:22 -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 orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2018 05:33:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,335,1517904000"; d="scan'208";a="209781489" Received: from otc-lr-04.jf.intel.com ([10.54.39.128]) by orsmga005.jf.intel.com with ESMTP; 20 Mar 2018 05:33:22 -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: [PATCH V7 2/8] perf/x86/intel/uncore: Correct fixed counter index check for NHM Date: Tue, 20 Mar 2018 05:32:39 -0700 Message-Id: <1521549165-6216-2-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521549165-6216-1-git-send-email-kan.liang@intel.com> References: <1521549165-6216-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