Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382391; b=DiGOIjK5CdkUr6BzpDcQNU7AoZ4k84ND2z9D+8kXP0Hz7rCiks3/JG8OCLJDvkVv6dGY JXOFyJdgVuSRnFI/xjLVO7fkE6Qqlem9UlB+Qem9gEFpqcjhkvUh3VTxHbf+RU4dZp2my +5oWjOB8zuSSlmzyLXiKV1r6CRvX7GVQS8keO8lGdPzL2v/xDBzam6Zte8/DPkAFQlRjL GEzmi53fA2F2bPBeZenLlOMsOAuGcQF+AQfZYCRbsK/CSHMmZti7/l3SZNbS/khlyncXN tF+99zW5A9TcVKOsN85uMPhCP9CDdSMkUUaMjn0gsGVKcwYOUInlMjxOD0nC5lFvN0g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382391; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=RssDnw7PLCRbe4Ug0eWuFV5/GBml70oVX+vWd04eD3I=; b=Rl7jM6dquVXN+qY39n6F++i4p3VM+j7cPrCI5qOD1Ckc598p3gqOF0gczEjyqtJqeJuj I/DDbm58f4BjsJxWGxxo+U9gytRt6rcMlz52ouabk24co9i++GjVNAdmrZfZYfnl9olEt im4BVV615tt1iPVwCrJAsxkfYHzLELwPjiG720ZvlpwCWmWX7VYRuJinrGe+lIoITWc+/ dDvMULZdcpmXHoy5TLbiWUQEUcLQaIm3CkqSsTmmMs1hMNLEU9NWWsCSk7gi1+htpMfDi 50UjPFgkAf57JzAxFTuQEwfcbQcUtTOBBX/O4PQiTSzqU5RZ8xWb26oWt5vWMqA8khw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZOQdeIEU; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F4155606A330; Fri, 4 Dec 2026 11:06:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZOQdeIEU Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89DB51F000CE; Fri, 4 Dec 2026 11:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796382390; bh=RssDnw7PLCRbe4Ug0eWuFV5/GBml70oVX+vWd04eD3I=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ZOQdeIEURZhZIVE7Z/2FKwSv++y3PGeBFWngf1kEJ2SsUHpqoobS8MgUB8FD83wpW C71xr/pu0866L3oBAxfMp78L9S1GI28QI6o9HHtrkDxX9ObEJGaJvAhn3E/nvF2tYa s0uJnyz3SC/Ek+EMYhMdxU+73V/GmWmCUN6GEvVv50ymx1gqXnng/w5j3aqyJ2yLh1 b0D1nzRcf3pLy7rC+Tonjr9pSiTq8/uA7nGEXyUPC8G0TfrkP2kfzQQbNgUqKSo/zr S2uKWLpyp2GsRmhXBxwP1U22SRsZWWnuQ9QU+lx1jTlrHq7MzI/bchbOMuLx4OE7vx rdHV2F2dowpsw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 2/2] KVM: arm64: selftests: Test PMU counter overflow in vpmu_counter_access Reply-To: sashiko-reviews@lists.linux.dev To: "Fuad Tabba" Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, "Oliver Upton" , "Marc Zyngier" In-Reply-To: <20261204104911.2797512-3-fuad.tabba@linux.dev> References: <20261204104911.2797512-1-fuad.tabba@linux.dev> <20261204104911.2797512-3-fuad.tabba@linux.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 11:06:30 +0000 X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] kvm/arm64: missing CPU pinning in run_overflow_test() breaks big.LITTLE - [Low] KVM: arm64: selftests: missing ARMV8_PMU_INCLUDE_EL2 on CHAIN counter -- commit edb981028c9723f221e3d9e0fdc640b53ad0edc4 Author: Fuad Tabba KVM: arm64: selftests: Test PMU counter overflow in vpmu_counter_access This commit extends vpmu_counter_access to test PMU cycle counter and chain= ed event counter overflows, checking overflow status and interrupt delivery bo= th when the guest waits quietly and when it traps in a loop. > diff --git a/tools/testing/selftests/kvm/arm64/vpmu_counter_access.c b/to= ols/testing/selftests/kvm/arm64/vpmu_counter_access.c > index 22223395969e0..57e2f39863767 100644 > --- a/tools/testing/selftests/kvm/arm64/vpmu_counter_access.c > +++ b/tools/testing/selftests/kvm/arm64/vpmu_counter_access.c [ ... ] > @@ -596,6 +603,209 @@ static void run_error_test(u64 pmcr_n) [ ... ] > +static void test_chained_counter_overflow(enum overflow_wait wait) > +{ > + u64 high; > + int i; > + > + write_pmevtypern(0, ARMV8_PMU_INCLUDE_EL2 | ARMV8_PMUV3_PERFCTR_CPU_CYC= LES); > + write_pmevtypern(1, ARMV8_PMUV3_PERFCTR_CHAIN); [Severity: Low] Should PMEVTYPER1_EL0 also include ARMV8_PMU_INCLUDE_EL2 for the CHAIN even= t? On NV-capable hosts the guest runs at EL2, where ARMv8 PMUv3 applies the PMEVTYPER_EL0 filtering bits (including NSH) to chained odd counters too. drivers/perf/arm_pmuv3.c:armv8pmu_write_event_type() sets ARMV8_PMUV3_PERFCTR_CHAIN | ARMV8_PMU_INCLUDE_EL2 for this reason. This only passes today because kvm_pmu_counter_increment() skips EL filteri= ng on CHAIN events, so the test will fail if KVM enforces architectural filter= ing or backs the counter directly in hardware. [ ... ] > +static void run_overflow_test(void) > +{ > + struct kvm_vcpu *vcpu; > + struct ucall uc; > + > + create_vpmu_vm(guest_overflow_code); > + vcpu =3D vpmu_vm.vcpu; > + vm_install_exception_handler(vpmu_vm.vm, VECTOR_IRQ_CURRENT, guest_irq_= handler); > + vcpu_device_attr_set(vcpu, KVM_ARM_VCPU_PMU_V3_CTRL, KVM_ARM_VCPU_PMU_V= 3_INIT, NULL); [Severity: Medium] Can run_overflow_test() fail with a timeout on heterogeneous (big.LITTLE) arm64 hosts when the vCPU thread migrates across PMU clusters? create_vpmu_vm() relies on kvm_arm_set_default_pmu() -> kvm_pmu_probe_armpmu(), which binds the VM to whichever arm_pmu covers the current CPU at vCPU init time without restricting kvm->arch.supported_cpus. If the scheduler later migrates the spinning vCPU thread to a CPU outside t= hat PMU's supported_cpus mask, armpmu_filter() and armpmu_add() stop scheduling the guest's perf event, so the counter stops advancing and wait_for_overflo= w() times out. Pinning the thread with pin_self_to_any_cpu() before create_vpmu_vm() (or configuring KVM_ARM_VCPU_PMU_V3_SET_PMU with matching CPU affinity) keeps t= he vCPU on the bound PMU's cluster. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204104911.2797= 512-1-fuad.tabba@linux.dev?part=3D2