Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp1443901rdb; Sat, 26 Aug 2023 02:50:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGz8t/NI4PMq1KWR++rEZmzdc1d/bdAMtQ9W682YkSJXoIGyP8NoNrcqY/kOgNqEpK02k3q X-Received: by 2002:a17:907:a05b:b0:9a2:ecd:d963 with SMTP id gz27-20020a170907a05b00b009a20ecdd963mr5238047ejc.44.1693043413333; Sat, 26 Aug 2023 02:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693043413; cv=none; d=google.com; s=arc-20160816; b=pWHohqIYT5TE/JWL0ptiWHoxx3P5+bMuG7q6/uL5OFmq4b/my/E24I+rB+rAs7jo8L jdjYQzyxbV1mUT5MBjNDB5Rp51/Hxor1l4ApRXZzdMcEbSxpzCOABBbxwKoA8VmjI3Db 4AKQgoPQzMHUEOrxm3oKsBtMrjWliTKnuoL+zsbKPlH8dfwKw3VSxYBdVi6DJlGb236u tpCiPcCEuEe/73rePHa3MUDbtGtnUh8zUf6u0tIRgsZtkDPIy/ssL04G1SGnSQSY3dQ6 DpFNYEBafPmpy62lNykMe0TVa0waZCTAKNM+aYfp15MnmRGpLLUCt2oYi4jjOkCGikP9 1NCg== 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=9Se4/dGwdsQhvMNvWBEpdaqokTWImU5HRVnAbb5q1LQ=; fh=+V2NJRwYYldEteK9NYuSkp4iZMVHSlTgEsLCPEY32o0=; b=a8xyFcfyLZod0Pig9H0GMnPf/LQATQwbOHv3G6IYQOMzOIus0zTnCIZ635NM7kWZtt Ct4mrgEP8y8Aak6BUm3us4qaqXzbdOPecv+UvOmQWE7dn0bFK1RjBRh0qk/RxCBbSVwB jFJvvT3CFvq+/GtWPgUAoPsb4TSbgTpHU3AbYQzSwM84aUT6mj/Dx3q7Q5v7EwFwNZWh TLdp2R/wtmmE14c2OFp+PwEnr2gSzXd6FzOv3v2zWPdZ1/SHnf0D6VGv5dpTpnF9pQgu NG4BLeiX8Kyr7U+5fn5/X57C9HqyGz4cv6d6qO5GG0JsbvggA0fbYSKKgA9fzoMyStN8 o1zw== 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 p7-20020a170906b20700b0099bc830b126si58548ejz.769.2023.08.26.02.49.31; Sat, 26 Aug 2023 02:50:13 -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 S231758AbjHZD3r (ORCPT + 99 others); Fri, 25 Aug 2023 23:29:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231501AbjHZD3N (ORCPT ); Fri, 25 Aug 2023 23:29:13 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C74262136; Fri, 25 Aug 2023 20:29:08 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RXhz34CLLztS5r; Sat, 26 Aug 2023 11:25:19 +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.31; Sat, 26 Aug 2023 11:29:06 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v7 1/6] perf evlist: Add perf_evlist__go_system_wide() helper Date: Sat, 26 Aug 2023 03:26:03 +0000 Message-ID: <20230826032608.107261-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230826032608.107261-1-yangjihong1@huawei.com> References: <20230826032608.107261-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: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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 Acked-by: Adrian Hunter --- 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