Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1411760rdb; Mon, 4 Sep 2023 13:04:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUL2ekobbkvImj5kZ/t5N53I8E/BbIDg7a1DqHxm52Wco79GJXMlo4jYuo3V62+0oRRHg5 X-Received: by 2002:a5d:5748:0:b0:31a:dc27:e10 with SMTP id q8-20020a5d5748000000b0031adc270e10mr7541626wrw.65.1693857882448; Mon, 04 Sep 2023 13:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693857882; cv=none; d=google.com; s=arc-20160816; b=IGbAydA/+W8cqbByUsvXr6q/srTxjDR3IROfWf5vzj62oOEktNMb6ptK0bjH1OtFC9 pnHDX3NhlALnQ2EEq8qXnf7rX3ex3Hba2NIzBt7EErB84xGrPE6I3CNCNgHuLdl4vqBI dvOuy7pYL/clzEm+uq+vroC32tBQrmadhZ9J/rHJ0cbarpN84owrylkxikiGwJuWmE5m sJOm3vFg8tgqHfer74E4t+Y7y05OiDtKhj+a2wQlmW0+Z59C/82Gqsv0IC+GVM+icLCD n3F3H5WaKxLKnw2mcLCfvY35ZOIoJJQfTQCKVcQIBuCENB82BEqkZEiUC5tnJwuemKGI pnEg== 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=L3VvtMAe4p4ymcYSaZkqflarmlBdgv7hdc37nlt9Wt8Vs3dxQC8J3UNi/B8iL7w3e2 dZzgGtoIRg2kJuYAPpevJEC0RanK1t0BpbfNDGOJlV1s3nNW9/IzV6XyieYFaD/HCpxW PV1S/96H5thYFiQTcrNrqASGlYc3ePFkF4aeM8NYwtmoZeCwpJf19Nd8kSKh5rqqoLvy e+BgOnoTszS4kOH4UKSlr1tqkltOy29GgnNii/sbfQNh9rf5VzD1qmh/a4tR9bcjlPZ/ UE8HWCjOnCjmlju598LU3c3gu+Ls8TLyTzNIL+qX7Pf/jnMvfsg5mu8zOuBbreYxwwLB opyw== 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 l8-20020aa7c308000000b005259e364ce3si6747740edq.290.2023.09.04.13.04.14; Mon, 04 Sep 2023 13:04:42 -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 S1350948AbjIDCg5 (ORCPT + 99 others); Sun, 3 Sep 2023 22:36:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350806AbjIDCgz (ORCPT ); Sun, 3 Sep 2023 22:36:55 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A843A10C; Sun, 3 Sep 2023 19:36:50 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4RfCP66Pyxz1DDRq; Mon, 4 Sep 2023 10:33:30 +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; Mon, 4 Sep 2023 10:36:47 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v8 1/6] perf evlist: Add perf_evlist__go_system_wide() helper Date: Mon, 4 Sep 2023 02:33:35 +0000 Message-ID: <20230904023340.12707-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230904023340.12707-1-yangjihong1@huawei.com> References: <20230904023340.12707-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,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