Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp626593rwo; Wed, 2 Aug 2023 01:13:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlELPlNpQBmOCaG6Gy03i0mbmhzgRMf6eJf6EqCP8pkuW6Ar+TIHkhL4kD74GqNGev0M95J2 X-Received: by 2002:a17:906:db:b0:99b:66eb:2162 with SMTP id 27-20020a17090600db00b0099b66eb2162mr4221054eji.5.1690963987812; Wed, 02 Aug 2023 01:13:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690963987; cv=none; d=google.com; s=arc-20160816; b=I+Y+/wLCJug9QyVCTFRcid6IT3potuv89uBIWHQMZA073Rp04JfPdO3ny54DHdediZ ispK92P130myAxI+8RzLXkwxvx44ib1DAiEK/lghF1itqyZOmfPuQCFXXPxAJXiEE4jJ foEqmco9FM0gFCpxFaofrXs2rr81SQaaB2G6lTJKb64IoBZM5r9cbpwN+ClaTm6dQ8Fx faSkBB7IHjjcKm/X3lvNbteZZXTLw6gR+Ixun8uqxhB8nB92t3yZrYTLX9lCD/IlvmdT E1nR3U7bbm+BfFLdSqKffLDs3qwGqTiKwoqBZlUrDoCuW+0XXArln0Jqr7yjaHDzVH8g EXPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NRO6ll3NODRZGsv8c8lf/yozKZ6mRiA3XVYR111eioU=; fh=Ib1wi7jRbo+eNDLEErvWCJx+cnUm87PkGFthhdFf08Y=; b=oRzMUYnpTUXfAhRCled0tR4wAnHo71NR5DeufjtTn2AMBs0KYOVEaPdYBCiUKc7l13 tXGic3+aL3iR1a4RzPXIzxZT65tduzeby6A/KaacGS7GPTbZzU393r9rvw6ucm/UmA99 QTowNaS9qsX9Ze9CBgPmprStC1MdCPWf2JMZYdJi3NHmOxjSnEzpiYhPa4nQ5NKCYoix NJSoz1zaUx2PI+/Hxk0gt9NGENYQ2RHTK6u5lUQxKTSWk0Jc2DS0uiqeRnUVBEDQxcFt Ni0oWl/Vu7BqBRrKmsl4r1pAyo1vtMd1SnCWo3CR9D8GxyxChMxgauli1b7e+hk+Hsob LfFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o16-20020a17090637d000b0098e22b5657asi9351448ejc.929.2023.08.02.01.12.42; Wed, 02 Aug 2023 01:13:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231296AbjHBHyz (ORCPT + 99 others); Wed, 2 Aug 2023 03:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233619AbjHBHy1 (ORCPT ); Wed, 2 Aug 2023 03:54:27 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7357B4EEF; Wed, 2 Aug 2023 00:52:25 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RG4140YWlzrS5S; Wed, 2 Aug 2023 15:51:20 +0800 (CST) Received: from localhost.localdomain (10.67.174.95) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 2 Aug 2023 15:52:22 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v4 1/7] perf evlist: Add perf_evlist__go_system_wide() helper Date: Wed, 2 Aug 2023 07:49:42 +0000 Message-ID: <20230802074948.136468-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230802074948.136468-1-yangjihong1@huawei.com> References: <20230802074948.136468-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.95] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For dummy events that keep tracking, we may need to modify its cpu_maps. For example, change the cpu_maps to record sideband events for all CPUS. Add perf_evlist__go_system_wide() helper to support this scenario. Signed-off-by: Yang Jihong --- tools/lib/perf/evlist.c | 9 +++++++++ tools/lib/perf/include/internal/evlist.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c index b8b066d0dc5e..3acbbccc1901 100644 --- a/tools/lib/perf/evlist.c +++ b/tools/lib/perf/evlist.c @@ -738,3 +738,12 @@ int perf_evlist__nr_groups(struct perf_evlist *evlist) } return nr_groups; } + +void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel) +{ + if (!evsel->system_wide) { + evsel->system_wide = true; + if (evlist->needs_map_propagation) + __perf_evlist__propagate_maps(evlist, evsel); + } +} diff --git a/tools/lib/perf/include/internal/evlist.h b/tools/lib/perf/include/internal/evlist.h index 3339bc2f1765..d86ffe8ed483 100644 --- a/tools/lib/perf/include/internal/evlist.h +++ b/tools/lib/perf/include/internal/evlist.h @@ -135,4 +135,6 @@ int perf_evlist__id_add_fd(struct perf_evlist *evlist, void perf_evlist__reset_id_hash(struct perf_evlist *evlist); void __perf_evlist__set_leader(struct list_head *list, struct perf_evsel *leader); + +void perf_evlist__go_system_wide(struct perf_evlist *evlist, struct perf_evsel *evsel); #endif /* __LIBPERF_INTERNAL_EVLIST_H */ -- 2.30.GIT