From patchwork Tue Oct 10 08:19:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 150536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp39031vqb; Tue, 10 Oct 2023 01:21:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4uw/NHDRQ0+WfSer+L+y5+hQ5cazAeOKvL2CoTCoqsB6+8ArXFWZUW48AEatpkpjm3FVa X-Received: by 2002:a05:6808:2192:b0:3a7:44da:d5e6 with SMTP id be18-20020a056808219200b003a744dad5e6mr24365262oib.38.1696926101064; Tue, 10 Oct 2023 01:21:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696926101; cv=none; d=google.com; s=arc-20160816; b=ohDqdRgysSYV7oZHGqPCWPbsYSq8RzxtuaU9Oz1M9BgyZuGNDvIXfLp0Bn2NXdOS2u qEgR2WkGcgVMC2WBTjn1mmwBpVB8t9tJmG7T7qBlGD8YxORy7AKLdnNF7sKjJkAvn4vy Z38YxRTXP492MXdXIqqFi7Tc/y9irr1ZwyXyTR355IRP/JGUymHUI9nqkMCrC8a6Tixe z5kXFuTWe8fEEj5kyRw8nB2Eykn3Z4NHTMb0c4lKfLF4obvU6YmXFgh0Csx32Z6J2F9G 1AWdnClAkGmqodwaU7m7HveV3/wcV7YmvFclhbfULugtN1vZl9twA0lmotkA/bqw3iRo hwVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=k6rlJO7jKfEeTJGrCffSHZTc4ADy0SMEFm72FV6q9wc=; fh=EYYVvCvv2JI6DS8M3qJ7A+4T9a7H1hOpDdE0jGw79iw=; b=nH2i2s6Kg+wWDZxGpuk6aCs0cMrJWDKLZV8aHNTg2hhH9/5o3S5NYs8idIMGtYX4BH 5GRGOTwmE7lgJGjBd2JNDeOPFqzQS9YsTUxv3Po6od/CRWb788lptvCZnX5iRheTIkaE k+3xwpuGb9wyJYDl7i+Pc3RF1w3tBxzOTZLyGG7g9exRw0WWpxmKsqAJ5m9n6bXrZZhs DX1boevfAb/SiwfjNQL/Wju/api1YwEt1GOEU1qJRcbf4nDkEP1tDt3Hx0AP23pFeEbG jMHegFDPWw7XI331uiXSJIUctjN0Nmy8FhUY0EIvTiWs/UVFW4aVSCW/MVqAYrCCd5kG bBOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=phZcPISK; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l10-20020a63570a000000b00584a9290bd3si11245094pgb.522.2023.10.10.01.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:21:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=phZcPISK; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 6FDF582DDAC1; Tue, 10 Oct 2023 01:21:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442769AbjJJITp (ORCPT + 20 others); Tue, 10 Oct 2023 04:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442725AbjJJITf (ORCPT ); Tue, 10 Oct 2023 04:19:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCD03A9; Tue, 10 Oct 2023 01:19:33 -0700 (PDT) Date: Tue, 10 Oct 2023 08:19:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1696925972; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k6rlJO7jKfEeTJGrCffSHZTc4ADy0SMEFm72FV6q9wc=; b=phZcPISKaniNp8ieTKzoDHPsF7jAlMnGUkI1Cv3TFhq3ua16NMM7BWYv7OAk3RAfkArO9r 9DcGKSMra7+CDmHcDsyBrxLMZxYIDIv03Rx1y23EUsVoWt7weAGcX+3oDVxyA6zmY8D34f NhSAi1oHF1/3YYYTbfY5Zkb8n5YW7pP990WBRLei4Zvo+oyDXUoIfUzUZ7yk8OSg3eTTQp SxHi4um+uIqcc1+GJhYG8QJ1xhFgvHT0l6i0bP+qaurDrKsk6tnnsBmE/2RSK+r3JGwr0R JQV3f4kr/jJX5Q4SljewIquxnI91tE9fC7c4X4zYt/3ElVvBnCLO7J8zgurqmg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1696925972; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k6rlJO7jKfEeTJGrCffSHZTc4ADy0SMEFm72FV6q9wc=; b=w4Uqkj93Z/opO6jGRDXWF/WxHGKzxcJRvhuhjx1+g15M2Yd3Nz9ojXc2bUTm3exgPdNKdX wmyO9AqGylX7JXAg== From: "tip-bot2 for Tero Kristo" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/cstate: Allow reading the package statistics from local CPU Cc: Kan Liang , Tero Kristo , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230912124432.3616761-2-tero.kristo@linux.intel.com> References: <20230912124432.3616761-2-tero.kristo@linux.intel.com> MIME-Version: 1.0 Message-ID: <169692597189.3135.6821303889491635231.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 10 Oct 2023 01:21:05 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776873723479716461 X-GMAIL-MSGID: 1779355983753323947 The following commit has been merged into the perf/core branch of tip: Commit-ID: 05276d4831fe023b6674a72bd6b8c5b39796e690 Gitweb: https://git.kernel.org/tip/05276d4831fe023b6674a72bd6b8c5b39796e690 Author: Tero Kristo AuthorDate: Tue, 12 Sep 2023 15:44:31 +03:00 Committer: Peter Zijlstra CommitterDate: Mon, 09 Oct 2023 16:12:22 +02:00 perf/x86/cstate: Allow reading the package statistics from local CPU The MSR registers for reading the package residency counters are available on every CPU of the package. To avoid doing unnecessary SMP calls to read the values for these from the various CPUs inside a package, allow reading them from any CPU of the package. Suggested-by: Kan Liang Signed-off-by: Tero Kristo Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20230912124432.3616761-2-tero.kristo@linux.intel.com --- arch/x86/events/intel/cstate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c index 96fffb2..cbeb6d2 100644 --- a/arch/x86/events/intel/cstate.c +++ b/arch/x86/events/intel/cstate.c @@ -336,6 +336,9 @@ static int cstate_pmu_event_init(struct perf_event *event) cfg = array_index_nospec((unsigned long)cfg, PERF_CSTATE_PKG_EVENT_MAX); if (!(pkg_msr_mask & (1 << cfg))) return -EINVAL; + + event->event_caps |= PERF_EV_CAP_READ_ACTIVE_PKG; + event->hw.event_base = pkg_msr[cfg].msr; cpu = cpumask_any_and(&cstate_pkg_cpu_mask, topology_die_cpumask(event->cpu));