Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp748393rdg; Thu, 12 Oct 2023 22:43:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqW8r2JxzEjjXe7rM6wQVdL+/zoT+nr67tfG1JbdW5x4Uu+S19vkfrISY++f88xLguTMV4 X-Received: by 2002:a0d:e2d4:0:b0:5a7:c646:b3ed with SMTP id l203-20020a0de2d4000000b005a7c646b3edmr10206838ywe.34.1697175800717; Thu, 12 Oct 2023 22:43:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697175800; cv=none; d=google.com; s=arc-20160816; b=J3dy4oXf31cGOaSn6W2glPsSiUCeCf8Iyljv6DOV58AzmShjyWn7UVumVRDUcPoAUC s36LSWOiMHzzdA5GG4lJKX/N8rhttpuBXYOAJeujaTLcUC4XSUIYBw3r5hbJyVLnC3yx qxeiUTRaXlgQ6wgWaktK8WtYZdXaUBO1cGjGS4v7B4vUj0cvQxfGeuQqrItA/s0R1JZd +z8UsduAQelka+bCSXMJRbaiTsr6dgHhJLTicMph+CyZoANIv6wbW7WleZu6dAkOuzNR 3PFprUvjiSPaizSwvgYOM+fqATBvWzYpty5WupjfcbvaFy/YalPUn4C08SnNZ+jPHYHb ULug== 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:dkim-signature:date; bh=kNOrYS3RMfC5VKdrToezk3EhKhJLCblPKD1dYpu7e7w=; fh=4I6BNv7iobpZrRcbueKA7r9RD02xPQmynyU/PeDFguM=; b=Cvr0/fae8ppCEQD9KuwLcENpTZ1XF3jgGiyqbJQUhKX96i/t8de1dcpMdOvPwfNfRn 1ZvQyfCnz5GeOD+WRa3Jy1KpLvbyGvZIk7dxBXpk73Rc58tKj5ccexonR5QTFC2sYgIL IYY43lH+QKkQ+EbM9xCEXj5zVjEWhqz0h4lkxa1/W0VS2XEs36bWZGMh4oDXHoqlsP5v noOESDopvuXzfnpF8AvrjXq8XbfOcnODhxEwuc0HoKSUrKCcz6d7rLXW/SzbIsio6Vwx gPXREDKoNsJdzRLwQYuB7I5ufRSd/1tBOSD68MHEMN/TO2n4ausryYBQEBLHHaBZgN8v RETg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=jkgwCzZd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e7-20020a056a001a8700b0069100a207c2si16703902pfv.300.2023.10.12.22.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 22:43:20 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=jkgwCzZd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BA70281D2D7B; Thu, 12 Oct 2023 22:43:19 -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 S229676AbjJMFnL (ORCPT + 99 others); Fri, 13 Oct 2023 01:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbjJMFnK (ORCPT ); Fri, 13 Oct 2023 01:43:10 -0400 Received: from out-210.mta0.migadu.com (out-210.mta0.migadu.com [IPv6:2001:41d0:1004:224b::d2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B592DB8 for ; Thu, 12 Oct 2023 22:43:08 -0700 (PDT) Date: Fri, 13 Oct 2023 05:43:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697175786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kNOrYS3RMfC5VKdrToezk3EhKhJLCblPKD1dYpu7e7w=; b=jkgwCzZdgR6Cy7Nxg0J2L6ZbhwD2AYaH05MjAPmavXrL+f/Ted3isynWFPqLew/aumeUEm 0A1hjn4ytpw3uAB3ndcMAWlioMqa34wozVbL7CpE6XgPmcHcZRTdpRd2ru0zGHDlTPekzM amc7Z8vcQfHQ7nsCKnjdzfQtdWaHjNc= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Raghavendra Rao Ananta Cc: Marc Zyngier , Alexandru Elisei , James Morse , Suzuki K Poulose , Paolo Bonzini , Zenghui Yu , Shaoqin Huang , Jing Zhang , Reiji Watanabe , Colton Lewis , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v7 06/12] KVM: arm64: PMU: Add a helper to read the number of counters Message-ID: References: <20231009230858.3444834-1-rananta@google.com> <20231009230858.3444834-7-rananta@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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]); Thu, 12 Oct 2023 22:43:19 -0700 (PDT) On Tue, Oct 10, 2023 at 10:30:31PM +0000, Oliver Upton wrote: > On Mon, Oct 09, 2023 at 11:08:52PM +0000, Raghavendra Rao Ananta wrote: > > Add a helper, kvm_arm_get_num_counters(), to read the number > > of counters from the arm_pmu associated to the VM. Make the > > function global as upcoming patches will be interested to > > know the value while setting the PMCR.N of the guest from > > userspace. > > > > Signed-off-by: Raghavendra Rao Ananta > > --- > > arch/arm64/kvm/pmu-emul.c | 17 +++++++++++++++++ > > include/kvm/arm_pmu.h | 6 ++++++ > > 2 files changed, 23 insertions(+) > > > > diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c > > index a161d6266a5c..84aa8efd9163 100644 > > --- a/arch/arm64/kvm/pmu-emul.c > > +++ b/arch/arm64/kvm/pmu-emul.c > > @@ -873,6 +873,23 @@ static bool pmu_irq_is_valid(struct kvm *kvm, int irq) > > return true; > > } > > > > +/** > > + * kvm_arm_get_num_counters - Get the number of general-purpose PMU counters. > > + * @kvm: The kvm pointer > > + */ > > +int kvm_arm_get_num_counters(struct kvm *kvm) > > nit: the naming suggests this returns the configured number of PMCs, not > the limit. > > Maybe kvm_arm_pmu_get_max_counters()? Following up on the matter -- please try to avoid sending patches that add helpers without any users. Lifting *existing* logic into a helper and updating the callsites is itself worthy of a separate patch. But adding a new function called by nobody doesn't do much, and can easily be squashed into the patch that consumes the new logic. -- Thanks, Oliver