Received: by 10.192.165.148 with SMTP id m20csp262010imm; Thu, 3 May 2018 19:43:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpieVuItgi9A8cD5ZYYw8Mt6UJOdp93kZwX9SyDQcIycfe08YFKlC4CdjdevAevBfi3RkH2 X-Received: by 2002:a17:902:7082:: with SMTP id z2-v6mr14225099plk.373.1525401824922; Thu, 03 May 2018 19:43:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525401824; cv=none; d=google.com; s=arc-20160816; b=qweBPFmhRrZJio3lajf2LrpVtPhlUh56wDdAO13w8ABErgAc1GKgzUQgDIDbCYHKfL Yp43Rr/xWsiAuBKhuZyObfSAwmyCmE7Wd39+3WmLyICaHBxc7sPuGpabQQZw9occw/Py rWFXS3WekHMD3lwd0dMWmlrYYd6JqLtVSJvR5BUEV+lejG9eyVmFF2GeRi8mqBwV3pnx 2VEhB3DsdGG7Y2Kazb+/wogTgzToSR07B/PiGjI9QZ0F4PO+16u1q/XBwdNNNkTKDDlD kN8Wc8AkxjaOxvSBUZP0ZpeT6CwxH3s9EZUolpWZJG7xDPxQvLJUXyROw90YkT5EE9vG EMkw== 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=v+SDYAEZQg705VYz9Rh7Yg8N4YFr67KanbjifALXfsc=; b=T8adQFRu86ei77myDOp0EuX/lzYvsZMx2y8T26+FCpesWitiV2FEn2cClD8vCuQdvk CMLt7FkcYs25ucupZHUTp0/53opsMLQiLhiR/KKeikcIdPUw4Kb6knrf1suhm0rWNKVT zxizMqhKNVHlNqiKxK1Dfolqk1Awmd3cKp28NfX+I4nChLozUW3G9RSNMFxq08+utZSa 0TvwVn6aK7+B5lV6iTsocBPMpNg9Nvb0D0bdFTWx7AtWzRLAP4dZMJPU+SpzF8tZzFcZ rXbwnI1b6xPk4zed942aZ73PMPwil4KveaFqyjX6E6nI7JKeW3bnvYdvpe5IJGwv2G8b u6AA== 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 h3-v6si12107896pgf.314.2018.05.03.19.43.30; Thu, 03 May 2018 19:43:44 -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 S1751349AbeEDCle (ORCPT + 99 others); Thu, 3 May 2018 22:41:34 -0400 Received: from mga11.intel.com ([192.55.52.93]:18422 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbeEDClb (ORCPT ); Thu, 3 May 2018 22:41:31 -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:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,360,1520924400"; d="scan'208";a="221513536" Received: from otc-lr-04.jf.intel.com ([10.54.39.15]) by orsmga005.jf.intel.com with ESMTP; 03 May 2018 19:41:31 -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 3/8] perf/x86/intel/uncore: Correct fixed counter index check in generic code Date: Thu, 3 May 2018 11:25:08 -0700 Message-Id: <1525371913-10597-3-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 There is no index which is bigger than UNCORE_PMC_IDX_FIXED. The only exception is client IMC uncore, which has been specially handled. For generic code, it is not correct to use >= to check fixed counter. The code quality issue will bring problem when a new counter index is introduced. Reviewed-by: Thomas Gleixner Signed-off-by: Kan Liang --- No changes since V6 arch/x86/events/intel/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index a7956fc..3b0f93e 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -218,7 +218,7 @@ void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *e u64 prev_count, new_count, delta; int shift; - if (event->hw.idx >= UNCORE_PMC_IDX_FIXED) + if (event->hw.idx == UNCORE_PMC_IDX_FIXED) shift = 64 - uncore_fixed_ctr_bits(box); else shift = 64 - uncore_perf_ctr_bits(box); -- 2.7.4