Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp1295369rdb; Mon, 21 Aug 2023 03:38:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7JhkKhNlIDhuYpPgCRkJyvefOj4pcwwlwZ7S0ZtlnGyIztaHTK1VE5cmE0i5eJ+Zt6Ebp X-Received: by 2002:aa7:d80a:0:b0:522:1bdd:d41a with SMTP id v10-20020aa7d80a000000b005221bddd41amr4928087edq.4.1692614282754; Mon, 21 Aug 2023 03:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692614282; cv=none; d=google.com; s=arc-20160816; b=TQ/x4FWqTZV3Nr+F3sO+KVIOIrN6wB5VDpm/Iu8S8Ap1VTEu7BstE2iMcs3sSX5Oni 6FlXvDsJ6HT6NiPes2HImJF7yy3QLsp7RBLZHJOxvlLk0imuhFJ4kxBnnHvEx4+okQOs Rhrh03cjKi59NpsyOwLFq5IPV6++PWXSZSQQfFV3QzGz5jQY9CuCzCE0mWJFCJoHi6hI z/Ts/4OkwEI+na5JcEC2ubxSfWWgvwx3bX1LmKbJ7Nk+Con3+X74Os1vegQWxatp2zs2 HI0+LiDxXPl+uGdMi3cD4dzAe4FesvSNOhIPNQOpNSY/XWPTc4vY1L0Ow8SUk76PmFon /K3Q== 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=Ib1wi7jRbo+eNDLEErvWCJx+cnUm87PkGFthhdFf08Y=; b=NAKZtnGoQwWyYKKjYq0dQ3c6cO11KFmV/qmuy1mMLq+Ph1Rbt7DqQ3iOtVFDqojG0g pXlmWSKiLMeQEK6AMwN8v4vYtmB1O1bKkrcWv2lzlz66ZJ+QgYlABFefy9a6qAiPBL6J 6KjLROtX/cf7KWQ1EfnFSTLxfs9Ll4K/JZ3ryfZxQ3GMJoHA6LyKF0cF4wxU8Yoh5dKO qXY0RQ5Q0tNPJKExyNARDTbuVqKlAKrhiqM/IQ4qdVHjCvXmTnFVjYLaiFYozELZdsry SPlNShBtio42/fgJpuKb+2eVsvUzHPONK9Ylzda4CcEJ4F7cKS9G9+55vDFyfG+zV2lO NdTg== 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 d6-20020aa7d686000000b005216d397e43si5113702edr.494.2023.08.21.03.37.38; Mon, 21 Aug 2023 03:38:02 -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 S232388AbjHUBae (ORCPT + 99 others); Sun, 20 Aug 2023 21:30:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232356AbjHUBad (ORCPT ); Sun, 20 Aug 2023 21:30:33 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C1C5AB; Sun, 20 Aug 2023 18:30:30 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RTZZk2P1XzNmp5; Mon, 21 Aug 2023 09:26:54 +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, 21 Aug 2023 09:30:27 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v6 1/7] perf evlist: Add perf_evlist__go_system_wide() helper Date: Mon, 21 Aug 2023 01:27:28 +0000 Message-ID: <20230821012734.18241-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230821012734.18241-1-yangjihong1@huawei.com> References: <20230821012734.18241-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=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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