Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1109258imm; Wed, 1 Aug 2018 10:19:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc3vzB9IF0DLs1oRZFbmXxFOF+z3XoEiJN+SQV1UJYIZvQ1IfV3R8Ob6/YJdSSN0ebx3WMg X-Received: by 2002:a62:1f8c:: with SMTP id l12-v6mr28248381pfj.143.1533143981183; Wed, 01 Aug 2018 10:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533143981; cv=none; d=google.com; s=arc-20160816; b=RiEBmxMCLxwybNMOhb6/4mTQ9cDplP+mCKJWVfuQb7Cyceh56qi/VdV757zmIloeOF o/+AvayvlHMMn6LPagIs5h4m47LEjdUK+prqgXoXHe+i/VqLdAe9BoW7YTQWfmd1CIKC ZhYVpkf/oth34EDj2Y3cvO5zzRRGZ4nr+lewCjrcIq5Gc6I1+yLa0zHXgZEEAC2ozjZ3 BbhBw4xve7xM56lgTLNLd1jIWNBmMXpljawDNT+E7EvQYI9ASgaagwSEJ3/pjUGqOiyU VH07xV5rOyjUJbHjUQiD5uI0BOZJIsDS+y4++rOI+EJrNqYlVa/6qzA4OQeiZTRWaHo6 2njA== 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=su2Yh00WglayvHhoM26NmiCCMGak8bEKREAafUSU35w=; b=sHudUiiizMqi2kURQ/ZuHjP8/0ALG+hutnnueJIO4FiLEefpfqIlnK2hv49etwqS96 +as7Hn4Iz5nYGF35QBYeB2jnzqP2Fo8HOxuwoGfDTOG3ZS+tL0X6/n45RusTmWKYFr09 GuaYY2pW9GWfYTcJwEb+k/7Mf8qc/adQktjW6BzgYEGFpBcjWU45D+Qwy9e6Vmu4odlj swWLzzsafNb0r8rjObYTnYYz5ng/FTVP9NQ040pP8P7+hnBG1ne7BPc36sUXXWw9hHTS 3J5jwVLjFFtrHFqEyFI+yz3cKD4uwEPrKGYJaBmNsCUCqLnAbK86k+S+5oDwbvN/rrTm tKLg== 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 e1-v6si17672414pfa.274.2018.08.01.10.19.26; Wed, 01 Aug 2018 10:19:41 -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 S2404615AbeHATDr (ORCPT + 99 others); Wed, 1 Aug 2018 15:03:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46256 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404023AbeHATDq (ORCPT ); Wed, 1 Aug 2018 15:03:46 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7E194CB4; Wed, 1 Aug 2018 17:17:06 +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 066/246] perf/x86/intel/uncore: Correct fixed counter index check for NHM Date: Wed, 1 Aug 2018 18:49:36 +0200 Message-Id: <20180801165014.852577363@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 d71f11c076c420c4e2fceb4faefa144e055e0935 ] 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. 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-2-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_nhmex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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_even { 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);