Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3366066rwo; Mon, 24 Jul 2023 09:56:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlFa1VGZVs+cWVH1SONXKMGUGWJbr3+SsY6zE9t092PtPxBiEf3xI071P2xCTWivzMDnWZPV X-Received: by 2002:a05:6a20:4321:b0:138:1a36:4eab with SMTP id h33-20020a056a20432100b001381a364eabmr15509657pzk.3.1690217812308; Mon, 24 Jul 2023 09:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690217812; cv=none; d=google.com; s=arc-20160816; b=uqqTkAzDKml0oe1FPkJ7yVoRNeurHlSJYcPqxUACSzAOTvfeKP08N+N8/95mxY/ZU2 RE3sWYHAKsm3PmA6XBjRs2xHJh/ufmkzBeztPYM8X5MRde+CfvcZlCFaeSSvZGqDU5mK H1gF0mwsmbonBvcfU0dDVYsPTkF0M1qWAMaikkqsk29aGhBgmZwfzAayL496ekaHkh3h oXUdUaLBdBjiluzCog8ENyJ43C50qTR4Bzq4CC6w7Kx45kyd1J+LCUDeNZI2NgbzmD0v 8MfSyvuAQdwJLJ8HWyuCI3WHdAeR5iFXB58+bxUHph9b7tbxU2asZVdgWklHv1OG9Ymr s2cA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kyRVGdF/S8JwacoaRvTJTrXy1HDwCY6PsGgJkT6ZBH8=; fh=9lqpMl8vWH1hAUZ4LuD+AO7+MQBYyIMMUdN3laO0aZA=; b=SKaN9atLfq7jVysqNlGc6BUsBFZ52CmRdcKuwxO9KOm+ofGcpSGK8JOHLSBRyUzeou 9uyvbqDxUw4nz0dJtei9XaEJokOVpyiD++JsqhElAnrAcRf1NIWRHNNQN786vLv0FRRg dQjQA7uGh2tES+Hjcm2YxDu/E914wkjvxxNUr2nKzsyHGhaPUSb26i5r2Qmk4dY7DBtS zdBGDYB2QgeR7VnA0OhLWR0LST66iAe1QcdHTWd4PY+Uak0PzAvnGXDzE3uuJgfJCqDh gA0kUVIol+zRDKN23Befv7I0rRFYnYyQD24edGXvWu77iCG1xnhBffSUBg4Oy4SOzL5z CQ8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s6eYP1Xz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a056a00180e00b0067eeaacd277si9843626pfa.124.2023.07.24.09.56.39; Mon, 24 Jul 2023 09:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s6eYP1Xz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231526AbjGXQlt (ORCPT + 99 others); Mon, 24 Jul 2023 12:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231496AbjGXQls (ORCPT ); Mon, 24 Jul 2023 12:41:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3096C10D3; Mon, 24 Jul 2023 09:41:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 783336127C; Mon, 24 Jul 2023 16:41:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB0FAC433C9; Mon, 24 Jul 2023 16:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690216904; bh=slY2K6qUOwPVZDMW1XxpN8Wk8aylahbaAaTLXnyOJ6k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s6eYP1XzTniWCT9wWlRFkQ/ubGlokLLoGu1+cHpeAzSMZPl8+SKFaI+FiqCxP8hEs O1ZuNLGqlqTTPoREWhELqmcTt9JH4couhmX2cXVPOhgwzSiOZPxM2kPMnR4nEHYo2c YIrsu1oehctcBzhBfrhdFDtjv7yfr8fZjY4y97TSRJRnBN0ZgkOgSdIYzL6LA0vG+m 4lRylbMPK1GnwVGTEFsjFyDhvOZ8e3zuPnr2+f3AmPwcNp4vUa/W0e1HSa4cNOKsf1 GIgFXIqqT50ipBGJSUktQgLfXD2r169xCOYQaIbWWS1GPgB28ZbmFMWmbyu3E3EHwq kSfH3MB5Vcfdg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id C73F240516; Mon, 24 Jul 2023 13:41:41 -0300 (-03) Date: Mon, 24 Jul 2023 13:41:41 -0300 From: Arnaldo Carvalho de Melo To: James Clark , Jing Zhang Cc: Haixin Yu , John Garry , Will Deacon , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf arm64: Fix read PMU cpu slots Message-ID: References: <2e392aa9-859a-75ef-eb3e-1870b1e78061@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2e392aa9-859a-75ef-eb3e-1870b1e78061@linux.alibaba.com> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Em Mon, Jul 24, 2023 at 03:40:12PM +0800, Jing Zhang escreveu: > > > 在 2023/7/24 下午1:06, Haixin Yu 写道: > > Commit f8ad6018ce3c ("perf pmu: Remove duplication around > > EVENT_SOURCE_DEVICE_PATH") uses sysfs__read_ull to read a full > > sysfs path, which will never success. Fix it by read file directly. > > > > Signed-off-by: Haixin Yu > > --- > > tools/perf/arch/arm64/util/pmu.c | 7 ++++--- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/tools/perf/arch/arm64/util/pmu.c b/tools/perf/arch/arm64/util/pmu.c > > index 561de0cb6b95..512a8f13c4de 100644 > > --- a/tools/perf/arch/arm64/util/pmu.c > > +++ b/tools/perf/arch/arm64/util/pmu.c > > @@ -54,10 +54,11 @@ double perf_pmu__cpu_slots_per_cycle(void) > > perf_pmu__pathname_scnprintf(path, sizeof(path), > > pmu->name, "caps/slots"); > > /* > > - * The value of slots is not greater than 32 bits, but sysfs__read_int > > - * can't read value with 0x prefix, so use sysfs__read_ull instead. > > + * The value of slots is not greater than 32 bits, but > > + * filename__read_int can't read value with 0x prefix, > > + * so use filename__read_ull instead. > > */ > > - sysfs__read_ull(path, &slots); > > + filename__read_ull(path, &slots); > > } > > > > return slots ? (double)slots : NAN; > > Yes, the function perf_pmu__pathname_scnprintf returns the complete slots file path "/sys/bus/xxxxx/caps/slots", > and sysfs__read_ull will add the prefix "/sys" to the path, so the final file path becomes "/sys/sys/bus/xxxx/caps/slots" > which does not exist, and the slots file cannot be successfully read, so sysfs__read_ull needs to be changed to the > filename__read_ull. > > I tested it and it works well. > > Tested-by: Jing Zhang I've applied this to my local branch, thanks. I also added the missing: Fixes: f8ad6018ce3c065a ("perf pmu: Remove duplication around EVENT_SOURCE_DEVICE_PATH") This is another case where a 'perf test' entry would come in handy. James, please check and ack, - Arnaldo