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: 171090 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp144131vqn; Tue, 28 Nov 2023 22:03:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDAnyaUBUWSUoA3s7BH1Gn7tmaqR99kE07i3csZehCj/CG/OK3Lb5G+nDyU4qI30vi6Ckq X-Received: by 2002:a05:6358:724a:b0:16d:bbe2:d4f9 with SMTP id i10-20020a056358724a00b0016dbbe2d4f9mr20256109rwa.4.1701237801002; Tue, 28 Nov 2023 22:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701237800; cv=none; d=google.com; s=arc-20160816; b=faFzoqMLmHbEMH+3uhJaDHO2DBgIX/kllFe4PoPYLcYMkbi42mVLvZaeVZ23Y5tTu9 zNd53jllnQjPmxsf+IXiOeSBF5ZI+kiJ4Ral95Ke+VH4b8FN/VDMyoL6G1cGL2/XJ4/r 8TFUNOeimT1RdVPgihUDlJluWjCbYFQ2t5N2XHoABPzGrkTYglGgR33NA6BvB5t+pxl0 PrlMTNI/juUJww48S+t+x6hRFCFc3gTkczt6s6PZXONc2mE7DoxT8mXgSbZ/FgREMlga vbxq0ChgPFZ2NJWlijIbGuLUILQ1cTGpIY2f+CErO+slSNtdiX6CqbCIaWdRKjtBQBV0 CLhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=VgvVWlesLuugbgRkTEvAvehfG8qq5p36CQo20xvLh64=; fh=uYKNI4aCUAMYZ/8oQVBIse94GgoxWIIZr1zaTbrWG7c=; b=yTDRkF4Bg1kUUF6mXY/mJT5ol1+uPI3nh5OnZyic2BkoGvpKWKlR1KvjQ6edFDm80m 810KCSD80EJ3GwPBxdyjiR1dCcr8AfcPvheeIrZzrVaBz4XzED08RvPnKMAy7343/pfz 5WDp6BbygO5jq02Uha6CfWB05Owgk/Ghm+/g26k/CM1umubAEPyE0/qN0bEt5uwVGOAm 2gbwRl5MadHOBm8qWYwkhDwsPbHGybU89bWfR5sd/2FDDFEUn3XiBvGr9We8WAJqv49L tb/ANBeyKg7BoGic/8sCi0y3umM3x4hWLqc4BHsF3bscINA8id9As6VWoXWdvkezYAxK FTXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="plg/BvyH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id g14-20020a63200e000000b005be14925624si13685519pgg.714.2023.11.28.22.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 22:03:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="plg/BvyH"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E98A280B1311; Tue, 28 Nov 2023 22:03:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377063AbjK2GCs (ORCPT + 99 others); Wed, 29 Nov 2023 01:02:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377003AbjK2GCe (ORCPT ); Wed, 29 Nov 2023 01:02:34 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2ADE1BCE for ; Tue, 28 Nov 2023 22:02:34 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5cd6a86a898so78448357b3.3 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=vger.kernel.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=plg/BvyHeIdYw5/sTw/8O42pXvNpBZZ4xtGoLVCUiJ8muIkzDqGuBwIo95BlhMoKFP o/i3w6YTXdOnDTxRV/0RqWsZm1doL2DbJnJXxvjhVN/rkqy9j/FB0qds3WgYZ0wiJc9+ 36Q3FUJIMVZZuyaEvBd9T7YM8nNaFu2wip6TbRFCM5lMKpmKvaXmqL3sC9eyM31/ZNXw +PcvoJJDV/r6HB4n4V+Ubndu0hujzHDUnucFIp5H5nrcPARH7K1Jtk0lj4a21xEvx1Ta RcaIkHQqNrN3/RXdXd9fGyBYU3vaYlv6IF7qSr455Iq6b52U/Kbdhr2FPs0Dn/BXru3E JrMw== 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=d3s9on4NjZ+coVOYnBOJHcaA7leHr5f13j6USKVzO/7LG1WbUAwXb8RuqApQ0HMXHc zfj50Bk2hsPRPj1LBliThBoQo00khLb5A5bECEj96AlpxCk27xxQDA4v1Uy2OFB0wEkN SsX/THuPXzy8DSJnk9sXymddjCNBbIxl+0LyYHozqA5VqBf12uRqzLAziWBXy1Kl0WM0 W7oUmDF1S140Wb2XWTv/FjP/l2qvDa7B3gyMGWvVC6TuabreOPL1hAw7ES56t1oTFthH WlUk4aXZHWfyHyTiIObWgeT+R7gFdTyKb7GrvXOpYYy6oa7B5SObVe4Ew/8e6rmE3tNU JS7g== X-Gm-Message-State: AOJu0Yyt/LtECP75XfojejoL20B/neFFxdhGofHHZVHKwcL+88zlpj2q /KUg4BJhlu+8fDGD6pw32TrHg0df89tx 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-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 22:03:16 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783877128525343008 X-GMAIL-MSGID: 1783877128525343008 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");