Message ID | 20231229214950.4061381-7-atishp@rivosinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-13253-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp2813025dyb; Fri, 29 Dec 2023 13:52:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFh7j1Xaj6MMhRNfieqGOgyRG/BGMcODzLVT1FAIfaO/cprNeOXsnp1n+0qMg26uDYZpmTy X-Received: by 2002:a05:622a:9:b0:428:44:5400 with SMTP id x9-20020a05622a000900b0042800445400mr3076725qtw.125.1703886749148; Fri, 29 Dec 2023 13:52:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703886749; cv=none; d=google.com; s=arc-20160816; b=IxShXZCL/hhlm0rDugRbz0JL4i8ZxiBSkbHD95cFNrDFm6mJK4byuKLRz3sz/7hyu1 TJhT556jlpFOf9pRE9l0Z5EXveqA0Xdw8KORZkSEy7BmRI/JduQnKGkF1nlYZGAQ+UMV yxXG1vMz6I8f6kl7yH8r6fRSYr1Aun9hcm6o8RbUbLZmL20v6aB05S5KsIg+oi8Z3lrM ZKyPwjhKc4JLEmyiLxVg92RImaeaw4+hbZs7H9efX56KB7JaZ6rrVP7Or3yL57SMoFxt kJTYi5Or514A8uHWhEU+alFOOxBYyIpxZfcmlSczWK5wWgy4qkseVJKaD5HGy5T65EWb U4IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=2fyVFitalYEi2ik2oU3cHAgTTSiVjR9gn+8uYrWaU68=; fh=fI5kEua53udNTNan966nBIymbOkavhtrnrSLRiMqZpU=; b=yul5kHFErSX0eW5hAB+DkiWPhDlzXWobZQx0Yu4TwRYeKonvZIMTpQ87pYSZ+INNbg 2ksRPA0bnNKBl4oe127eNG3NfuAIJTPM+ZMM2vWsYLA5/qXvFK9BINUu9P9kCQHZtC2j e92iVvXO+NipSlu3ET9G2lDJnWfLv+hisJTVwlHALUpiLBlh2zIFkEx6wLOzuFzHwDov 5cczF2eJbM35mhPcO3bng+1wfNQ4d/fwMbA7jvDlwMOEPzscWnf5LnSMrtrACo6D0vEx VGHR8Ek3vwhgBPGHTv3v2TPeK658+quJhONj6AaGazGAjij+ucBl/uX3NjwSShvwSctQ z+Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=EEImOoWz; spf=pass (google.com: domain of linux-kernel+bounces-13253-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13253-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j15-20020ac85f8f000000b00423a58fab57si20325707qta.209.2023.12.29.13.52.29 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 13:52:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13253-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=EEImOoWz; spf=pass (google.com: domain of linux-kernel+bounces-13253-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13253-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E8DF61C224A3 for <ouuuleilei@gmail.com>; Fri, 29 Dec 2023 21:52:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68138171DF; Fri, 29 Dec 2023 21:50:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="EEImOoWz" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (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 9E2AD15EBE for <linux-kernel@vger.kernel.org>; Fri, 29 Dec 2023 21:50:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6dc049c7b58so1907153a34.3 for <linux-kernel@vger.kernel.org>; Fri, 29 Dec 2023 13:50:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1703886609; x=1704491409; darn=vger.kernel.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=2fyVFitalYEi2ik2oU3cHAgTTSiVjR9gn+8uYrWaU68=; b=EEImOoWzxDbg4FYod9z6qjzQEZqwSp+XNmPasWQFTh3kD2mt17xuEEk83zWon9ySs9 51rnvadQHaGAmFPrkb4W399eq5Clmu5sflmopAFh+eVj14mlmF/8gFj6YS153lZwHojE 19EM4wPH5bx8UG6ReYjBxx+ebdm4Sk/roeiQ57IpDtZFyyoLfYGFhOEO3nIwLcP+O81j UTc2Fo6wehk/NwVVmAgmHAiAPUdEmmhQE9zzSopV9s9kJprrae/x4+11jUaSDayBWyP1 2LVvQZKoC+cCDRSxxFbAmrUCqS5OZti02VNBd/ECpp5MfJFqRIWYFrXDDsAC+fnJv/J2 6XIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703886609; x=1704491409; 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=2fyVFitalYEi2ik2oU3cHAgTTSiVjR9gn+8uYrWaU68=; b=OMDUOyHKkTCg8/DU6J8LE6L7OnMYe2E3i1OsqSiv3S93WvqoLi4ixyK854sHmISTty SKzEWKa0MBGCIVWCetm5OkwNT1FXnVIU4dm/xU6VJki7xAlhX9rCZFrFcyYk/A+lxPlJ ssCVQlbBpcUo7NcA6xEz5eueze6q6rkqTAurJa/ZsbzguNG2MpAmCdN1AkaSLulnBC7y otkCDromz2un1f3tzplW8sfSI5RgQH5SwTkL2HGPBAY4wzZa4Usfpr9JXbdwjTrw6KLh KC8EWUSUdU3zxuerQoo9HQBoxiF3043KhKQslV+owWO8LZtzqF/8mVPIdBcflSWWk2yb TESA== X-Gm-Message-State: AOJu0YybGB+QxHMNdxOgZapDVvGr6WsgaOkyOfJnibNxu+N272g9kob/ QG0mr69iTW3Hks8r+o5h1iqsWZBMs2u/PU0VXjF+SrZ4TLs= X-Received: by 2002:a9d:7f0f:0:b0:6db:e1d0:6628 with SMTP id j15-20020a9d7f0f000000b006dbe1d06628mr6576894otq.74.1703886609050; Fri, 29 Dec 2023 13:50:09 -0800 (PST) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id r126-20020a4a4e84000000b00594e32e4364sm1034751ooa.24.2023.12.29.13.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 13:50:08 -0800 (PST) From: Atish Patra <atishp@rivosinc.com> To: linux-kernel@vger.kernel.org Cc: Atish Patra <atishp@rivosinc.com>, Albert Ou <aou@eecs.berkeley.edu>, Alexandre Ghiti <alexghiti@rivosinc.com>, Andrew Jones <ajones@ventanamicro.com>, Anup Patel <anup@brainfault.org>, Atish Patra <atishp@atishpatra.org>, Conor Dooley <conor.dooley@microchip.com>, Guo Ren <guoren@kernel.org>, Heiko Stuebner <heiko@sntech.de>, kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Rutland <mark.rutland@arm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com>, Will Deacon <will@kernel.org> Subject: [v2 06/10] RISC-V: KVM: No need to update the counter value during reset Date: Fri, 29 Dec 2023 13:49:46 -0800 Message-Id: <20231229214950.4061381-7-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231229214950.4061381-1-atishp@rivosinc.com> References: <20231229214950.4061381-1-atishp@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786654751911075272 X-GMAIL-MSGID: 1786654751911075272 |
Series |
RISC-V SBI v2.0 PMU improvements and Perf sampling in KVM guest
|
|
Commit Message
Atish Patra
Dec. 29, 2023, 9:49 p.m. UTC
The virtual counter value is updated during pmu_ctr_read. There is no need
to update it in reset case. Otherwise, it will be counted twice which is
incorrect.
Fixes: 0cb74b65d2e5 ("RISC-V: KVM: Implement perf support without sampling")
Signed-off-by: Atish Patra <atishp@rivosinc.com>
---
arch/riscv/kvm/vcpu_pmu.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/kvm/vcpu_pmu.c b/arch/riscv/kvm/vcpu_pmu.c index 86391a5061dd..8c44f26e754d 100644 --- a/arch/riscv/kvm/vcpu_pmu.c +++ b/arch/riscv/kvm/vcpu_pmu.c @@ -432,12 +432,9 @@ int kvm_riscv_vcpu_pmu_ctr_stop(struct kvm_vcpu *vcpu, unsigned long ctr_base, sbiret = SBI_ERR_ALREADY_STOPPED; } - if (flags & SBI_PMU_STOP_FLAG_RESET) { - /* Relase the counter if this is a reset request */ - pmc->counter_val += perf_event_read_value(pmc->perf_event, - &enabled, &running); + if (flags & SBI_PMU_STOP_FLAG_RESET) + /* Release the counter if this is a reset request */ kvm_pmu_release_perf_event(pmc); - } } else { sbiret = SBI_ERR_INVALID_PARAM; }