Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp782799rdb; Fri, 25 Aug 2023 00:23:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGKNoRbVx7Gumh/yGppAovffEG41J8hUsch9p5jqL/GMhyvI1or9+XxKI5CgmFGUu41pEa X-Received: by 2002:a17:906:4d2:b0:988:8be0:3077 with SMTP id g18-20020a17090604d200b009888be03077mr13373549eja.31.1692948205140; Fri, 25 Aug 2023 00:23:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692948205; cv=none; d=google.com; s=arc-20160816; b=YPXJij3nOqaWzpK/JH31D8ZetamyVeIwd8DscUuC6Tw4SyIMOxG+qPJ1/gp1oIAwHR Xd4rbwkJDLkXaDDrTRDjz55c3KHdflmstjKeG0a7WsYPeg2YZcwIKlakBPTF/JIFGHZf fnnBqF+3BqlqyQ9RXqvMEBrgQuECsaw9s2AUOJHxbHgrr77QDWzDXLfeZ9944cP+s5l3 Kzc1mFvcctra7mYndCA/wT92raRU/qvj9QukbdJeqMbJFhGdyrBjxY8jbtHM1WIGZq5B 6aUh3EQyA7wp23xSDk/4iAYMOIwwiKjst3916FYngaT+oxT4q021AQZSG6oYqGuZDZ4g e8aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=ypZquXQNVePia9+m3bcHFyAYQot7j3o5+txwDHnTNsU=; fh=3u2VfUFgb/2uEAHpweRGBYb3olEz3lDr2dnPYAQ0Cg4=; b=KEo0evM0PEBR2l8Dvhbut/rwCCrAdr13Z5TKKSYDiR9cHp56gCGK4VQbHrHIV6uOUs 7mHvqVazEUmS1U0Vm3BN+znSPLWkYKjHSWymfMSiVQV4Qjj6+/4YRig55RR5Q7rBbgfT 9MFQ4b7Xub9MGvTxn4qWUJ+4TXZDN0BOpNfpJSKqbqyyLEzhnUPNY/2+sNwJAGZxgmK1 Y6vjIsY7Dq4vjmTfFL//Fc/jIGHXLNFEyRh3Zv29SXR3EeLB5ql029uwLtVJfAvVzpVs uX6QLiRs0oemL1omfYKdju4RJuyyVv6kW34w3PHS6LGkrV2+yqEGqsMfPFuOBLAoSyIx uguQ== 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 ke11-20020a17090798eb00b0099dd5d4affesi657679ejc.981.2023.08.25.00.22.54; Fri, 25 Aug 2023 00:23:25 -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 S238541AbjHYFlO (ORCPT + 99 others); Fri, 25 Aug 2023 01:41:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238506AbjHYFlN (ORCPT ); Fri, 25 Aug 2023 01:41:13 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C8781BDA; Thu, 24 Aug 2023 22:41:10 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RX7xs1CdpztSMB; Fri, 25 Aug 2023 13:37:21 +0800 (CST) Received: from [10.67.111.205] (10.67.111.205) 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; Fri, 25 Aug 2023 13:41:06 +0800 Subject: Re: [PATCH v6 1/7] perf evlist: Add perf_evlist__go_system_wide() helper To: Ian Rogers , Adrian Hunter CC: , , , , , , , , , , , , , References: <20230821012734.18241-1-yangjihong1@huawei.com> <20230821012734.18241-2-yangjihong1@huawei.com> From: Yang Jihong Message-ID: Date: Fri, 25 Aug 2023 13:41:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.111.205] 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=-4.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 Hello, On 2023/8/25 12:51, Ian Rogers wrote: > On Sun, Aug 20, 2023 at 6:30 PM Yang Jihong wrote: >> >> 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); >> + } >> +} > > I think this should be: > > void evsel__set_system_wide(struct evsel *evsel) > { > if (evsel->system_wide) > return; > evsel->system_wide = true; > if (evsel->evlist->core.needs_map_propagation) > ... > > The API being on evlist makes it look like all evsels are affected. > This part of the code is implemented according to Adrian's suggestion. Refer to: https://lore.kernel.org/linux-perf-users/206972a3-d44d-1c75-3fbc-426427614543@intel.com/ The logic of both is the same, and either is OK for me. If really want to change it, please let me know. Thanks, Yang