Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3213800rwp; Fri, 14 Jul 2023 20:46:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlFBQL7WKrD9OhHxt2SD1SUzicelrfPGwyASXmVoUkF+A2KXMfb7ws3LZuM020PrT2EJlBIj X-Received: by 2002:aa7:c6ce:0:b0:51d:96de:af6f with SMTP id b14-20020aa7c6ce000000b0051d96deaf6fmr6240103eds.0.1689392800339; Fri, 14 Jul 2023 20:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689392800; cv=none; d=google.com; s=arc-20160816; b=FUdyMs7xnZBcBYlWtiS7uPYCXsBevUhumwThOSNAYShevyO1ui4xQx9fckBTg5Wuon jVRwx6NdRjvQbB8T8M/ZC3BQlbvcSYq9PufAp06qvgiztdSj7QSTbukifRREY2pgHLlF CTzys2AV1+sDpThveAohxZZ0JKfmzq/VAxY0Aj9sAPLV3ykd/EaltFZYSN86mkn6R1k4 96agJl5DGpVuzuMOxG9obGmRWhATcTVCBSC6bIq9ekduw0JSxEba36/X6+k06PD14EUH jDss8xqyKP+eVdAxLL1ZmLZhMm+mtnTDlexs6mFSnFMK+FWiHG4W2qfp+JPqiazRvaZm fLzA== 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=er7Kgu2Atop/D3XE83zAPykLBLxENE1H212r3dsCAZpf5x0PzjQgNkW2vmRBbvmHKZ upfrXxqvDfUBJYl8AgpnOIIgMm+SJykeMEsYQ7lVPn6mGb8fCj/J7uCyDntWemou6MEb uEPow1b/xjJ+y8yZsB3ngvna0z9oJTu3rWxlhZH96MFiTKp8yjLwLSaSXPnipEuwZ3HM YkrqfA0UGSA+hYIM7j7lARJgS+5HqX6lDa5LqopKhwklExB3qbDMJkYyHZTxzfYoNo0v 6eZEBJ0C+UO8KHIOv2Dm4+Xnzk9VR7AtgpDfCLWUPzCk+RkI8XdcL7aJwTSjE7Sx7Irm 8zpw== 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 w17-20020a056402071100b0051de55a2347si9538118edx.283.2023.07.14.20.46.15; Fri, 14 Jul 2023 20:46: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 S229816AbjGODbg (ORCPT + 99 others); Fri, 14 Jul 2023 23:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjGODbe (ORCPT ); Fri, 14 Jul 2023 23:31:34 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69EB43A96; Fri, 14 Jul 2023 20:31:33 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R2v2r211nzLnj2; Sat, 15 Jul 2023 11:29:08 +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; Sat, 15 Jul 2023 11:31:30 +0800 From: Yang Jihong To: , , , , , , , , , , , , , , , CC: Subject: [PATCH v2 1/7] perf evlist: Add perf_evlist__go_system_wide() helper Date: Sat, 15 Jul 2023 03:29:09 +0000 Message-ID: <20230715032915.97146-2-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20230715032915.97146-1-yangjihong1@huawei.com> References: <20230715032915.97146-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,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