Received: by 10.213.65.68 with SMTP id h4csp368730imn; Tue, 20 Mar 2018 05:36:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELtEe+CY3nJLxQyGQsF0ZhT7n82SyvoAl7bPHLwyDj8vT4mht01x1/2RDMuW4F2SXiuHZk+E X-Received: by 2002:a17:902:b907:: with SMTP id bf7-v6mr14509272plb.325.1521549409764; Tue, 20 Mar 2018 05:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521549409; cv=none; d=google.com; s=arc-20160816; b=CaUYYragIjjJJt77TckOx1tXInKfJPn6jYaAGvYl33++2Drd0tUJcj7eI4O58dW1vY pqnz1PzXfWdorJH26aYIVtctVT8qitSDdKg3M28WORK55T2l3lY9C2SDRYkY2MiQWdEr mKkavFmTgrIuR38n36nv/TINMOWKUEI9khY0Fdgzs2ZMVlqcKtd1uexbh3ms83nl1Qod MlLdHchviMPSfzP+Y7DKmpufm5wguJnVGyizBBUlmV2aA+BrGs8P3BQevgBgjtDfn+rO 5u+9RQr4E/M+gncNVci0ir2aJ8xUMpOHNKAVPlXf5DO+P3/0DmirV1V5KgPOH3gptdr1 +RFw== 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=nBoPhFMDflh8Zv0HsZ3GPPzz3m+DXl3TQ+KC1EPOvVM=; b=pZ6LmUied3fwrimCTZqSIPoMiuDAkbxIs602hySppu2rLSiXoOiGE6myGU5sA2Fjj/ bXfs2AO7WouyP/pyU3VmmX3BKeeIeqGxQOosJQj2otFmpm5zwHP1Xn3z02AU0MWwsnRq HBZrGj+3CBrIPiB+52caTiQVP2M7CAIcxIvVL/1dddDktxfcvEFmrymyCBrhMhVMvben 5rN+ONqQWVoePSGcKyVpsBVE1pneMkv/P5hWLW/WmQmmqPQp77dPj3BfWIiAIOmK4j6P UgitEgEE/UGrRbQFP0Nd62O9I3XNcLJBtBiPae/oDrjxl7Gh8mTYrs6Ymu50RoMfpgtf KkWA== 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 66si1272609pfd.75.2018.03.20.05.36.34; Tue, 20 Mar 2018 05:36:49 -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 S1753266AbeCTMd3 (ORCPT + 99 others); Tue, 20 Mar 2018 08:33:29 -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 S1753190AbeCTMdY (ORCPT ); Tue, 20 Mar 2018 08:33:24 -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:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,335,1517904000"; d="scan'208";a="209781499" Received: from otc-lr-04.jf.intel.com ([10.54.39.128]) by orsmga005.jf.intel.com with ESMTP; 20 Mar 2018 05:33:24 -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 3/8] perf/x86/intel/uncore: Correct fixed counter index check in generic code Date: Tue, 20 Mar 2018 05:32:40 -0700 Message-Id: <1521549165-6216-3-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 There is no index which is bigger than UNCORE_PMC_IDX_FIXED. The only exception is client IMC uncore. It has customized function to deal with the 'UNCORE_PMC_IDX_FIXED + 1' case. It does not touch the generic code. For generic code, 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.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