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=1796376325; b=Cf2HZG/rAcLbKLFhaIPtjqxkE+xglid5UH0FKE/6/9qPRF7y1VgDVzUJiB5cjYzTqwE7 vVfwF9PXvQt7r4QAVWpJETe65FaVyQatRENMhrM9k0opC9tV9KUl87m/9shsa49U/RnOn rWazEt49ictPeTOl4AB6+9z2X/SmYdxtxiEirjK/9tvfdf2gIxdwjONZ4f4RoiTUj8G+T Yl9a86c2HtHhTQvxRJOcq5x5+h7VPjDqvXlEkWz+9SKCwLGzRlvw0vabxzbDJNjeTe2P/ qCM+KCi0MCv9xrHgt+eAZ69Wl13O/WdIjFhJDUKabofO9/dOWjWAKd6J9YpqC+EOoWQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796376325; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=BY4f/jUIf0/Idbz0NUKLW2KIRSO0UnUYGbce2HjgI+0=; b=pLq0wMjOKhwIAyE+cNdQNbJPLlDtLSIoxnpv8G48Dn3+gogn0gCxiwR0d1N3sm1mQx4E g/z6UdlajhhcLYZ6x1puzaU3plVIUg3+Qpv1B4gAGlkt5i5IHN/Wo3yskBRzOa/JuhASk Ie9Uk7v80gS2vmCPIvrqdfItwDoKYmUAKp6doXpqhH2ecDmNLWijPP83tnus+EZs29bc0 lGyeswbpnCiJDijK8eljWpgxYL9EqC1L5U+WWcAJA2rZvJCDbbF+K8wxcAH6McVikyE6Y sfwkd0fnTIDcXG827KikpnKvdPMdPG86VZl/+QSR33y2PLZv8X2T1DHArnwW0ggUGkw== 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=D3W4Wyw7; 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 E7D9E606A322; Fri, 4 Dec 2026 09:25:24 +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=D3W4Wyw7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 526391F000CE; Fri, 4 Dec 2026 09:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796376324; bh=BY4f/jUIf0/Idbz0NUKLW2KIRSO0UnUYGbce2HjgI+0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=D3W4Wyw71aa0qR1yY2C0yZWBOPbpuaJV4YTUqep5+V8fao9hsxfGnInxCb8D0K2+7 ynorc7pchUO+5IDLW1b1j1y4GoOlDzNplHjvWqJePflOsL3Y2x+ozJ/EBJ6Zba4LGF 9Octn43TkVHAb+iH4IYqzVhTu4Vhsq3U5M58nhdk28nxZJNm2VXgS5Gg9t/6wRRC5y ojyOeNnNX/FPfghWpXlz+9wpPzqeCN7MqMnnAOjtGcPe46IVEL6GP5Kg0Wy9O6stR0 hQvQHI2Tf7OKiRBNXQam1LoVQs9/zScOVjxuBEz71d0siaVEQq4cb2/hoNbyEBlIj8 VmXUKNcDKKGkg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 2/2] KVM: selftests: arm64: Test KVM_PRE_FAULT_MEMORY before first KVM_RUN Reply-To: sashiko-reviews@lists.linux.dev To: "Jia He" Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, "Oliver Upton" , "Marc Zyngier" In-Reply-To: <20261204090914.459990-3-justin.he@arm.com> References: <20261204090914.459990-1-justin.he@arm.com> <20261204090914.459990-3-justin.he@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 09:25:23 +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 1 potential issue to consider: - [Medium] KVM: selftests: test_pre_first_run_el1() uses guest page size for pre-fault -- commit efb55a38dc35f83285043845cf36eea7648a5fbe Author: Jia He KVM: selftests: arm64: Test KVM_PRE_FAULT_MEMORY before first KVM_RUN This commit extends nv_pre_fault_memory_test to exercise KVM_PRE_FAULT_MEMORY before the first KVM_RUN and across vCPU thread handoffs, both with and without EL2 enabled. > diff --git a/tools/testing/selftests/kvm/arm64/nv_pre_fault_memory_test.c= b/tools/testing/selftests/kvm/arm64/nv_pre_fault_memory_test.c > index 09c1db3038566..57e3aaeea8947 100644 > --- a/tools/testing/selftests/kvm/arm64/nv_pre_fault_memory_test.c > +++ b/tools/testing/selftests/kvm/arm64/nv_pre_fault_memory_test.c [ ... ] > +static void test_pre_first_run_el1(void) > +{ > + int feature =3D KVM_ARM_VCPU_SVE; > + struct kvm_vcpu *vcpu; > + struct kvm_vm *vm; > + int ret; > + > + pr_info("Testing pre-fault, then immediate_exit on the first KVM_RUN\n"= ); > + vm =3D setup_test_vm(false, false, guest_el1_touch_and_done, &vcpu); > + pre_fault(vcpu, TEST_MEM_GPA, vm->page_size); > + > + vcpu->run->immediate_exit =3D 1; > + ret =3D __vcpu_run(vcpu); > + TEST_ASSERT(ret =3D=3D -1 && errno =3D=3D EINTR, > + "Expected -EINTR on immediate_exit, got ret=3D%d errno=3D%d", > + ret, errno); > + vcpu->run->immediate_exit =3D 0; > + > + pre_fault(vcpu, TEST_MEM_GPA, TEST_MEM_SIZE); > + vcpu_run(vcpu); > + expect_ucall_done(vcpu); > + kvm_vm_free(vm); > + > + if (!kvm_check_cap(KVM_CAP_ARM_SVE)) { > + pr_info("SVE not supported, skipping failed first KVM_RUN test\n"); > + return; > } > =20 > + pr_info("Testing pre-fault after a failed first KVM_RUN\n"); > + vm =3D setup_test_vm(false, true, guest_el1_touch_and_done, &vcpu); > + pre_fault(vcpu, TEST_MEM_GPA, vm->page_size); > + > + ret =3D __vcpu_run(vcpu); > + TEST_ASSERT(ret =3D=3D -1 && errno =3D=3D EPERM, > + "Expected -EPERM before SVE finalisation, got ret=3D%d errno=3D%d", > + ret, errno); > + > + pre_fault(vcpu, TEST_MEM_GPA + vm->page_size, vm->page_size); [Severity: Medium] Can these pre_fault() calls fail with -EINVAL on arm64 hosts with 16 KiB or 64 KiB pages? setup_test_vm() creates a VM with vm_create(1), which defaults to VM_MODE_P40V48_4K (a 4 KiB vm->page_size) regardless of the host page size. kvm_vcpu_pre_fault_memory() requires both range->gpa and range->size to be host PAGE_ALIGNED(). Passing vm->page_size as the size and TEST_MEM_GPA + vm->page_size as the address returns -EINVAL and aborts the test on 16 KiB and 64 KiB host kernels. Using getpagesize() instead of vm->page_size (as pre_fault_memory_test.c does) would keep the address and size aligned to the host page size. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204090914.4599= 90-1-justin.he@arm.com?part=3D2