From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 965E412C7E5 for ; Fri, 2 Feb 2024 23:41:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706917272; cv=none; b=HPBscpuLxQwAB+v+gp00o2yyDBExXwWlJme809WNsOMsASLlDYYzGGxUtRNL2wLWBnMIf1f78+R9XLC0qF0nYMzOfl8dLSqSxVDpsvdDvlm8L5ox86nWiDVcju3Qd4OXafA0NmNs7S2NB1wuJ80kNiZifOIFyXB912vcCEPnk+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706917272; c=relaxed/simple; bh=MMnuh1Oc8aQIK4NgPRT+2TknlqEUkEHoJeYCwVzCcjI=; h=Date:Message-Id:Mime-Version:Subject:From:To:Content-Type; b=YJkYlm0p5acSBHqg5zREAM+0QiLTVDGVgT9rCrJgYRuiUA2F0ueJQcfQNNx+nivk9U7CRkBO8UpWNjnY9F5q/7oaqFPusZwL5BKJmg6+gMkRZtxRXUWVGi82IslIz+2Rr5mmKhlZRQGEiqpN0XQPDXvgE2kjfgp6RWydZ+HT3GQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RelY/ddO; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RelY/ddO" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b267bf11so3139756276.2 for ; Fri, 02 Feb 2024 15:41:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706917269; x=1707522069; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=CGn7q3AR6sBJnuW0w7X+aFdd8u9EK+5apJ+BcUW3hYQ=; b=RelY/ddOhKc1+BmeSxPyTBj+bqIGPOtpzXzfuW+1LK++0ycq4is/vC5KhNDldKi4SW MBNk7bzIv1GsR8vj/a0/k5IrQLl7nK5BkgnkbwEx7lI4jVtJWiPC70uj0A1LFsS+TThm tUd43kdOtxmYGLDldWDKqwu5vROtwM/T+gBik3pyPaLvOZLWoOc0JNaWA7RiXY8EZndY lUyxTR5aLOYgq5JPmD+INa/VVA508/0wB1mwl83WiO5IVddC+wPJNOeWnTrehfEj8ktl jp9xAp8/btUWmk09/vn1nso/03+LIrM6CSX6gvhqwNzkTftuN+WMZGw1g5I4dEbgAAHd gkPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706917269; x=1707522069; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CGn7q3AR6sBJnuW0w7X+aFdd8u9EK+5apJ+BcUW3hYQ=; b=ltoP6FHItAEMYyBiaKWnDznPNjhMApFjj5b95sB7dAN2hqnOUPIxKQ3CDeaec6ksPg 5/ldWqwwTwlpnYfAa0i6zfWywgzaEDIWhPVuv6Tv/1lQazOi4/WLpiu8emyJclhw2gXj UNcs447J6RVvaaKeLuIDOpDxqFRXKtqgi9Ry1W9e7HqxXKF7YTFQGkltJq5xnXzQgoQu JhaIMeQuGMovh53tUyw3LIWYnn3yoI6oa6IO203+XPAW5me8oAxXs1l+lIy3yxoyidPy t3GY5Sakp4irRxaqdfbep2I5EsfkB+oki3LqbUY05POlDpJhDXjbogPE707LRk2v+Lut c/ag== X-Gm-Message-State: AOJu0YyT98a0yoVTF3FAqb9/YmgbHf77pR4O21i6HSRls/rf2Lcx4zuz J1JReRMAqQKwFZcxYNMGIoDfUO1Pbgjhuv6d7t9F5ThprqIWltIbpQUxK8U3IYTCIG8brUsxM9B 66JjEjg== X-Google-Smtp-Source: AGHT+IHylMNHjoaYXoYqqOOZFoFT4X3A3hWj7pDcXfX2BSwpZDbVFcOqv6wqndJbEhdaoK213X6R34ETA+tx X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:7732:d863:503:f53d]) (user=irogers job=sendgmr) by 2002:a05:6902:1b0d:b0:dc6:ee66:da6b with SMTP id eh13-20020a0569021b0d00b00dc6ee66da6bmr100341ybb.7.1706917269595; Fri, 02 Feb 2024 15:41:09 -0800 (PST) Date: Fri, 2 Feb 2024 15:40:49 -0800 Message-Id: <20240202234057.2085863-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Subject: [PATCH v3 0/8] Clean up libperf cpumap's empty function From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Suzuki K Poulose , Mike Leach , James Clark , Leo Yan , John Garry , Will Deacon , Thomas Gleixner , Darren Hart , Davidlohr Bueso , "=?UTF-8?q?Andr=C3=A9=20Almeida?=" , Kan Liang , K Prateek Nayak , Sean Christopherson , Paolo Bonzini , Kajol Jain , Athira Rajeev , Andrew Jones , Alexandre Ghiti , Atish Patra , "Steinar H. Gunderson" , Yang Jihong , Yang Li , Changbin Du , Sandipan Das , Ravi Bangoria , Paran Lee , Nick Desaulniers , Huacai Chen , Yanteng Si , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Rename and clean up the use of libperf CPU map functions particularly focussing on perf_cpu_map__empty that may return true for maps containing CPUs but also with an "any CPU"/dummy value. perf_cpu_map__nr is also troubling in that iterating an empty CPU map will yield the "any CPU"/dummy value. Reduce the appearance of some calls to this by using the perf_cpu_map__for_each_cpu macro. v3: Address handling of "any" is arm-spe/cs-etm patch. v2: 6 patches were merged by Arnaldo. New patch added ensure empty maps are allocated as NULL (suggested by James Clark). Hopefully a fix to "perf arm-spe/cs-etm: Directly iterate CPU maps". Ian Rogers (8): libperf cpumap: Add any, empty and min helpers libperf cpumap: Ensure empty cpumap is NULL from alloc perf arm-spe/cs-etm: Directly iterate CPU maps perf intel-pt/intel-bts: Switch perf_cpu_map__has_any_cpu_or_is_empty use perf cpumap: Clean up use of perf_cpu_map__has_any_cpu_or_is_empty perf arm64 header: Remove unnecessary CPU map get and put perf stat: Remove duplicate cpus_map_matched function perf cpumap: Use perf_cpu_map__for_each_cpu when possible tools/lib/perf/cpumap.c | 33 ++++- tools/lib/perf/include/perf/cpumap.h | 16 +++ tools/lib/perf/libperf.map | 4 + tools/perf/arch/arm/util/cs-etm.c | 114 ++++++++---------- tools/perf/arch/arm64/util/arm-spe.c | 4 +- tools/perf/arch/arm64/util/header.c | 13 +- tools/perf/arch/x86/util/intel-bts.c | 4 +- tools/perf/arch/x86/util/intel-pt.c | 10 +- tools/perf/builtin-c2c.c | 6 +- tools/perf/builtin-stat.c | 31 +---- tools/perf/tests/bitmap.c | 13 +- tools/perf/tests/topology.c | 46 +++---- tools/perf/util/auxtrace.c | 4 +- tools/perf/util/bpf_kwork.c | 16 +-- tools/perf/util/bpf_kwork_top.c | 12 +- tools/perf/util/cpumap.c | 12 +- tools/perf/util/record.c | 2 +- .../scripting-engines/trace-event-python.c | 12 +- tools/perf/util/session.c | 5 +- tools/perf/util/stat.c | 2 +- tools/perf/util/svghelper.c | 20 ++- 21 files changed, 192 insertions(+), 187 deletions(-) -- 2.43.0.594.gd9cf4e227d-goog