Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4947821rdb; Tue, 12 Dec 2023 14:13:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEub3VBO6og5jOpt3Mz9rH7IbD8ofQkrk1SB9PCIob78X6QScobqnIeVUiFRIxwT/lWKJYj X-Received: by 2002:a05:6a20:6a03:b0:18c:b464:ec5b with SMTP id p3-20020a056a206a0300b0018cb464ec5bmr8764497pzk.61.1702419191644; Tue, 12 Dec 2023 14:13:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702419191; cv=none; d=google.com; s=arc-20160816; b=c1fnWrUo3k0an8E19m4a2VFsLqTgaZ8KgInc9joNBdUCvDohGIwfZBzzRBh1cfzh8g QADyWBY7EdJ/KyaXIp4Bdm5iwj1R+zWpLBMvIlmNRgFwTbgsithh0KYSje5PNQoKzOwP upDmTKTwxqDLsPg3kXfwBFV6jBX1CEv1Wu3vj5S00VRyefO8Q1VKMmRI28oadSqt+Ac7 QrnyHtEvewIL3jRDxBzcCXnXq4ZA+tq57g+BL/JEQ3N0fMIzWzTLIBH5yW4wQrbLhX+H znPGPTHUgoCAz0sYZyrEILUjqc+TpWQJ0Hf2zH3Fr2fFVSDq3rt/CljCAX+fcZJ4z8NY /KMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=cks51YM0UKyckZloGW9xq/gv3l7nlcfYyHgSc2Hh0TE=; fh=NrSVFBpe/zYAKLw5ACLTz8bYiL6Sl7vX/fduHxckth8=; b=Uh4iCLx7/sO4hnZM2QRbE/ERc+1ZEt5yVX/MWGH/7NdpHfY7RCkLJBG1ZE0GRTuyYr FxP8HP0ps0czEzfE0wHQSzL0JIxt9frMSNZoiQ0drwjnoSI+c6bsH5JyJ7zNpZyKMbZI daU5fH780D5RGq4KoP+a89SXyeaLQ3cjzMXbBmBwgax9hF2JOGsU/urtjZHKf2F/KjoR Z7Ig8WUC3XgqXX4wZOyrYN3Bn/aAyUGGn/4kmyvlmI4oGQ/mSoYc/dX8ncL7N07PxnwG sSN2ffs3LPHcXmV5ZsMFzHg4clcHljjb+ClMj/f1aviafUZYUsYAc2z4iIMJ1FF2uu7j rCCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=WUEXeLyI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p9-20020a056a0026c900b006cbfbb64e00si8214310pfw.138.2023.12.12.14.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 14:13:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=WUEXeLyI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 21A8C807D572; Tue, 12 Dec 2023 14:13:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbjLLWMg (ORCPT + 99 others); Tue, 12 Dec 2023 17:12:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231499AbjLLWMf (ORCPT ); Tue, 12 Dec 2023 17:12:35 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 374D3BC for ; Tue, 12 Dec 2023 14:12:41 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-551d5cd1c42so4485a12.0 for ; Tue, 12 Dec 2023 14:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702419159; x=1703023959; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cks51YM0UKyckZloGW9xq/gv3l7nlcfYyHgSc2Hh0TE=; b=WUEXeLyI9BlooXxN2HXT4S6bSA3hhuVCeVQwIifG4XAIT6B4+L8K9gk8iHyT3+nzzo VZ3Gav/uV1nwNhy9a3aKByLan3AWQFKMwMleN1jTwr65NYBlqnp4pr8Ws98piRKNHu2V kXyr5cHjKtlQ4SjLWS7i0J+R5rziHsh+cT+j8JIyxc3M925BGwdUcItzg7YcjGcPomus T2XL6bQ1fA0RTEBJlL6Z5ueUwaBNvFxpMKuOA+7rYscHSdxEsGKpZPoegWZjBs+KNSJD 5QbnoQOF5DuN1sAzCpjQKpryS4M+T5Se5w+84n1CMON70GoDarVWDhFzwar2RaNyIPAT C/NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702419159; x=1703023959; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cks51YM0UKyckZloGW9xq/gv3l7nlcfYyHgSc2Hh0TE=; b=msArUGZjEPkex+hYx2mEovnqSmbWYd5/5jtLv+MR1SImGtq4k21GJ2Uj7q/srEk5yy rvCDZTTFaM/NICM8VY3KbsBUeDssfI51XCMd4hQv1K/GTJ4n+b+D09ERMItgzwxuWj6A M21aQYIEV3ihJ4DeFuf2DOo5pYgU9/xKW42b+Ow9cXrKqK0ZPTofERzOhcG0vWREe9ya BMmml7XNb77xj9RUJyN/w6++Xp8bbvodd5cdpp5ELyyviryoCQ4C/470vLimw8w7gzJA Zn6eaMiVGhZo8xifkLPT5s8ImnV00kmtIOx4k4zgTQS6v51Jkhawru+4KV+mMA2tZL+b 6rhg== X-Gm-Message-State: AOJu0YxgYsUMvffzoozB4t6Ec8Vi9RsT2v/MjS/V85aCce8GY2H3NBd2 TTqZNsdFCV6NYAtHj9GeY0KMvTnoy4UJyMZu6gQk8g== X-Received: by 2002:aa7:d4d6:0:b0:551:d490:2748 with SMTP id t22-20020aa7d4d6000000b00551d4902748mr78706edr.5.1702419159394; Tue, 12 Dec 2023 14:12:39 -0800 (PST) MIME-Version: 1.0 References: <20231212193833.415110-1-kan.liang@linux.intel.com> <996ec30b-2bcf-4739-bec0-728c7f7af2ac@linux.intel.com> In-Reply-To: <996ec30b-2bcf-4739-bec0-728c7f7af2ac@linux.intel.com> From: Ian Rogers Date: Tue, 12 Dec 2023 14:12:27 -0800 Message-ID: Subject: Re: [PATCH V2] perf top: Use evsel's cpus to replace user_requested_cpus To: "Liang, Kan" Cc: acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, maz@kernel.org, marcan@marcan.st, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 14:13:00 -0800 (PST) On Tue, Dec 12, 2023 at 1:25=E2=80=AFPM Liang, Kan wrote: > > > > On 2023-12-12 3:37 p.m., Ian Rogers wrote: > > On Tue, Dec 12, 2023 at 11:39=E2=80=AFAM wr= ote: > >> > >> From: Kan Liang > >> > >> perf top errors out on a hybrid machine > >> $perf top > >> > >> Error: > >> The cycles:P event is not supported. > >> > >> The perf top expects that the "cycles" is collected on all CPUs in the > >> system. But for hybrid there is no single "cycles" event which can cov= er > >> all CPUs. Perf has to split it into two cycles events, e.g., > >> cpu_core/cycles/ and cpu_atom/cycles/. Each event has its own CPU mask= . > >> If a event is opened on the unsupported CPU. The open fails. That's th= e > >> reason of the above error out. > >> > >> Perf should only open the cycles event on the corresponding CPU. The > >> commit ef91871c960e ("perf evlist: Propagate user CPU maps intersectin= g > >> core PMU maps") intersect the requested CPU map with the CPU map of th= e > >> PMU. Use the evsel's cpus to replace user_requested_cpus. > >> > >> The evlist's threads are also propagated to the evsel's threads in > >> __perf_evlist__propagate_maps(). For a system-wide event, perf appends > >> a dummy event and assign it to the evsel's threads. For a per-thread > >> event, the evlist's thread_map is assigned to the evsel's threads. The > >> same as the other tools, e.g., perf record, using the evsel's threads > >> when opening an event. > >> > >> Reported-by: Arnaldo Carvalho de Melo > >> Closes: https://lore.kernel.org/linux-perf-users/ZXNnDrGKXbEELMXV@kern= el.org/ > >> Reviewed-by: Ian Rogers > >> Signed-off-by: Kan Liang > >> --- > >> > >> Changes since V1: > >> - Update the description > >> - Add Reviewed-by from Ian > > > > Thanks Kan, quick question. Does "perf top" on hybrid ask the user to > > select between the cycles event on cpu_atom and cpu_core? > > Yes, but the event doesn't include the PMU information. > We probably need a follow up patch to append the PMU name. > > Available samples > 385 cycles:P > > 903 cycles:P Thanks and agreed, it isn't possible to tell which is which PMU/CPU type at the moment. I tried the patch with perf top --stdio, there wasn't a choice of event and I can't tell what counter is being displayed. When I quit I also see: ``` exiting. corrupted double-linked list Aborted (core dumped) ``` but I wasn't able to repro this on a debuggable binary/system. If my memory serves there was a patch where perf top was showing >1 event. It would be nice here to do some kind of hybrid merging rather than having to view each PMU's top separately. Thanks, Ian > Thanks, > Kan > > > I'm > > wondering if there is some kind of missing "hybrid-merge" > > functionality like we have for perf stat. > > > > Thanks, > > Ian > > > >> tools/perf/builtin-top.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c > >> index ea8c7eca5eee..cce9350177e2 100644 > >> --- a/tools/perf/builtin-top.c > >> +++ b/tools/perf/builtin-top.c > >> @@ -1027,8 +1027,8 @@ static int perf_top__start_counters(struct perf_= top *top) > >> > >> evlist__for_each_entry(evlist, counter) { > >> try_again: > >> - if (evsel__open(counter, top->evlist->core.user_reques= ted_cpus, > >> - top->evlist->core.threads) < 0) { > >> + if (evsel__open(counter, counter->core.cpus, > >> + counter->core.threads) < 0) { > >> > >> /* > >> * Specially handle overwrite fall back. > >> -- > >> 2.35.1 > >>