Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AB91C433F5 for ; Sat, 30 Apr 2022 06:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350118AbiD3G06 (ORCPT ); Sat, 30 Apr 2022 02:26:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239244AbiD3G05 (ORCPT ); Sat, 30 Apr 2022 02:26:57 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D78EBCFBBF for ; Fri, 29 Apr 2022 23:23:36 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id d129-20020a254f87000000b006411bf3f331so9174050ybb.4 for ; Fri, 29 Apr 2022 23:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=qM0CcLJJrKpW2Wkspbw9oc4+0PMtIaoOGCh2yb1+c8Y=; b=VBOkfSXM46pJ80dgupLJN/D1Z7T4yXWGOJ+DI1vGk++6kp1gHBu561dvEsfHpL5o2f 7wiKW8+aiHaP+tw9Vc/BpMDSEtzCsCQUrc/SFTRggF4GHyZ2stzGv2Pe1hJpYg0uGJSn tB7jYNqDPL+x7qRlKddqqk3hZnQU9/O59T9eBocCbDUDIYsscz5b8RlIPoVS6gKUoYOo LsRcFKjlm22Tqo1jSDyrWsEevSiiOYcAgJZ6mcKSuF+1e1SOe+iTlqhDMTYDc8F4R659 hIPKUlZNRDKRI5ijUWBupwo5z/zVsb7qjGmsgfxL5E+IPP2XJgt2W3sxeAdrF5oueksY 024w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qM0CcLJJrKpW2Wkspbw9oc4+0PMtIaoOGCh2yb1+c8Y=; b=3QMhKAPjozvASzGCct7rWlg0hRmo3hGqNt+HQVb2CxycgqMHZgwPzFCXF9yqUbIJ55 xFs/J8dYt1zIuqJPzoT7i18hJeos5KxnT8kQXV3tK/5oOXW02lnZxBEpzaAiBl9LXeBZ RyaBrWsdsGhW33be+aJ9Vv+JNSh6cdi0YD2LudT6eo40zOKX7ygT+QdIpXF/HxdA/ufh m5Z7NuO8gjEG72FUqjhrRUp/YJt9AeQPExuZ23ROkktaRW/8XIsToL8ASyKIjvTH0gGc MltW2fDAGvdHLqx/7/DNaeG5V6DzHZZq6Ctk1+s0DKRmFFoFrsGk/Cd5jG0B6iLa7Rav HvyA== X-Gm-Message-State: AOAM531vz09S7JNqoUiT0EZ9FpceL9ccxysm5mTd4I002yeWUT2xz9Xf VyCOaHF46ndnUcAJkHGbK4dDpQUkq0A8 X-Google-Smtp-Source: ABdhPJyJgzcdDR0Vabh1YpL71QKZ80jgYwvO35Fkq3RG6FcWK2FDtt70eli+OZlIVxeHRUcVSfpDNWMn1I1n X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:2481:caab:4fd5:232b]) (user=irogers job=sendgmr) by 2002:a81:7b05:0:b0:2f4:e45a:b06e with SMTP id w5-20020a817b05000000b002f4e45ab06emr2725986ywc.458.1651299816033; Fri, 29 Apr 2022 23:23:36 -0700 (PDT) Date: Fri, 29 Apr 2022 23:23:20 -0700 In-Reply-To: <20220430062324.1565215-1-irogers@google.com> Message-Id: <20220430062324.1565215-3-irogers@google.com> Mime-Version: 1.0 References: <20220430062324.1565215-1-irogers@google.com> X-Mailer: git-send-email 2.36.0.464.gb9c8b46e94-goog Subject: [PATCH v4 2/6] perf evlist: Clear all_cpus before propagating From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , John Garry , Will Deacon , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Kajol Jain , James Clark , German Gomez , Adrian Hunter , Riccardo Mancini , Andi Kleen , Alexey Bayduraev , Alexander Antonov , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Stephane Eranian , Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org all_cpus is merged into during propagation. Initially all_cpus is set from PMU sysfs. perf_evlist__set_maps will recompute it and change evsel->cpus to user_requested_cpus if they are given. If all_cpus isn't cleared then the union of the user_requested_cpus and PMU sysfs values is set to all_cpus, whereas just user_requested_cpus is necessary. To avoid this make all_cpus empty prior to propagation. Signed-off-by: Ian Rogers --- tools/lib/perf/evlist.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c index a09315538a30..974b4585f93e 100644 --- a/tools/lib/perf/evlist.c +++ b/tools/lib/perf/evlist.c @@ -59,6 +59,10 @@ static void perf_evlist__propagate_maps(struct perf_evlist *evlist) { struct perf_evsel *evsel; + /* Recomputing all_cpus, so start with a blank slate. */ + perf_cpu_map__put(evlist->all_cpus); + evlist->all_cpus = NULL; + perf_evlist__for_each_evsel(evlist, evsel) __perf_evlist__propagate_maps(evlist, evsel); } -- 2.36.0.464.gb9c8b46e94-goog