Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2976119rwo; Thu, 3 Aug 2023 19:21:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8R1V/TIAUSqw9q4Aq/Mhn4H8zhgT2h85RnMOgvadX2q8ORWZNUoG9m6zK00szzv1Bguke X-Received: by 2002:a05:6512:3702:b0:4fd:f77d:5051 with SMTP id z2-20020a056512370200b004fdf77d5051mr262973lfr.26.1691115700342; Thu, 03 Aug 2023 19:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691115700; cv=none; d=google.com; s=arc-20160816; b=BUJDwlba6M8wEMDN87VHFz96B8O/NAeQUYzcH4e4WJoWBB+8bbFi6gdO8lCUJYH/+7 3KtshrBwt5l/ojMrXaHNOkN7glzFaajAZUNJnj9J44RjU7PVGQPks5hrIo4pjygYp1rb 1IgfhSXOmSxp7tAl1XxDJauUbI1GdhgRbglIhFYKe3FGIw/9ldSnWQ3kyZnumHfpixZo LN2frfvD9fJF6yAsI9G6rORoeBTB357vK4yeqtlWbxAgnfVupjCVQ127kAqj1o+iqmCm Hb5swLwGuIxy+S0GO59baIQ/7WPrgIOjyO8m86wNNohzq97Wr4nvykL1dKuK3WmvKMgn zU4A== 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=tiQsaKVseedJc4FXolcKl5T/sadlXP/LVe3898RirAq6nTr1TsYsKP8J90JLlBK0VX C/hHPsep4iaZ/40FohJtXEvn7pp2GPSgmwPZaOtxJkHrYgVHXiBiCGIUT19apkimTbem jB2JEbIHcQLwFo5aUw9k15FafMoJ+NHNWcDa5Ih5uLBYW3YzwRrAkDDJH17ZlpkFY2AM yt6qJk2vgYHpsk/MFQLFi34ZG9enZUmPbJjSsVIXHh78jRQiVoDXVuD2UrPV2L/4Gs/j P44gxlf4/GnhFYY5IUtL+5j+0AFLeby5VUJgbJzHmNLS+bQmDJMqA+V5730jkEPNJ0pQ WUvg== 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 v2-20020aa7cd42000000b0052317aa66fasi801491edw.442.2023.08.03.19.21.16; Thu, 03 Aug 2023 19:21:40 -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 S231442AbjHDCKU (ORCPT + 99 others); Thu, 3 Aug 2023 22:10:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbjHDCKT (ORCPT ); Thu, 3 Aug 2023 22:10:19 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A420C448F; Thu, 3 Aug 2023 19:10:18 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RH8Gf2ccVzNmkN; Fri, 4 Aug 2023 10:06:50 +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; Fri, 4 Aug 2023 10:10:16 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v5 1/7] perf evlist: Add perf_evlist__go_system_wide() helper Date: Fri, 4 Aug 2023 02:07:35 +0000 Message-ID: <20230804020741.99806-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230804020741.99806-1-yangjihong1@huawei.com> References: <20230804020741.99806-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=-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