Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2064643lqt; Sun, 21 Apr 2024 23:27:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWxmtfXKTCJ4sTUSGqvQrmR0ueS0nGtdYwa1v6ZDGTwpAiO7BAihTYbRDCNdvq9fi40UUP+PuMYDIdFZAeDgbXD7Bcj+TbUJuiIs3QM0w== X-Google-Smtp-Source: AGHT+IH5iKoNn883sv+yfZpUsxXq1oM/E54zScAzgOQOA6N2PbAHrX9Uasnk5hfLwQH2ohYQqDsv X-Received: by 2002:a05:6808:2804:b0:3c7:41ba:102f with SMTP id et4-20020a056808280400b003c741ba102fmr10435655oib.34.1713767226932; Sun, 21 Apr 2024 23:27:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713767226; cv=pass; d=google.com; s=arc-20160816; b=BmJlAY3t6CocRc5GvyEFtvAE5NAXuAftL4y/cDDt6PKoye08BDr+CMr6FY1cuKtxVm mbWEJC1acGiUMeKVAaiVUoRXSPhFp/VXdvbdSqSR7zWklqmojeCYmzAjwTAwe6ABkZ0Z lknXPxAKbTo2HcSRwbfTwF37lLQ2REe2gXo9SHzZss9w7hL8tRInjJJfVQ1lgzhGn0GX eEdhebJybxlWpeSEryS45FyMX73EwZ7sUQdfMk3gMA0YhqHIPIq8dK50oHwbnijwxsYX ZnuKCuhaic9IOQJrgma2j3JeDyptwexMJKOurs2GWozUgpbinOo33+Y2aBpOP5X6JRsh ty1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=dF7iMXOY4VDDCKv5qNAPNo7XCDSpEYvkOWLnZnfiQso=; fh=A4o1dfTWrAjNg1kbsgLVw4fFrmHsgZRIuWsPcb89/Ww=; b=0f0cm5TmH7bSmpcWP8O9afUrxBs4O4/TPP8bBZ987DOhQg/BzIKaIdUS3PRSaQGZlM 1UHXbWOfkSSbZA5FC+dq4op+OZhR3nm49P3RLTB6UKVTZi+i+dm3t3z6Ze2xIb6VNbb+ YirsrsAhsqY33oN1xHHBm2KClnZ79DV/eUo5fPf/L9BI/m2di/8nc4oa2hYWztuQOKlD p81dvnb0D5xfmYMdSUuCZ3yUMcd+rlJxiCtK77Pp7+yOL9dHHS49lPtgQ10Dal57d/lS LbCnURIdI6RNnsqrW2hgb6wWB6+Q8KxFGfWPQ07+jVATIbm0JjOl0xyrUSjUvU8f+FdA d7Ww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@brainfault-org.20230601.gappssmtp.com header.s=20230601 header.b=QTcc38Hv; arc=pass (i=1 dkim=pass dkdomain=brainfault-org.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-152738-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152738-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a191-20020a6390c8000000b005f7fef1efe7si5317003pge.307.2024.04.21.23.27.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 23:27:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-152738-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@brainfault-org.20230601.gappssmtp.com header.s=20230601 header.b=QTcc38Hv; arc=pass (i=1 dkim=pass dkdomain=brainfault-org.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-152738-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-152738-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DC0BAB212E4 for ; Mon, 22 Apr 2024 05:25:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB96518645; Mon, 22 Apr 2024 05:25:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=brainfault-org.20230601.gappssmtp.com header.i=@brainfault-org.20230601.gappssmtp.com header.b="QTcc38Hv" Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E90818C3B for ; Mon, 22 Apr 2024 05:25:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713763507; cv=none; b=ac64cslOGErU/ODTD71CcfVA5FGxUpcYSlM8oU5wK75a0aNXErrlxfk4lbeKWNcOgmq8W5Ssa96LYdoKS/9KrjSvTrsh5dzexzlMdtb3kKV51ae1n/1W3Vuus45ygnmyYapXnz09IW1PydmAVMFpCwq7lYtjTiq8n4eMYEAevm4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713763507; c=relaxed/simple; bh=Ik9DM1QNpRlU+dZ0CiUmfKQUt5GK17SQR7pdunVTi1E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=IbBbK9NvOFxMtH/N418D9tWw3l9Fj+0uViIYTwzIaFgoFxIQWI7IQzdi6FRjZA72QiHYvifti/AazaOz+c3JuMsyQN4bbFjxtwLAa1q9qdzjZKmPmJf7S+tTvBKtuJRNdcfGoPDaxemfKdQOnPVdvrxgBPND24K7pfyRbRX14+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=brainfault.org; spf=none smtp.mailfrom=brainfault.org; dkim=pass (2048-bit key) header.d=brainfault-org.20230601.gappssmtp.com header.i=@brainfault-org.20230601.gappssmtp.com header.b=QTcc38Hv; arc=none smtp.client-ip=209.85.166.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=brainfault.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=brainfault.org Received: by mail-il1-f172.google.com with SMTP id e9e14a558f8ab-36c134743abso233565ab.2 for ; Sun, 21 Apr 2024 22:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20230601.gappssmtp.com; s=20230601; t=1713763503; x=1714368303; 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=dF7iMXOY4VDDCKv5qNAPNo7XCDSpEYvkOWLnZnfiQso=; b=QTcc38HvYi+gmcROXNRPsN2+ACsXYSft+1UQ15tpXXXGoGqZlrz19XifTGmH4TgnQY Zof3ACGEUZ/cK87E0+XDCuiBkB+WplA5CAaxOwnxx2V6JthzB5/C3AmcataAjo6BWJSV k1pmen2KHTwR3Y5Ygo9ScVSJySmr3kzaXiyX7NEEB/h1/u9sx00ZJxSuXeJO2lzqdAdw c0eIU6EUtvTPi4STzxTw558iLQ7E7vV6VNAu/O3RWFC6vK1UjAK8KccfdVgeDNooDh6X AgxwUxgEW9A1CiY4wFERXwV2cZoCBxCqzCRldZFr0WxJVeuOVubx6zV1g3e77iPEYgTL NmAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713763503; x=1714368303; 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=dF7iMXOY4VDDCKv5qNAPNo7XCDSpEYvkOWLnZnfiQso=; b=aFptPqa8CHmaozU94ggvtXZ9CGSTI9rzd3hgE6ZSl+KuFGSisCp74IQk8bJEwclARF xrYhhtemkTlmhSNE7A6tLEkYQYvA4kaj+j1B2e+QwOuDZNZi6LiIk3F39jhl1IcLzFBv xz4ukSpY5ndzalc1Ll0lIN5aDMISsMfSe0ELVxM01QTzpqNz08bI1TiLLJRIBSHJpm3K f8+JPIpdY78cYFaZaDkO/CK6z49nPooyu9Ez++kxtQxOhczWxJOOECXvvMsZEhap8RzD JeYKzJ19q38ymZ1FjdpythG3YiWdfgebYSzQW3WQFvKUGaJGSlYSqCoou9zBriXloifq HvRA== X-Gm-Message-State: AOJu0YwaeMHzXVht8Q1rsY1oqJUg2tCvVMEvY2slgxLxKgOqVJhYG0Wk 86wkz97h3DHgijOAfkc/Z3yIFJc71m6/W8gJE083WbXRv29AQ+kcoPOc676mBbkY+mRIhCRiKh+ Ps7QxI3cbgQPJfivQmNz79Qq5sZYKbS8S9pkrTA== X-Received: by 2002:a05:6e02:152e:b0:36c:a46:e018 with SMTP id i14-20020a056e02152e00b0036c0a46e018mr5159166ilu.24.1713763503545; Sun, 21 Apr 2024 22:25:03 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240420151741.962500-1-atishp@rivosinc.com> <20240420151741.962500-11-atishp@rivosinc.com> In-Reply-To: <20240420151741.962500-11-atishp@rivosinc.com> From: Anup Patel Date: Mon, 22 Apr 2024 10:54:52 +0530 Message-ID: Subject: Re: [PATCH v8 10/24] RISC-V: KVM: Fix the initial sample period value To: Atish Patra Cc: linux-kernel@vger.kernel.org, Andrew Jones , Ajay Kaher , Albert Ou , Alexandre Ghiti , samuel.holland@sifive.com, Conor Dooley , Juergen Gross , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Shuah Khan , virtualization@lists.linux.dev, Will Deacon , x86@kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Apr 20, 2024 at 5:18=E2=80=AFAM Atish Patra w= rote: > > 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 > Signed-off-by: Atish Patra LGTM. Reviewed-by: Anup Patel 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 *pm= c) > u64 sample_period; > > if (!pmc->counter_val) > - sample_period =3D counter_val_mask + 1; > + sample_period =3D counter_val_mask; > else > sample_period =3D (-pmc->counter_val) & counter_val_mask; > > -- > 2.34.1 >