From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796376027; b=TvnvqOtx5q3o7jVl+iXlJG+yVX6XF4goxhcmbHF8AehI0hj63g3Wt9l5IJ4V0JCLzfw4 DTcc3or8Lo5ZXSdThsgMZGpZTt8g92r9Albor8V+OYwxCzly/KgkIUFnttMrI0zt5vFtf uwLsZkE8ZPGOUQxgPcIRGvNgrkmncUWlwarnJJtPiiUVaVnBTjEdmZD7E4IlxBgga1q7Q f2t1VpFxmXM/vNS7KqpLPSx1LZWvYGrtu2lc/QIDvy0wR6/kWmnGON5BsXXPr5S1DDtbM OiFeKyiqdOztOZaNFdd8LKSUYWiw70ZBIvWeQOGy+KdJ99s43sv+ds0W+5mxxDSVCtA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796376027; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=EanHPpxQ+78v6Sme5pSdWIM3LCZC80mmrrkA0mTrxYE=; b=bCIqrKhHlnvFp5CjvhWIUrNS1Fji1f8xp75coWKeqgc5intfuUh2gkDIuBgDY3vL+tpG HBnkkYZCKsetJdu0buPNOZqvb72dAbZHivijI1ZJVkqDzeDIxtzi9KG0TSYfYIk8oH0Jk PDw7jhMAUVHn6tBbTA4vkZT9//jXo8Dq5fQMF6Xa0k67PGWceiE3s9RQZ6Mir6ZR5JFv5 aVgsACvOr23277yBNtb4JqLMNRVVs98s9hgk68gLdyMoELw5M6z69S6aMjEAdYPfKdGsB dfjPggldNiB+E4yBFYmLUBkJIEbue8fj1MNasd2ED+b9TPdDQ4SU1D19K0CXc3aw97A== 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=Yj9BydX2; 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 7DE4C606A322; Fri, 4 Dec 2026 09:20:26 +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=Yj9BydX2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C5D71F000C2; Fri, 4 Dec 2026 09:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796376026; bh=EanHPpxQ+78v6Sme5pSdWIM3LCZC80mmrrkA0mTrxYE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Yj9BydX2hRJB1kzsY8lcC0e2eZ3qFR30PwKrxV1PmPTmNLPilv1B6Je4vekhkYM7n 44yoyBswdIR5rq1N/K3DDEV7cLFyRuVaM2wnszhw3i2BrKJiiuy7cD0LxkUV6PfztM O9WMkQ1FWQ49H6XTazfa0lGYqdHYLNCmU8SxC91CxXaE8Cc5S+ODtI5Dqh2gM+SS17 oX1jGVRr8ayVa7DBtfiPhYOaUH6zRL16BKvNvp6Uu7I43xIcTPWy1vN4Y6ScsITf4h nuHabnefgFZ1PKMSB+ZkT2Oa/JdVAGMwezkYq76Fg/FTcLBbMOU49FicJnrMcu/5qU c4Jp9bozaMf1g== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v4 9/9] KVM: arm64: selftests: Test that a vcpu reset clears the vcpu's state Reply-To: sashiko-reviews@lists.linux.dev To: "Dan Carpenter" Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, "Oliver Upton" , "Marc Zyngier" In-Reply-To: <20261204-double_exception_v4-v4-9-523921511673@pereq.eu> References: <20261204-double_exception_v4-v4-0-523921511673@pereq.eu> <20261204-double_exception_v4-v4-9-523921511673@pereq.eu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:20:24 +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 3 potential issues to consider: - [Low] kvm/arm64: main() silently omits EL2 subtest instead of reporting a TAP skip - [Low] kvm/arm64: unpinned vCPU resets in test_reset() can fail on big.LITTLE CPUs - [Low] kvm/arm64: assert_reg_eq() truncates >8-byte registers in failure output -- commit 864ec7b1b20682adde35519d9d1591ff55326655 Author: Dan Carpenter KVM: arm64: selftests: Test that a vcpu reset clears the vcpu's state This commit adds an arm64 KVM selftest that dirties vCPU state, runs KVM_ARM_VCPU_INIT, and compares the resulting registers against a freshly initialized vCPU both with and without EL2. > diff --git a/tools/testing/selftests/kvm/arm64/vcpu_reset.c b/tools/testi= ng/selftests/kvm/arm64/vcpu_reset.c > new file mode 100644 > index 0000000000000..dcf5215df8655 > --- /dev/null > +++ b/tools/testing/selftests/kvm/arm64/vcpu_reset.c [ ... ] > +static void assert_reg_eq(u64 id, const u8 *got, const u8 *want, const c= har *what) > +{ > + u64 size =3D KVM_REG_SIZE(id); > + u64 g =3D 0, w =3D 0; > + > + if (!memcmp(got, want, size)) > + return; > + > + memcpy(&g, got, size < 8 ? size : 8); > + memcpy(&w, want, size < 8 ? size : 8); > + TEST_FAIL("Register 0x%llx is 0x%lx after the reset, %s 0x%lx", > + (unsigned long long)id, (unsigned long)g, what, (unsigned long)w); > +} [Severity: Low] Will assert_reg_eq() print misleading values when a register wider than 8 bytes mismatches? On arm64, KVM_GET_REG_LIST includes 128-bit FP/SIMD vector registers. memcmp() checks all size bytes, but memcpy() only copies the low 8 bytes into g and w, so a mismatch in the upper bytes prints identical got and expected values. [ ... ] > + ref_vm =3D create_vcpu(el2, &ref); > + vcpu_ioctl(ref, KVM_ARM_VCPU_INIT, &ref->init); > + vcpu_run_complete_io(ref); > + get_regs(ref, &new); [ ... ] > + vcpu_ioctl(vcpu, KVM_ARM_VCPU_INIT, &vcpu->init); [Severity: Low] Can test_reset() fail spuriously on heterogeneous (big.LITTLE) systems if the test thread migrates between cores between these two KVM_ARM_VCPU_INIT calls? In arch/arm64/kvm/sys_regs.c, reset_actlr() and reset_amair_el1() initialize ACTLR_EL1 and AMAIR_EL1 directly from the current physical CPU's registers. Pinning the test thread to a single CPU (for example with sched_setaffinity()) would avoid spurious mismatches in assert_reg_eq(). [ ... ] > +int main(void) > +{ > + bool el2 =3D test_supports_el2(); > + > + ksft_print_header(); > + ksft_set_plan(el2 ? 2 : 1); > + > + test_reset(false); > + ksft_test_result_pass("reset without EL2\n"); > + > + if (el2) { > + test_reset(true); > + ksft_test_result_pass("reset with EL2\n"); > + } > + > + ksft_finished(); > +} [Severity: Low] Should main() report a TAP skip instead of shrinking the plan when test_supports_el2() returns false? Right now the EL2 subtest is silently omitted without a skip reason. Keeping ksft_set_plan(2) and calling ksft_test_result_skip() with a reason in an else branch reports the missing prerequisite while still exiting with KSFT_PASS. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-double_exc= eption_v4-v4-0-523921511673@pereq.eu?part=3D9