Message ID | 20240416184421.3693802-12-atishp@rivosinc.com |
---|---|
State | Changes Requested |
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=rIM/uxKe; 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=VPgx2xkI; 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 4VJtJh3QhTz1yZC for <incoming@patchwork.ozlabs.org>; Wed, 17 Apr 2024 04:45:24 +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=vZjp3p8BCY4SXNDfMT12wijDnxaZ6lJloRgd9deIDjw=; b=rIM/uxKeEBiOXB UNb0NVPbpB8lNkleV/EUQhT6HvRKLrGOqOLZOK2Rgaa8uip013QwCbKpfjR9RJbB7dwwoRn18ZnRa Nrzhj/vlG0HOiTg2yja6qSsw+JfNYW3cvobyTPtbyXY/MR+PKVjdWClq6/1mKW3JMzIcK03VFGa9D Gloab0CKtSEGmL3y/kiW03xwkwZY00hLLFllZ4dWzx11Xor84cMsIBQWvSf2/Z23xYQ+a9lET8odS BUc3vFQgWrS1saZQJZqU33Jf+60Z/MTF421k7So8WMlu6Gmd8ShAcB1C4vaeapKxvd546XU8s4gxY xMZHI15tyGCueMZX44QQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwno2-0000000DMjD-3uXR; Tue, 16 Apr 2024 18:45:22 +0000 Received: from mail-pf1-f177.google.com ([209.85.210.177]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwnne-0000000DMKw-1TNz for kvm-riscv@lists.infradead.org; Tue, 16 Apr 2024 18:45:06 +0000 Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6eff9dc1821so2238019b3a.3 for <kvm-riscv@lists.infradead.org>; Tue, 16 Apr 2024 11:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1713293097; x=1713897897; 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=oLadZMY/1E+aj61iqE390ie32fUnJXqsMN5cFXtebck=; b=VPgx2xkI+Jwt2NXSNCPjKKY64L+9E0/u/MkpYbfxBVPTIVufI4vG8YoCnlYU/A4Myl i6FfvMMeuPV1w02azWtsSRDEWfM3YjjD37e06FEoeVmI/pHdpYpFhyCDYLbi38cnWwA6 3xAl3S6gjV23SXl+UeWd3YtBpIdnfmNGUEgyaeo9VIDlvHhWe8ZRqTWQ11dpQ08aybeR 5Aj8IN6Hv7JEpz3uNeoI+snMGUn6kNePQq1G2qeHe/UsYc8sJyitN1H4P+tG5osUySh4 jhVbpcMpnB6CtU6vTPhTR2QV/DLbF3GxffofEwi/74hcMYBiflKKZisrIjFL6UacXDTy IYew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713293097; x=1713897897; 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=oLadZMY/1E+aj61iqE390ie32fUnJXqsMN5cFXtebck=; b=PX0dvUe03jPV5r4BspyK0COlQbjPGMd+k5OgU1PqFLFymj4mJuPYrat72GMAG+n9w8 gIfvaSsVsEB2N1VPl8Zn3tezL1Mj01XFff1BwHC0mlSjlgACh5dox3GS81dDoRctREFa Qxk7TymFC5w8BCAUBOgIVi001CtsGzC4EoK16jinG3GO7gMwhxYgJNO0uuUTyopmQBAT yZi06BREXBrBFPzsCJhrm4J5l8G2dd+hJCgSZfUcup5s3iltjtoH3sUp6bD5Szwy776c YejWwcp+VvGO0IFhTbUrb5kBOAPHzwVZsH3gvwM/gvK/1LtHeKRQr1ZU/6iE14DXGYyl VtoQ== X-Forwarded-Encrypted: i=1; AJvYcCX9FBeqWusiI94iijKQSZ8Ps7ZNQyCEDbg4XLGwOWui+/OQCcGknrlj3mYcGhTnWb056jtMpyqkg+O8K5oyP70nWEtt6MmgfU8tZ+iY8A== X-Gm-Message-State: AOJu0YwemwPwj86Vlnlj3LjQf5QlOZDVUS4RF4Kffh1XRC2gb3Q9e5Nt nSPqPGlXMobwWIEU/3l5W/Gl49dnDBILMwJ/UCNcau+W3IR48UY3Z4kU7alikM8= X-Google-Smtp-Source: AGHT+IFO7WHFR9Rl28v65gUEiDT2PQZV3q/4Cya2K/e1Lz1G/MiHbevY0IrWH/uczf0ujzNAu6TxBA== X-Received: by 2002:a17:90a:130c:b0:2a6:f414:4e0b with SMTP id h12-20020a17090a130c00b002a6f4144e0bmr9113440pja.41.1713293097058; Tue, 16 Apr 2024 11:44:57 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id o19-20020a17090aac1300b002a269828bb8sm8883645pjq.40.2024.04.16.11.44.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 11:44:56 -0700 (PDT) From: Atish Patra <atishp@rivosinc.com> To: linux-kernel@vger.kernel.org Cc: Atish Patra <atishp@rivosinc.com>, Anup Patel <anup@brainfault.org>, Andrew Jones <ajones@ventanamicro.com>, Ajay Kaher <ajay.kaher@broadcom.com>, Albert Ou <aou@eecs.berkeley.edu>, Alexandre Ghiti <alexghiti@rivosinc.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 v7 11/24] RISC-V: KVM: No need to update the counter value during reset Date: Tue, 16 Apr 2024 11:44:08 -0700 Message-Id: <20240416184421.3693802-12-atishp@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240416184421.3693802-1-atishp@rivosinc.com> References: <20240416184421.3693802-1-atishp@rivosinc.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_114458_711109_E4A57CC8 X-CRM114-Status: GOOD ( 12.91 ) X-Spam-Score: 0.0 (/) 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 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") Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Atish Patr [...] Content analysis details: (0.0 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.210.177 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_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.210.177 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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
|
diff --git a/arch/riscv/kvm/vcpu_pmu.c b/arch/riscv/kvm/vcpu_pmu.c index cee1b9ca4ec4..b5159ce4592d 100644 --- a/arch/riscv/kvm/vcpu_pmu.c +++ b/arch/riscv/kvm/vcpu_pmu.c @@ -397,7 +397,6 @@ int kvm_riscv_vcpu_pmu_ctr_stop(struct kvm_vcpu *vcpu, unsigned long ctr_base, { struct kvm_pmu *kvpmu = vcpu_to_pmu(vcpu); int i, pmc_index, sbiret = 0; - u64 enabled, running; struct kvm_pmc *pmc; int fevent_code; @@ -432,12 +431,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; }