From patchwork Mon Aug 21 01:27:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Jihong X-Patchwork-Id: 136363 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp2895963vqi; Mon, 21 Aug 2023 03:03:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHMnIOy0pYAi5ZXU/AJC4LSM/0skz2Sfv2hsJ5PmY4VBHw+Ozh1P7xb7XytRNzA/4iwakkb X-Received: by 2002:a05:6a00:24d2:b0:687:5c3f:d834 with SMTP id d18-20020a056a0024d200b006875c3fd834mr9207255pfv.11.1692612192117; Mon, 21 Aug 2023 03:03:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692612192; cv=none; d=google.com; s=arc-20160816; b=ZCvCd4FnDw+Oy9hdCVX+ulG2BUQsh4PRhZT/Y6Tfav73JEX8TihIb3oQgPqXwS34Lx buF3nIzy6gvb+/cYkx+QU/z4RLE8gFVlp3aIm5jL/zWrJnZOoLQc5qAPUxXvMdXiKKkH o7UeyGhmVjrVsv9GD33O+XxITF09u3kstH8kf4LOaRFDcyEu3t0xXU0SIovjwi4YtJGS WysHc4Ql8586VgmXQUuMwhEYhvEArSiudMSaYU5w9wJuOFi7LYo1qT18c93gAGPDPUi6 oGDw4m9fM8ShDmiHJf0WRHg8gVnI4/rrD5L/ZAIDiERQ9pwBKXaWJw2iQAHctF3sqK4h kBTw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by11-20020a056a00400b00b0067bf9a05b45si6682008pfb.110.2023.08.21.03.02.58; Mon, 21 Aug 2023 03:03:12 -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 S232378AbjHUBaf (ORCPT + 99 others); Sun, 20 Aug 2023 21:30:35 -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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774832521796350094 X-GMAIL-MSGID: 1774832521796350094 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 */