Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp67068rdg; Tue, 10 Oct 2023 04:38:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0wf2lEbJk0wo669VAajp3oSw2ejQUvZAMJQ8f5+UOvlTB9uyNSoRAIUsLi2GxGB5M1el+ X-Received: by 2002:a05:6e02:b2b:b0:351:4f0c:b966 with SMTP id e11-20020a056e020b2b00b003514f0cb966mr21797865ilu.20.1696937911511; Tue, 10 Oct 2023 04:38:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696937911; cv=none; d=google.com; s=arc-20160816; b=qojeNyW5ZBPAVhCB0bHJZ8lK7IywqqPvU6pZVY5+fjsik6wsNWW12UTXuHGfrvFLB8 In9BW8uS/RH/CKha7g1d/Za1iOEEFhyZoj5R1irrHw8NNMoAl9Zr0HBwTA4EYmZLx3f6 opZoV+8QLsj90mE18FKYu0/Aa3TIcYDO39Ji2G9P+D4XM6o8J+lfUfIu9Nslrbtv+pvi qCh/KPRnjtR57kQEe3zO9OBNYNNfXfnvlmYMothAFjkunykfSq9+eO40Zr3Ds6QOPjJK iGGz1oAZ1kO+Y35VN5Hn1VB8XHts96cOdzDVhq7FGZBXVc97jYQc3mdbSsThxYOfG2pa HkYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=S+nmikVi7tyVuTbMnTWSCD6YoSHx8qb9kD1izzk34PE=; fh=jcYQpEhkBS2zk3fYoXU13qykgAAZkoF7HIHYbvM0Wiw=; b=FybItIR1YqUNolUZKOpaYDvuoKckcdUhH0ZDjE0fXETdVtn1DsKweNL+/zPPgiHvsM VWsodMud98JBQI+vNHwfG/E+wR+DzY91apSIgrTPQccaneKWwMpNAI+EJcRuOiZw4Zj/ WF0k2in2uJffTXLlAYBUIcoopbOhkfLJ/duPZkfOP5ac3chVOzn/3Ko6cdQqUjrY33Kc 4sx5FqgXO/naVpjXqziVsZtqQ1+3vaHDJChR1LWG4rszvanNe48r71G5gSSSYA0K98nv ON19eh5KbF4XseOnqZOH0gNL/OyJgB6ubqHo+JWdXPsGjdkZMoIJ+UadidgA8aZ8RorN s1Pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id by9-20020a056a02058900b00584af3ee495si13539099pgb.623.2023.10.10.04.38.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 04:38:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 645058159627; Tue, 10 Oct 2023 04:38:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231236AbjJJLi1 (ORCPT + 99 others); Tue, 10 Oct 2023 07:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229921AbjJJLi1 (ORCPT ); Tue, 10 Oct 2023 07:38:27 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C8CC94 for ; Tue, 10 Oct 2023 04:38:25 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F2A0F1FB; Tue, 10 Oct 2023 04:39:05 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 751713F7A6; Tue, 10 Oct 2023 04:38:24 -0700 (PDT) Message-ID: Date: Tue, 10 Oct 2023 12:38:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drivers: perf: arm_pmuv3: Update 'pmc_width' based on actual HW event width Content-Language: en-GB To: Anshuman Khandual , linux-arm-kernel@lists.infradead.org Cc: Will Deacon , Mark Rutland , linux-kernel@vger.kernel.org References: <20231009043724.175100-1-anshuman.khandual@arm.com> From: Robin Murphy In-Reply-To: <20231009043724.175100-1-anshuman.khandual@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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, 10 Oct 2023 04:38:30 -0700 (PDT) On 09/10/2023 5:37 am, Anshuman Khandual wrote: > This updates 'perf_event_mmap_page->pmc_width' based on actual HW event's > width that are currently missing i.e ARMPMU_EVT_63BIT and ARMPMU_EVT_47BIT. > > Cc: Will Deacon > Cc: Mark Rutland > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > This applies on v6.6-rc5. > > drivers/perf/arm_pmuv3.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c > index fe4db1831662..94723d00548e 100644 > --- a/drivers/perf/arm_pmuv3.c > +++ b/drivers/perf/arm_pmuv3.c > @@ -1375,6 +1375,10 @@ void arch_perf_update_userpage(struct perf_event *event, > if (userpg->cap_user_rdpmc) { > if (event->hw.flags & ARMPMU_EVT_64BIT) > userpg->pmc_width = 64; > + else if (event->hw.flags & ARMPMU_EVT_63BIT) > + userpg->pmc_width = 63; > + else if (event->hw.flags & ARMPMU_EVT_47BIT) > + userpg->pmc_width = 47; I think this will give the wrong behaviour in at least some cases - if the user has not requested a "long" event which would lead to ARMPMU_EVT_64BIT being set, we will bias the values to only count 32 effective bits regardless of how wide the physical counters are. I believe this is what "the valid width of the counter" in the documentation is trying to refer to. Thanks, Robin. > else > userpg->pmc_width = 32; > }