public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH net-next v2] selftests/vsock: auto-detect kernel for guest VMs
@ 2026-03-17  0:56 Bobby Eshleman
  2026-03-19  3:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Bobby Eshleman @ 2026-03-17  0:56 UTC (permalink / raw)
  To: Stefano Garzarella, Shuah Khan
  Cc: virtualization, netdev, linux-kselftest, linux-kernel,
	Jakub Kicinski, Bobby Eshleman

From: Bobby Eshleman <bobbyeshleman@meta.com>

When running vmtest.sh inside a nested VM the running kernel may not be
installed on the filesystem at the standard /boot/ or /usr/lib/modules/
paths.

Previously, this would cause vng to fail with "does not exist" since it
could not find the kernel image. Instead, this patch uses --dry-run to
detect if the kernel is available. If not, then we fall back to the
kernel in the kernel source tree. If that fails, then we die.

This way runners, like NIPA, can use vng --run arch/x86/boot/bzImage to
setup an outer VM, and vmtest.sh will still do the right thing setting
up the inner VM.

Due to job control issues in vng, a workaround is used to prevent 'make
kselftest TARGETS=vsock' from hanging until test timeout. A PR has been
placed upstream to solve the issue in vng:

https://github.com/arighi/virtme-ng/pull/453

Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com>
---
Changes in v2:
- add setsid workaround for make kselftest TARGETS=vsock
- Link to v1: https://lore.kernel.org/r/20260313-vsock-vmtest-autodetect-kernel-v1-1-705c35bdc7fe@meta.com
---
 tools/testing/selftests/vsock/vmtest.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tools/testing/selftests/vsock/vmtest.sh b/tools/testing/selftests/vsock/vmtest.sh
index 86e338886b33..9eacb753238a 100755
--- a/tools/testing/selftests/vsock/vmtest.sh
+++ b/tools/testing/selftests/vsock/vmtest.sh
@@ -415,6 +415,19 @@ terminate_pids() {
 	done
 }
 
+vng_dry_run() {
+	# WORKAROUND: use setsid to work around a virtme-ng bug where vng hangs
+	# when called from a background process group (e.g., under make
+	# kselftest). vng save/restores terminal settings using tcsetattr(),
+	# which is not allowed for background process groups because the
+	# controlling terminal is owned by the foreground process group. vng is
+	# stopped with SIGTTOU and hangs until kselftest's timer expires.
+	# setsid works around this by launching vng in a new session that has
+	# no controlling terminal, so tcsetattr() succeeds.
+
+	setsid -w vng --run "$@" --dry-run &>/dev/null
+}
+
 vm_start() {
 	local pidfile=$1
 	local ns=$2
@@ -441,6 +454,12 @@ vm_start() {
 
 	if [[ "${BUILD}" -eq 1 ]]; then
 		kernel_opt="${KERNEL_CHECKOUT}"
+	elif vng_dry_run; then
+		kernel_opt=""
+	elif vng_dry_run "${KERNEL_CHECKOUT}"; then
+		kernel_opt="${KERNEL_CHECKOUT}"
+	else
+		die "No suitable kernel found"
 	fi
 
 	if [[ "${ns}" != "init_ns" ]]; then

---
base-commit: 8f921f61005450589c0bc1a941a5ddde21d9aed9
change-id: 20260313-vsock-vmtest-autodetect-kernel-dd695ed3a710

Best regards,
-- 
Bobby Eshleman <bobbyeshleman@meta.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next v2] selftests/vsock: auto-detect kernel for guest VMs
  2026-03-17  0:56 [PATCH net-next v2] selftests/vsock: auto-detect kernel for guest VMs Bobby Eshleman
@ 2026-03-19  3:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-19  3:10 UTC (permalink / raw)
  To: Bobby Eshleman
  Cc: sgarzare, shuah, virtualization, netdev, linux-kselftest,
	linux-kernel, kuba, bobbyeshleman

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 16 Mar 2026 17:56:15 -0700 you wrote:
> From: Bobby Eshleman <bobbyeshleman@meta.com>
> 
> When running vmtest.sh inside a nested VM the running kernel may not be
> installed on the filesystem at the standard /boot/ or /usr/lib/modules/
> paths.
> 
> Previously, this would cause vng to fail with "does not exist" since it
> could not find the kernel image. Instead, this patch uses --dry-run to
> detect if the kernel is available. If not, then we fall back to the
> kernel in the kernel source tree. If that fails, then we die.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] selftests/vsock: auto-detect kernel for guest VMs
    https://git.kernel.org/netdev/net-next/c/3883c2b50910

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-19  3:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17  0:56 [PATCH net-next v2] selftests/vsock: auto-detect kernel for guest VMs Bobby Eshleman
2026-03-19  3:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox