Received: by 10.223.176.46 with SMTP id f43csp2595127wra; Thu, 25 Jan 2018 12:17:20 -0800 (PST) X-Google-Smtp-Source: AH8x225WtqVMc3i0ixQFojsJtkxOUwiQmO0yZ1zfH2LQsM2p3j5s0TcTpJ9Zv5olL+GZ5ymSdlpR X-Received: by 10.98.214.129 with SMTP id a1mr16642260pfl.221.1516911440029; Thu, 25 Jan 2018 12:17:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516911439; cv=none; d=google.com; s=arc-20160816; b=tNBJyjp5AcWggoNNkxG5mTBO58QjInKhn1HcigZR06pvw4PGXVl7Iu9SBxBVtnKvbk wnQt/OTDssxAaQGxWRCfz1vR2xBTa3tfX9LBItU1ewU9DBWbLllQHnmg+LsdzIiNXIVt 5AUD/nLI1K0m3hq+M0fUQt5ltiFUrjtgrwLIf3jHRuycKblLPgAjTqXKSIpeJK88YHEO ucFs2ZavJ5Y6sBYE1yO0ng/1g5WLCN9LReQe8jSdD9WMC0msWdi7mMXzKFMKy6Eoc/sE 5rleaKvN2VoxyKRlnXVseXMugXq31PYb+irdQj75PNcWIB8jKSqPJKukWyLS1+Z+Gidw pK7g== 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=5Ddu8z7Id1hCoZsr1+iCtFEgKcjXu7YIgbtKv7ISahw=; b=xlbDi0L2sDE6vVUUel6lxtYGjy6yTobCmScVqznRExfz633IkqJBWDZ44Avq6PONUg tgWfgarlZKEfDHk4IqctsHXmBuP4wbYWBZ2QYS/apzX/fVms0jFQaMlc08SIZRV9uNA4 JVNuga3EsObFZdHPyRJlO0ByvuDfuipfs9kqQEtqquOF0ren2YbHcVDVrH3iqyfllBrY JioyzKPaD7EcFHpsvxIbi7EfhnMrnTlv7nFhLCRifaJoxEA8fQUkYLBUeDtaQpGTord/ Bk2/UyJWxrJXASfHMBlHvcY1yOzwtspjMNjXHMpYTMcL6eBB6SCDM29XoTIcoT7wZe03 yibQ== 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 q12si1979323pgc.64.2018.01.25.12.17.04; Thu, 25 Jan 2018 12:17:19 -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 S1751457AbeAYUP5 (ORCPT + 99 others); Thu, 25 Jan 2018 15:15:57 -0500 Received: from mga14.intel.com ([192.55.52.115]:52329 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751206AbeAYUO1 (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="169164980" 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 3/8] perf/x86/intel/uncore: correct fixed counter index check in generic code Date: Thu, 25 Jan 2018 12:13:43 -0800 Message-Id: <1516911228-5293-3-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 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 V5 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 7874c98..603bf11 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