From patchwork Wed Nov 29 06:02:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13472244 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD000C07E98 for ; Wed, 29 Nov 2023 06:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hhgubHrHQ35PxSyvUriHiiCNldFR7UOyW5mG0KNOaYo=; b=q1rLcUN/aVUjud IAzvn0c1mGlF+DVj/rnj0BztLF4XZEA9FddcPaVGBvaCegC3dfJH07fzZGpSYmRRXkXP21Q1Bvb5O uW5BHgXzGq3lSGFf2wleHLABmhkEaWknXi3MvraicljWj2sNfV9xuqzoVdIjgiYXfrvF9l2PeSmBx i4GY/1WwuwJ9pf3FoXS9ANAzWQAgjwLNDPENwk6JCjEzzvSjaP6BUi81swnrlP+ph1qF2ie2j++jP uVTKueMUMW7mbi5V4KGY1uz41Z0oy2F6WJeSwmzTJTWaQkYaU++xk9gQhVgFZSnxBRM2oHCCDpi65 Q/ohrI3GVmYH5tdgY1tQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r8Dez-0079YF-2j; Wed, 29 Nov 2023 06:02:57 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r8Ded-0079Cd-1C for linux-arm-kernel@lists.infradead.org; Wed, 29 Nov 2023 06:02:37 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5ce16bc121aso68649867b3.1 for ; Tue, 28 Nov 2023 22:02:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701237754; x=1701842554; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=VgvVWlesLuugbgRkTEvAvehfG8qq5p36CQo20xvLh64=; b=GyF05sGgLxzfFva2oCQRZJjKyXIilIpxbq3cG7RG2lgMKM6gI4idkN71xFG66TOLI1 QcIRSE8OBRbJlDNyJWNG9TyGgdr0IeOYCzTVQupETwusKK2BzqLHnjJOa60nCh6KyjWx QoF1vhQoo82hFuCCxSnvsJ5WBbiZFpW2HKYy1asUaDQe2YHKeyLBKD9JnR47FjVSVwYX YX6ebWU7nXZ4uyrXcag3DdIB3Eb25lkPQwB7hNuTaOGAoquLm88xRJ2whmNC0miyGai0 94QiSF1If4mCvM++T6O5hXqNYkDAkn0d6DY8PF5HRBDUS7/0dwUVzDabhMxmeGTH5kzK qbYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701237754; x=1701842554; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VgvVWlesLuugbgRkTEvAvehfG8qq5p36CQo20xvLh64=; b=ZX7AMfdWKueypJQ0PCwUssbjxUuFm2gqXpj9As/RbwWk7P+zPb/1ZFnsLomPH0GTaQ TXmArWgqF7lcbVzGa/qYIfe/5pR98ea0470FPquOiqeOiZ/RJyBRxvVKVbWJdBQcvOZY v++PC8gclvU9YbuvBeWfOwLgcWcU9BRFPnJ6YALT1+4/F46Yv0F7DqH7EIyvJ5meQ3sa ddABiNOqStIkIFW0raDyPrVetvM1Fuo6DjXhGHIAjuh74dZyjApKdpugKOu7CnP6dzYz pKlMWLa+WqaQzm8u9SCxxcl/Hv4kXHyMNph3gtVS72k9oStCCsSs557n+UgGc8pwgHOV UZlg== X-Gm-Message-State: AOJu0Yya/6Cz0gFZ9v8cgzECcw4P+0Hs5ek3x6Z9rfKVnwXHdjHUhF3g 6hWmYjN7gklMJQiCX5q7KvgSDhGUDIJv X-Google-Smtp-Source: AGHT+IHNr4ejdtETuIXhfF0YTzQe2IWwh7lZHWr7MqF4UN0ZlhfgRrJfjgfRl1a5b9HrVLvNyeXWn4aGPi+3 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:763b:80fa:23ca:96f8]) (user=irogers job=sendgmr) by 2002:a05:690c:2e10:b0:5cc:20a1:90e4 with SMTP id et16-20020a05690c2e1000b005cc20a190e4mr530191ywb.6.1701237753930; Tue, 28 Nov 2023 22:02:33 -0800 (PST) Date: Tue, 28 Nov 2023 22:02:05 -0800 In-Reply-To: <20231129060211.1890454-1-irogers@google.com> Message-Id: <20231129060211.1890454-9-irogers@google.com> Mime-Version: 1.0 References: <20231129060211.1890454-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Subject: [PATCH v1 08/14] perf intel-pt/intel-bts: Switch perf_cpu_map__has_any_cpu_or_is_empty use 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_Almeida?= " , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231128_220235_426570_E4CC34D9 X-CRM114-Status: GOOD ( 17.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Switch perf_cpu_map__has_any_cpu_or_is_empty to perf_cpu_map__is_any_cpu_or_is_empty as a CPU map may contain CPUs as well as the dummy event and perf_cpu_map__is_any_cpu_or_is_empty is a more correct alternative. Signed-off-by: Ian Rogers --- tools/perf/arch/x86/util/intel-bts.c | 4 ++-- tools/perf/arch/x86/util/intel-pt.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c index af8ae4647585..34696f3d3d5d 100644 --- a/tools/perf/arch/x86/util/intel-bts.c +++ b/tools/perf/arch/x86/util/intel-bts.c @@ -143,7 +143,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, if (!opts->full_auxtrace) return 0; - if (opts->full_auxtrace && !perf_cpu_map__has_any_cpu_or_is_empty(cpus)) { + if (opts->full_auxtrace && !perf_cpu_map__is_any_cpu_or_is_empty(cpus)) { pr_err(INTEL_BTS_PMU_NAME " does not support per-cpu recording\n"); return -EINVAL; } @@ -224,7 +224,7 @@ static int intel_bts_recording_options(struct auxtrace_record *itr, * In the case of per-cpu mmaps, we need the CPU on the * AUX event. */ - if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) + if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) evsel__set_sample_bit(intel_bts_evsel, CPU); } diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c index d199619df3ab..6de7e2d21075 100644 --- a/tools/perf/arch/x86/util/intel-pt.c +++ b/tools/perf/arch/x86/util/intel-pt.c @@ -369,7 +369,7 @@ static int intel_pt_info_fill(struct auxtrace_record *itr, ui__warning("Intel Processor Trace: TSC not available\n"); } - per_cpu_mmaps = !perf_cpu_map__has_any_cpu_or_is_empty(session->evlist->core.user_requested_cpus); + per_cpu_mmaps = !perf_cpu_map__is_any_cpu_or_is_empty(session->evlist->core.user_requested_cpus); auxtrace_info->type = PERF_AUXTRACE_INTEL_PT; auxtrace_info->priv[INTEL_PT_PMU_TYPE] = intel_pt_pmu->type; @@ -774,7 +774,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, * Per-cpu recording needs sched_switch events to distinguish different * threads. */ - if (have_timing_info && !perf_cpu_map__has_any_cpu_or_is_empty(cpus) && + if (have_timing_info && !perf_cpu_map__is_any_cpu_or_is_empty(cpus) && !record_opts__no_switch_events(opts)) { if (perf_can_record_switch_events()) { bool cpu_wide = !target__none(&opts->target) && @@ -832,7 +832,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, * In the case of per-cpu mmaps, we need the CPU on the * AUX event. */ - if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) + if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) evsel__set_sample_bit(intel_pt_evsel, CPU); } @@ -858,7 +858,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, tracking_evsel->immediate = true; /* In per-cpu case, always need the time of mmap events etc */ - if (!perf_cpu_map__has_any_cpu_or_is_empty(cpus)) { + if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) { evsel__set_sample_bit(tracking_evsel, TIME); /* And the CPU for switch events */ evsel__set_sample_bit(tracking_evsel, CPU); @@ -870,7 +870,7 @@ static int intel_pt_recording_options(struct auxtrace_record *itr, * Warn the user when we do not have enough information to decode i.e. * per-cpu with no sched_switch (except workload-only). */ - if (!ptr->have_sched_switch && !perf_cpu_map__has_any_cpu_or_is_empty(cpus) && + if (!ptr->have_sched_switch && !perf_cpu_map__is_any_cpu_or_is_empty(cpus) && !target__none(&opts->target) && !intel_pt_evsel->core.attr.exclude_user) ui__warning("Intel Processor Trace decoding will not be possible except for kernel tracing!\n");