Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp805246img; Mon, 18 Mar 2019 14:47:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQFXbyas3WUENXZExWHoyB8NqJdFxXE3QXk0ctmFJ/iM0YEiO/Eazi15o4GwJWSk4RMbcZ X-Received: by 2002:a17:902:2ba7:: with SMTP id l36mr21126492plb.237.1552945662919; Mon, 18 Mar 2019 14:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552945662; cv=none; d=google.com; s=arc-20160816; b=zg9U/Kyz4Vqk9ibkcr9a1ywnTBCy4SCmzolC1dYSNukSpdY62s4d9FMVUqvO4No4b5 b79ms7vootKc7iObdPpTT3Yufg8gny+uRZomcKAhmWSOoqhzFUh4jxNCwHuk5Io3qzCf oSMj8dSz7uRkx08WLhTpkv2wu4Wrwog9ugw933GnT/FIU8Ad3McMllacNY6wfRaZqbiv IRuRMLQPW8HFSItQRqhqE3sCFvodVIFWL7UChZQrH0azRy9fCJ36aUKPdEd6zgaxIjOy SKcGYjsqMrsIeJiHs/ha4qPPGyjI2ZE0x5HUSuQbRw2mZXHxQm0hWcjy+rM1rnjz6+4K 9kzQ== 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; bh=rRSwDOe5RsVIPpL+tQlLJ/k6ECaRN9L5fRcbiL8B8Ug=; b=g+jc2N/hmU6Xiiz3tbPKe3FfJwMFppfQcaMrkU4hz5Po/zpxzi+kg9miAnZKVZEoZ6 VPMj68rc6bS89RnSY/RoC2h5UbqlXf4hdC0diz2E00dk181ACdp3+9K/ays/zlwGG0Aa Hg/TgSlbKbbonwyTwdRj1KKKPbJMSkgMQbVaqrotD6GSpPbFnsAhBAUg8Exa3dla3Vly 5nVzkdHMBhERTNzJzCPHyFQeAGzjojcXov9PydODarb5NU/AzMDcaf+dPnmUIllqlfsg naT1wsilf+fo7PjrwDONr4eQq/YL/XrS+/xVffiwp7JEY8KQhGkxumeuAyk08P4u52CN tmyw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n20si9695269pgb.78.2019.03.18.14.47.27; Mon, 18 Mar 2019 14:47:42 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727979AbfCRVpI (ORCPT + 99 others); Mon, 18 Mar 2019 17:45:08 -0400 Received: from mga04.intel.com ([192.55.52.120]:57599 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727838AbfCRVoZ (ORCPT ); Mon, 18 Mar 2019 17:44:25 -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 fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2019 14:44:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,495,1544515200"; d="scan'208";a="308301830" Received: from otc-icl-cdi187.jf.intel.com ([10.54.55.103]) by orsmga005.jf.intel.com with ESMTP; 18 Mar 2019 14:44:25 -0700 From: kan.liang@linux.intel.com To: peterz@infradead.org, acme@kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, jolsa@kernel.org, eranian@google.com, alexander.shishkin@linux.intel.com, ak@linux.intel.com, Kan Liang Subject: [PATCH 15/22] perf/x86/intel: Set correct weight for topdown subevent counters Date: Mon, 18 Mar 2019 14:41:37 -0700 Message-Id: <20190318214144.4639-16-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190318214144.4639-1-kan.liang@linux.intel.com> References: <20190318214144.4639-1-kan.liang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen The top down sub event counters are mapped to a fixed counter, but should have the normal weight for the scheduler. So special case this. Signed-off-by: Andi Kleen Signed-off-by: Kan Liang --- arch/x86/events/intel/core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index af2028ee2d1e..d69537b6c184 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -4994,6 +4994,15 @@ __init int intel_pmu_init(void) * counter, so do not extend mask to generic counters */ for_each_event_constraint(c, x86_pmu.event_constraints) { + /* + * Don't limit the event mask for topdown sub event + * counters. + */ + if (x86_pmu.num_counters_fixed >= 3 && + c->idxmsk64 & INTEL_PMC_MSK_ANY_SLOTS) { + c->weight = hweight64(c->idxmsk64); + continue; + } if (c->cmask == FIXED_EVENT_FLAGS && c->idxmsk64 != INTEL_PMC_MSK_FIXED_REF_CYCLES) { c->idxmsk64 |= (1ULL << x86_pmu.num_counters) - 1; -- 2.17.1