Message ID | 20240420151741.962500-11-atishp@rivosinc.com |
---|---|
State | Accepted |
Headers | show
Return-Path: <kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ckFcUR5G; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=GNYWwoa7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VLrv970hYz1yZP for <incoming@patchwork.ozlabs.org>; Sat, 20 Apr 2024 09:48:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wpjzRn/TGRh2uiAy+TlEAqqaXY6+OBbqmeU8WVh1JcU=; b=ckFcUR5Geci/CN 57e6AztURGXDD+sfmA5VAtaHoMIViQ2AvxTuwJMyBBZGxuYHVnCeNkUNpmAi37fdfog2GBWP4wrXi i85oAhIvLmihb5I3zruTO5oMlE3sbdjxiJ6Kamkb19h4pYWbassvgnQLERdZrqCvANoRs3JTU3Jh9 2hBDy0i58p8W7SEvTIHqjooxTdkd/a5rOVbu1tPF32PfBsVHNuXHVyPLMvEFHlXS9mWJvgT0qkXg5 OydopXf38kmgurEL79ES7nLWp89at4bQ3vFKe1Uncn4kheQLnvf/WX0teEj+89onboOptYs734UHl OCyARvpnvJO0Ah/fwVSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxxy8-00000007JDC-1axm; Fri, 19 Apr 2024 23:48:36 +0000 Received: from mail-pg1-f181.google.com ([209.85.215.181]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxxxd-00000007Ijk-1I1P for kvm-riscv@lists.infradead.org; Fri, 19 Apr 2024 23:48:08 +0000 Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-5ce6b5e3c4eso1621243a12.2 for <kvm-riscv@lists.infradead.org>; Fri, 19 Apr 2024 16:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713570483; x=1714175283; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N3Hu7DESDZEmcgrq2jc0sr2sorL47aa7h3H8SzaxXXM=; b=GNYWwoa72yAGZAy/nUmru4ZMq9a0VCLldTlag4YjVzuFYHJX5UiySzkHegsnpxIFpy MvU9RyOcUAIFWpZ6l1NIglTJT/evG4GOwXnORsx+8hfU4svQoeAxv3sBm8wpiBb9TQS2 5m0ztgc+LjANHeX6PO81Lpn1c/t9z1UGTwrlfLiAx5ATbTZJLANu5869pvRdX8TQggw1 WcAsoqr2tcBuxct510GBdajfI+bTgbxYZK2fC+T0kjGZkuRIK6PsCqHR6LTju0jvh6V1 kdtgbic8BksZiOCsuxbhhNoWDM8JSDCHQWDjgZgrILEsrVqVm+9CdE0qgZ2bFLh7oeA8 vr0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713570483; x=1714175283; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N3Hu7DESDZEmcgrq2jc0sr2sorL47aa7h3H8SzaxXXM=; b=XzPVqI45hk7zoIYHm7sSNEk3cDDcMsuUwgt1xiOQZl1M9tk/5Cj0xj5g9t7s/rRZhC JCOYOOnT+a+zjgNt81goIoCmJMsTE6lQ9DcDYfqayQxrAazDl0PAD7COKNlmtuAGycqN IVSscGdO0NIxfTpEJ0bJSywop11JXt9qGLV6OGbZtk+OQ3rQgerkyHX2wo8lH1scdWIy eTsG9DcRUulT7tO4JNtiXKASuuKruUsPHLskX143VF71zVE7xqQhrhNVaKlqnysV2ffg Ub5UM1olW83y4XYXjkvTobmJowyB0lHPMsDthfuDvd7wkmiDWvB74FJiLCHR2cIDOgri OKyw== X-Forwarded-Encrypted: i=1; AJvYcCWKfEfY4lg8w6FB/f6UVDA13oCdKlkGycW4JgiHouQWEw+PQoyeRdF+wQfLI/ql6b1crl7rFuohn8uxKMKdoez4I6OjK31F/PVUOiMYvA== X-Gm-Message-State: AOJu0Ywcgy9psunREBjSE6EzKjt3B3ac+ZymZ21XtJvpdNu/J3WZzerw DXEdNq3ZWe3CEudmUgqIWfpHCbfg2HqR88PUI9zYjkFlqvCjzm7Qh/4EOahg1ME= X-Google-Smtp-Source: AGHT+IFuxivVAucFqLYqwANgIIbEmyPV0tNMGWLxqaH8776sBq/Go9KZec7LTwKbbmPafjRvAwUZ5w== X-Received: by 2002:a17:903:22ca:b0:1e5:2ba9:a667 with SMTP id y10-20020a17090322ca00b001e52ba9a667mr4212130plg.3.1713570483020; Fri, 19 Apr 2024 16:48:03 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id w17-20020a170902d11100b001e42f215f33sm3924017plw.85.2024.04.19.16.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 16:48:02 -0700 (PDT) From: Atish Patra <atishp@rivosinc.com> To: linux-kernel@vger.kernel.org Cc: Atish Patra <atishp@rivosinc.com>, Andrew Jones <ajones@ventanamicro.com>, Ajay Kaher <ajay.kaher@broadcom.com>, Albert Ou <aou@eecs.berkeley.edu>, Alexandre Ghiti <alexghiti@rivosinc.com>, Anup Patel <anup@brainfault.org>, samuel.holland@sifive.com, Conor Dooley <conor.dooley@microchip.com>, Juergen Gross <jgross@suse.com>, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland <mark.rutland@arm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Paolo Bonzini <pbonzini@redhat.com>, Paul Walmsley <paul.walmsley@sifive.com>, Shuah Khan <shuah@kernel.org>, virtualization@lists.linux.dev, Will Deacon <will@kernel.org>, x86@kernel.org Subject: [PATCH v8 10/24] RISC-V: KVM: Fix the initial sample period value Date: Sat, 20 Apr 2024 08:17:26 -0700 Message-Id: <20240420151741.962500-11-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240420151741.962500-1-atishp@rivosinc.com> References: <20240420151741.962500-1-atishp@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240419_164805_506334_72A922DF X-CRM114-Status: GOOD ( 11.35 ) X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The initial sample period value when counter value is not assigned should be set to maximum value supported by the counter width. Otherwise, it may result in spurious interrupts. Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Atish Patra <atishp@rivosinc.com> --- arch/riscv/kvm/vcpu_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Content analysis details: (2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.215.181 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.215.181 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 2.5 DATE_IN_FUTURE_12_24 Date: is 12 to 24 hours after Received: date X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <kvm-riscv.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/kvm-riscv>, <mailto:kvm-riscv-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/kvm-riscv/> List-Post: <mailto:kvm-riscv@lists.infradead.org> List-Help: <mailto:kvm-riscv-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/kvm-riscv>, <mailto:kvm-riscv-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kvm-riscv" <kvm-riscv-bounces@lists.infradead.org> Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
RISC-V SBI v2.0 PMU improvements and Perf sampling in KVM guest
|
expand
|
On Sat, Apr 20, 2024 at 5:18 AM Atish Patra <atishp@rivosinc.com> wrote: > > The initial sample period value when counter value is not assigned > should be set to maximum value supported by the counter width. > Otherwise, it may result in spurious interrupts. > > Reviewed-by: Andrew Jones <ajones@ventanamicro.com> > Signed-off-by: Atish Patra <atishp@rivosinc.com> LGTM. Reviewed-by: Anup Patel <anup@brainfault.org> Regards, Anup > --- > arch/riscv/kvm/vcpu_pmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/kvm/vcpu_pmu.c b/arch/riscv/kvm/vcpu_pmu.c > index 86391a5061dd..cee1b9ca4ec4 100644 > --- a/arch/riscv/kvm/vcpu_pmu.c > +++ b/arch/riscv/kvm/vcpu_pmu.c > @@ -39,7 +39,7 @@ static u64 kvm_pmu_get_sample_period(struct kvm_pmc *pmc) > u64 sample_period; > > if (!pmc->counter_val) > - sample_period = counter_val_mask + 1; > + sample_period = counter_val_mask; > else > sample_period = (-pmc->counter_val) & counter_val_mask; > > -- > 2.34.1 >
diff --git a/arch/riscv/kvm/vcpu_pmu.c b/arch/riscv/kvm/vcpu_pmu.c index 86391a5061dd..cee1b9ca4ec4 100644 --- a/arch/riscv/kvm/vcpu_pmu.c +++ b/arch/riscv/kvm/vcpu_pmu.c @@ -39,7 +39,7 @@ static u64 kvm_pmu_get_sample_period(struct kvm_pmc *pmc) u64 sample_period; if (!pmc->counter_val) - sample_period = counter_val_mask + 1; + sample_period = counter_val_mask; else sample_period = (-pmc->counter_val) & counter_val_mask;