Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1201463rdg; Fri, 13 Oct 2023 13:26:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQEeX6blVdZuriBM6tt5Afmunhc4szoaSJBM9RAJrVpTLSXQm83PeOQPzreL/sTmgrALWK X-Received: by 2002:a17:902:a504:b0:1c6:17a4:afb3 with SMTP id s4-20020a170902a50400b001c617a4afb3mr22370413plq.16.1697228797099; Fri, 13 Oct 2023 13:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697228797; cv=none; d=google.com; s=arc-20160816; b=gjI6xToY4G655DU0eWRj1N4zwQZJdKvsjueaTc9KhnxEachhkhyZ6xtl5etMYR2V+G VuCwbuts1W6JQhRrudtSwsxDxpzO6KOP4o1zxWDmgMDeuB4lgaYm0VMVSVrfnAoDslqs 8T13gYJ0Mr9uDlgiVe5svyoanlcFxge/VlswecFR1Uuhfwj1oC1ec8btXzCczdbnTZgR psc0CtnTKTb5DfR6LHqCkZifTJf3vRrUJPi2dms96P5m+LE1WJhf7jScL+qZ8NnrGQHl bUn/Rl9MvCXQh+CNELHC53OVzyIqoQRucLo+GnTAIO6LuFD/OnD+EaZOcYwyUw1ZsBHc mVDQ== 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=pqAeTW3JeHR2NgxF+OPMVJ48NQjtKJfCWCw4Wwse+lk=; fh=dMrWgnXzzePbjJ5Lnz3JQ1FNdAF92uv7SkGdCptz9bs=; b=tMFnbeXP/U9n1RHFASLYVF070lUm1efuj5KQtd8+QE19fY9mfBYzjSyrIgJQwK1ZTs m5FyHxAVazOuWxEdqQ9qnk+1m7aCH/MY191Mwgj8EsIQL7mrlBradM1fq/q8MubfMVas GCmJuLh4j/wLDrpayrCPZ+GkMRYZ0saCgpjPSm7/pIPj5idJ0icUpktCju+hgbW7Sh9J kq2PQzTQf3v7roiqJVEMyRmpsnQGftAw6oaW+SyRQpu6eivOOE7BtRvAbyKTL8XUT3hs WRt2ScpKDJYTQSezyk2I0gsDb4hFIIOhDHn2SV9pq5Gci3WN481pS9Sb37yA51n/xrsM Ed7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YUvVFEkC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id t16-20020a170902e85000b001c61bd9db5csi5671561plg.317.2023.10.13.13.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 13:26:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YUvVFEkC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 4884180756D7; Fri, 13 Oct 2023 13:25:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231978AbjJMUZI (ORCPT + 99 others); Fri, 13 Oct 2023 16:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbjJMUZH (ORCPT ); Fri, 13 Oct 2023 16:25:07 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4BB5B7 for ; Fri, 13 Oct 2023 13:25:05 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3529f5f5dadso8965ab.0 for ; Fri, 13 Oct 2023 13:25:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697228705; x=1697833505; 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=pqAeTW3JeHR2NgxF+OPMVJ48NQjtKJfCWCw4Wwse+lk=; b=YUvVFEkCKzorMIna/Vc6KCU1QJlmsb7SiSv2V9G9SWvpzhnR/IrMOhSjhHBRsMDO4T 1EzbPu3QmL9V6WIHayTOH4DvQkeSmH+zJRsBu5OzLQv3GYOmaQkzS585lLVrSKGdBrZN 1i4CAAdU2EicMjBaIcKI/AbvaGEmNU2326XqCqaxUkUSrXA8HYF7Owgd54BvMUE2Ra1m 7J27Y1nZosMp2ppZwFvwN5218AV1EKzzYfmnNTrbUTSMpUknXtcbfC1uVTsyoSd8G8NK PE60CABFa1cuBuNR1tIA6vstyrVCFz+qWr2LaLphMPktm6V0V5+3EGhgCwFQyY9BS0BO O9aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697228705; x=1697833505; 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=pqAeTW3JeHR2NgxF+OPMVJ48NQjtKJfCWCw4Wwse+lk=; b=Aa6LCIfuM/aP0xrYRckNHcabecvlg1R9TQCEcp+Ayygug4FdYTVT8Ej/BS1EnG1svN eiMTHsa/mQRzw3Rjf1pPkPxWbTT+DKOZhh8PHwbttcK5qftLm8qeVJWBInHNufka3bnS vP0umaLfqJoqAwDWIkEMj56kf55cGrp3RAk+kzrM0cWObEAZGgAmMeJUtuhTT10BvL56 Cy5ae37IYPY9PdgbV4CRnAK0QwxEFQEWHNGgOwhBsfdMFsNgqDYEd5x6ugDousdafQRr PjHHNQvfzKILOSH43rur0BV4vMpaDY1kUfJeT29t/HlCNq8hxrnHkMrS/Gy6141bur2I 0rbg== X-Gm-Message-State: AOJu0YyM8JBaMjdnDxq+zf/QX3ytvFFtpu7WzZ5i3Otea0eq8SypLciE m1lSrnHjTCFeRJR95FOGXDkWvJ9wq0MK1ZDLh61svw== X-Received: by 2002:a05:6e02:220e:b0:351:efb:143d with SMTP id j14-20020a056e02220e00b003510efb143dmr29195ilf.22.1697228704929; Fri, 13 Oct 2023 13:25:04 -0700 (PDT) MIME-Version: 1.0 References: <20231009230858.3444834-1-rananta@google.com> <20231009230858.3444834-7-rananta@google.com> In-Reply-To: From: Raghavendra Rao Ananta Date: Fri, 13 Oct 2023 13:24:52 -0700 Message-ID: Subject: Re: [PATCH v7 06/12] KVM: arm64: PMU: Add a helper to read the number of counters To: Oliver Upton 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 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,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]); Fri, 13 Oct 2023 13:25:18 -0700 (PDT) Hi Oliver, On Thu, Oct 12, 2023 at 10:43=E2=80=AFPM Oliver Upton wrote: > > 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, in= t 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, no= t > > the limit. > > > > Maybe kvm_arm_pmu_get_max_counters()? > Sure, kvm_arm_pmu_get_max_counters() it is! > 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. > Sounds good. I'll squash patches of this type into the caller patches. Thank you. Raghavendra > -- > Thanks, > Oliver