Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1107876imm; Wed, 1 Aug 2018 10:18:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd3a7vSYwOB96rM2qxJZQ9HAb4QWg/aEDutS2Q7wCJdKKRtM1lYl5ldM4K22wTu0dIu2UBp X-Received: by 2002:a63:6092:: with SMTP id u140-v6mr25499202pgb.433.1533143897692; Wed, 01 Aug 2018 10:18:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533143897; cv=none; d=google.com; s=arc-20160816; b=v2yQPfRLAO3Ee7lXwVu8od2Hys11RrWACxX9xh9Fop69mHivf/diQlvKNSqo/L2hC0 63AqR+7b29zhnwDj2doBEnvvNZtuyZhqlUy5/5n4d9GvBGnPdYtaZTpxoQr9FpuGHuP2 kUxnLKoc4agNaWG69kWbrMf+yeCvsUuxoWaDtgvqpv52a48RWcXhy0TB1EiPIWpwuFMB j4t/d6l3DRk1W6ZO0etgwFYjp+fOHLNuTXG3WVmiPb3Q9BY/km6AVAgohbbTuezXKZP8 LZJtssOogXqYvFNXxlPYp3SgYCaM9b4WlKpBRgQhwaBwLQaOCBJuBHMFNdtBqpSSw9YV N0QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=stBg9zAzyGD8BzSUOIhBRi9valdQdL8O9EgN5jnWciw=; b=kLSs+7WddNQ10paKDa/jfOI0vdENU/jDYaNwno7gURLVuCaAenGjuVBSW+jRPkzHo5 mUjmK5s/eoejzHRwXzeXRamCC/G9CZdOaAyf3iPihBzW3rWIWBlvJE5bq/RQvhd4kPQi doI4mSPQBfM3YpX4PImyLqJdh2cJiJuZFvErP3w3TnHTLWHHTzhk5ymiMFf8uzs5R8nP VDHra/x+oYadAfpmRePn7HaLRbNu4H44vz3IPoXDNH+ricUnHgp1Pvc4mrqwn2+PwQmr BSbNCccoMNRDV2DlXx3ixp5BXqYjo+0Fp5bRXmV4uMpbAS4rTwqPZkDtN4b0mbIuN2Db IAfA== 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 e3-v6si16479242pgc.85.2018.08.01.10.18.03; Wed, 01 Aug 2018 10:18:17 -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 S2404601AbeHATDm (ORCPT + 99 others); Wed, 1 Aug 2018 15:03:42 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46138 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404481AbeHATDk (ORCPT ); Wed, 1 Aug 2018 15:03:40 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B2F25C96; Wed, 1 Aug 2018 17:16:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kan Liang , "Peter Zijlstra (Intel)" , Thomas Gleixner , Linus Torvalds , acme@kernel.org, eranian@google.com, Ingo Molnar , Sasha Levin Subject: [PATCH 4.14 065/246] perf/x86/intel/uncore: Correct fixed counter index check in generic code Date: Wed, 1 Aug 2018 18:49:35 +0200 Message-Id: <20180801165014.807583942@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kan Liang [ Upstream commit 4749f8196452eeb73cf2086a6a9705bae479d33d ] 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. Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Thomas Gleixner Cc: Linus Torvalds Cc: Peter Zijlstra Cc: acme@kernel.org Cc: eranian@google.com Link: http://lkml.kernel.org/r/1525371913-10597-3-git-send-email-kan.liang@intel.com Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/x86/events/intel/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -218,7 +218,7 @@ void uncore_perf_event_update(struct int 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);