Message ID | 20231218104107.2976925-7-atishp@rivosinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-3354-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1151586dyi; Mon, 18 Dec 2023 02:44:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZc2ggGrt/hAl18lesyVXPu8MNqEaR94uSHKLXvVQSStAzXPWjAjPrDsB5uRJgVmeVSSh7 X-Received: by 2002:a05:6808:208a:b0:3b8:4d71:6cd1 with SMTP id s10-20020a056808208a00b003b84d716cd1mr18605727oiw.8.1702896264677; Mon, 18 Dec 2023 02:44:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702896264; cv=none; d=google.com; s=arc-20160816; b=VztgoeZ/q1j2QO8phFt2BCfdQeyqet1kGiEe0qQ1lXYOEIeJ44G3HEug8Im2IOOgnc oVa3U4BjAN2S7K1Y5Ba+0u+iEX/F54rz9rQW6Lv+wMyuwoK9lrtAsTWW2mNM8yYv3sr1 PJ9tDrNmX/5heAnCEGkmeg3TU/lBiKDUtsbjArOG1+UQUp5sxycFFfJJtQXhVthpo3YM rKcRaDGHrFS7rT2KupJCPDui80SHBTpSG8vcA4VtLLOCXmawXMdCTSMESL8aWnkNZdLD IoKdkUKy4gr3IM58ZVvJ7HS7ZwagwYHM4GTq9AsqkSEGRSxWvJFfhOz1gUQKfPTTddLc +1Og== 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=edP9Vyhdx3wHlRWwndjClkZeqsrAD5QaYzj9PwYQ7RY=; b=EDW8nO4FQNpsajnmjk2+hyLRrmnLXsq1jfIR5gRt36eKSGov5iSMeIWJd9SXxDO7uF o/x9GwVUsqCOogw6VFCPz9F3iQhB1V3eVSUp7xpIQKGdV4l4ShlS40nXvH1BL2vQoopg +//Vji61aXartIC4FykMkFEB6huSrKkal9E3cIcbG4jkUv6mw9yoF2wVir87Iqa1v9Kz P9bJyI4GGP75c6zYZ1uMGyvHGAr93f7Rsshej8uLMpcqNHsb5J1gG516nrBfLHW8WZre YyGJVMA1rhkupauDmDoXuSrVRdlQn7WCUuFF/5rWebRHNjInYtrnWdnCuGBBjHRgmEB0 IPNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="PDb/c4Gd"; spf=pass (google.com: domain of linux-kernel+bounces-3354-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3354-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c11-20020a0cf2cb000000b0067f30126bbesi4128057qvm.119.2023.12.18.02.44.24 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 02:44:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3354-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="PDb/c4Gd"; spf=pass (google.com: domain of linux-kernel+bounces-3354-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3354-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 727E71C22A70 for <ouuuleilei@gmail.com>; Mon, 18 Dec 2023 10:44:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78D91200B8; Mon, 18 Dec 2023 10:41:32 +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="PDb/c4Gd" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) (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 8F98215EB6 for <linux-kernel@vger.kernel.org>; Mon, 18 Dec 2023 10:41:28 +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-oo1-f41.google.com with SMTP id 006d021491bc7-58d18c224c7so1848772eaf.2 for <linux-kernel@vger.kernel.org>; Mon, 18 Dec 2023 02:41:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1702896087; x=1703500887; 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=PDb/c4Gd8xFFFxVvLZ4N8ORjQ3ScVUvzzWGDOVyyxdQ1iDLv8ESKIc/gidhUgzXfMV Fg6ObH0MowANm81k0eR4Ge4GybQ2IDxovHSKKRc+G+ynH1VcSqWeGfrWnAbg2WKV7YfB CV6Z3YFH4LcYZv429Um6uJhNVo9pyLxxEt6pE1FPYQaKyPtWTXhdWUX7kl9GD5rcz//h xtSc1X3CNbMAmgPzmz50cHPHA7/+89Ps8R4y1+m6XtBezawFNqKLDARGV0vUhMKwTkqM UxzLpYjIrNy8ZzaVuL0Wp0qUPwQoZPCn3Z6cVL+mXer+YHVeBOu8el1ULGNn+RTQkx2U T9Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702896087; x=1703500887; 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=pkxKmjyHYUZ2MpkZowo8YLBLM0XALjJ6TFUcV8UrIvesXWIOv5aOWAKq7GfookwNdu 6DYvHjIa4ePQhnfUlwwKxnPMuWDRfYE2FqtWblKSK2v+QhilRCPGiqykw+ZsE5QMMKeV 68FpmzQ8vxrfsnWvCI82f8THUj+gHuIywYgXzL2o/cJCKmPvtBfyeox5l9WP9xR+PSMt CXIfDx4pHxnHHXyU/uH5K6h7xEr8OY96vhVZBK9A4Ej8OHu2V/3uQ2abV3JazlXzWfFO GOw0jnnhuXXgFyIVdhEhdBehJ+2mzOuDpvuKTdwIWipzm7soz+6qAbxrHOAQmB5sKpHw QURA== X-Gm-Message-State: AOJu0YxFhw4oLZyXZAw27/EpevQgiQxAOHgSuFW+a67HrtYJiVAv6lta UOVwixplFhaROFzIzhsOK4bbrXIJDfK+jUr4rxs= X-Received: by 2002:a4a:ab43:0:b0:591:cb4f:a672 with SMTP id j3-20020a4aab43000000b00591cb4fa672mr843619oon.9.1702896086847; Mon, 18 Dec 2023 02:41:26 -0800 (PST) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 185-20020a4a1ac2000000b005907ad9f302sm574970oof.37.2023.12.18.02.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 02:41:26 -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>, Icenowy Zheng <uwu@icenowy.me>, 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: [v1 06/10] RISC-V: KVM: No need to update the counter value during reset Date: Mon, 18 Dec 2023 02:41:03 -0800 Message-Id: <20231218104107.2976925-7-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231218104107.2976925-1-atishp@rivosinc.com> References: <20231218104107.2976925-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: 1785616153317117254 X-GMAIL-MSGID: 1785616153317117254 |
Series |
RISC-V SBI v2.0 PMU improvements and Perf sampling in KVM guest
|
|
Commit Message
Atish Patra
Dec. 18, 2023, 10:41 a.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; }