Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4773724rdb; Tue, 12 Dec 2023 08:58:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwf3pDCeTIPwA0kvrLbZCDbwE6PpJG9bI/qlrxJq4RQAg7ynTPzwyAuiqvTrJ0L657pZYo X-Received: by 2002:a05:6e02:1a89:b0:35d:5995:798d with SMTP id k9-20020a056e021a8900b0035d5995798dmr9832893ilv.39.1702400335659; Tue, 12 Dec 2023 08:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702400335; cv=none; d=google.com; s=arc-20160816; b=PECq0XC5fUDNFsUcm4Y2H8l0IT5GHP4WVy239Vqgmco9Yb+/Vs1At5VtCZ5I6+r+7e 1CX8j5bEHBNYDzBzs3rdbOsQupVTSViTf7owqD/ZUxtsw/aEMHitnzRnMZ7Ihq/yuBfV nm94QEgjf44yHhihcv31fHhfEflSJSPLLKh7FdBq2muRJmgBrgn05SoyVNxbMy821FXw cpNP3I0Yc6YKVl47YMZYfUW4Wf0v7IUDqmvH8H5IbRc3QTEVu2TFaMwIg09VcyT954Fi j1iw8YX/YhVpwMS7zMen6EV0VwTNwLxNLFlastvrMRj9FCf15xyHwHn31SfTlVjJOSyb EnfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OraIjAfHwq4p0f8wTSkxzgpgpreWbkcm/8xyQYCdH+I=; fh=8mLcDY8h4WKYjsJA++UaitLXZ/dYy/OIW7GX/NEmij8=; b=dT/9lQfutAfpO2jVvPWBQeOlelOGqSfkECtfpdFc5I4RH8imQPD38a298bVPwwPTTN Bv/HjtewoPfrf38njSrgflptXNzTIeLKorhxRk5IqaVYHf1gnRe3w1J3SfdkRgm4PLi8 /QuOsbtD6Kc/bl5Rv30WhniEO6WSjasR0pSWA9gL8926MheVncpLfaLQ0LIzVhndXM28 GUk/Vt1fnMkkHzm37Mvr428jerBIihcKQNQn8u0QIVlhKgBGwNCBl0fxhlFILYtgW16B 7W//8vi1NsmJeoa2vWj1V0PwI+ONnqvfKr/9tW/Y2TIwbljalDNcijJSCH7eQTKIcWac Wr4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pz2u2JcW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 37-20020a630c65000000b005c1c489bfc6si2706338pgm.627.2023.12.12.08.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 08:58:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pz2u2JcW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2B62780B01E9; Tue, 12 Dec 2023 08:58:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232635AbjLLQ6o (ORCPT + 99 others); Tue, 12 Dec 2023 11:58:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232836AbjLLQ63 (ORCPT ); Tue, 12 Dec 2023 11:58:29 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A4CA10A for ; Tue, 12 Dec 2023 08:58:29 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE528C433C7; Tue, 12 Dec 2023 16:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702400309; bh=rrQWZ1A81N+xvoxlWniD06E/uf4RebN93UVgpZ9UCHo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pz2u2JcWtMwrPBOxKXqS5CSu0XZDIJUcpx3rew6Rr5hah/eToJesFI+2XOrGEDrph Hftk7ZjYlwGRt9zGLEuqNKf21wO467cTLOLd790xfH0pmuTvecSD55jIjyiEj49naE a+1hOcPS36IFSosaWqE+aEKOG+ZzuswY4aHCyQh1O93jUn0ZgSemYf6uXQpNCR75ky U1cE6O1Ed6Q0PPLZZd+KHL7g1D9CdShda9XpscBudBV1zUdJ9JrBNEmZ084BczjbtS GK43eSBRssOGNo474ZWtDxByhyO7ZQJTc1GcWofm/Ypn0khu15KYsWv0O6dyIcXqlE PJGPdUKvmpScg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id CAD74403EF; Tue, 12 Dec 2023 13:58:24 -0300 (-03) Date: Tue, 12 Dec 2023 13:58:24 -0300 From: Arnaldo Carvalho de Melo To: "Liang, Kan" Cc: irogers@google.com, namhyung@kernel.org, mark.rutland@arm.com, maz@kernel.org, marcan@marcan.st, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH] perf top: Use evsel's cpus to replace user_requested_cpus Message-ID: References: <20231208210855.407580-1-kan.liang@linux.intel.com> <07677ab2-c29b-499b-b473-f7535fb27a8c@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <07677ab2-c29b-499b-b473-f7535fb27a8c@linux.intel.com> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Tue, 12 Dec 2023 08:58:54 -0800 (PST) Em Tue, Dec 12, 2023 at 10:56:15AM -0500, Liang, Kan escreveu: > > > On 2023-12-11 4:13 p.m., Arnaldo Carvalho de Melo wrote: > > Em Fri, Dec 08, 2023 at 01:08:55PM -0800, kan.liang@linux.intel.com escreveu: > >> From: Kan Liang > >> > >> perf top errors out on a hybrid machine > >> $perf top > >> > >> Error: > >> The cycles:P event is not supported. > >> > >> The user_requested_cpus may contain CPUs that are invalid for a hybrid > >> PMU. It causes perf_event_open to fail. > > ? > > All perf top expects is that the "cycles", the most basic one, be > > collected, on all CPUs in the system. > Yes, but for hybrid there is no single "cycles" event which can cover > all CPUs. Perf has to split it into two cycles events, 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 the reason perf > top fails. So perf should only open the cycles event on the > corresponding CPU. Great explanation, please make sure it is present in the fix, i.e. in the v2 you mentioned. > >> The commit ef91871c960e ("perf evlist: Propagate user CPU maps > >> intersecting core PMU maps") already intersect the requested CPU map > >> with the CPU map of the PMU. Use the evsel's cpus to replace > >> user_requested_cpus. > > > >> The evlist's threads is also propagated to evsel's threads in > >> __perf_evlist__propagate_maps(). Replace it as well. > > > > Thanks, but please try to add more detail to the fix so as to help > > others to consider looking at the patch. > > OK. For the threads, the same as other tools, e.g., perf record, perf > appends a dummy for the system wide event. For a per-thread event, the > evlist's thread_map is assigned to the evsel. So using the evsel's > threads is appropriate and also be consistent with other tools. > > I will update the description and send a V2. > > Thanks, > Kan > > > > > - Arnaldo > > > >> Reported-by: Arnaldo Carvalho de Melo > >> Closes: https://lore.kernel.org/linux-perf-users/ZXNnDrGKXbEELMXV@kernel.org/ > >> Signed-off-by: Kan Liang > >> --- > >> 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_requested_cpus, > >> - top->evlist->core.threads) < 0) { > >> + if (evsel__open(counter, counter->core.cpus, > >> + counter->core.threads) < 0) { > >> > >> /* > >> * Specially handle overwrite fall back.