From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.199 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796172008; b=xzO8qZ+VYaV+q2inAS5tVovJeVX21qlM+DYTCtalf0MGi1mMMZ2s+KblPrBsJqJiwsd5 YrFcfziFJST3BwHf0djqk3Nh29BY1hHoGGIIUjBXElosVr/d1gl1rP2ETWBQGHt6DAOoh jtjUjMd82tan+Tq5PKxgrX1cxc0GDF5o7icGa7A0Nn1qUn0DX/+PomjtMve9bT+YuBt6L GaQNIgH4o/Su+dbXTHDBXJuO3MPaXQL7v2tleZ9JYx2QMi5N9HaG/cERO71iBa0KjrfBJ RRascGHSo2Jl5gi5m9OwEuYpLyov/fSOvj+dbvtemSLs2jYxMRYPOHsVrgXsY+LHLXw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796172008; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=uJvC/qw6s6ZQvSiC1jCR1WCUvDRQf7tfMBiMaKwhJQU=; b=wIKbNrQ+Rgdp69SaHvHope0l/tiBWSvKfy1jULt1Ksu1L+p8hQ2gvqYHEFDOjEWHzLla /IlNwOX3O5Vu+JzaKmRkB+3j1FN9++y5B56XhL5yj23WvXCmCNZ6+7pmQXvT37qFaTQts qzy30U4X8WQnMrOC5uc/wB/HfjIJnv1u+kvyX744VKFhfPTZhHIDe8+e8q53tI4HPY1zw nUP6w/Cw+I9KgUZ3s5JCiCdoFxl5WnuQBJqXpvMIkJJLhAk8y9iiOr6YARy3rdAOjxyxQ xXVenXCP3cVpZlHRMFuSFEPfXnM8vKej+GU7gzJmxjSiV/OdUWNOQ2Tt453jMq9Q2gA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=KfvgGmd9; arc=none smtp.remote-ip=209.85.167.199 Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79BD5606A699 for ; Wed, 2 Dec 2026 00:40:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 79BD5606A699 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=KfvgGmd9 Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-4cbf700ddccso9204719b6e.0 for ; Tue, 01 Dec 2026 16:40:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796172006; x=1796776806; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=uJvC/qw6s6ZQvSiC1jCR1WCUvDRQf7tfMBiMaKwhJQU=; b=KfvgGmd9+PbgCTjBjZ9MM9wtF61+XCXcSYjEkxcgrtEQW0R+DYzgXr3e70C2Hxp7XV 3n5WA/aTHVKMZgqztJdOhOH9jS2E9LUuJL30Qbm4tX77VuQRqM+c9ltmfgeR88Rf8pWv H19qF/TabmzKXq9OB0HVeWtHoPaIOEjoxzJ9zK2NfW2HuAgECh7M6Qo0jBhoIavpALeN cHV55W4khQt09lbQooo4/JlYfwdrPJKmYJFhFt5KmK+9Tojhoiu4KW7qCBTpFCbb1gBz Oy1nuty/KPGeTL78P+jUEnCboyA2B934LuSLXrNimO16SEkzlUbqjlcxwa1qMKCyyiZd q/og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796172006; x=1796776806; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=uJvC/qw6s6ZQvSiC1jCR1WCUvDRQf7tfMBiMaKwhJQU=; b=eWjiFuLnFxnNTYpVBNfJJlEBj3e6ccSvcNpdlJrsstvsnEQTF9BNUwb0x7yosHcWtQ uxj8OiQTffFy2/X7fGi+g92Kgo856pTptBFwCmYj6nzAFl+IS5Fqx+7XXqfG1wDtGnH+ 4bzJhMtVtaRdZnOLkycKf57TvG5Es9m7rkgFJ4Sqiz0PbyoM7j3r+d5iFMXLUrKTvQqG FclVCLcrAJDTo+8kYTeBiu1liszEElAo2nv/6/OtYptVAEzq1mRR/ZBAlkmry3PCiqPM 73cnazNqWVKKK4TqscZKi32IOFbQNkGYLmAanLRFJPCmPjotZkfEnA48qyFpCSsBkAjx dbpA== X-Forwarded-Encrypted: i=1; AL+hErHMTrzVEN+rkIfOVG6lP5qpWB/LqOu+JwBL7XVCy1meg7mVhr19miOA8WO/lGxaYbS2cLmoRZ0Pd+s=@vger.kernel.org X-Gm-Message-State: APuU4Z/MEKITBH8iUAlYMtEkRYP7i1Lg72erqqgnw/6YXVXENLb7G5m9 RrXKLVogg2eB+ulTKF4dA35pEg5afo+Y0/h0tzBnKzw67Rh6r+z0fzrITBDr0Cu1ogAHSwGBIdh CzNUq/HGqRd81Qg== X-Received: from jabio27.prod.google.com ([2002:a05:6638:831b:b0:608:c2f0:a34d]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:13d5:b0:53b:1d13:dffd with SMTP id 5614622812f47-57a06a11405mr40218668b6e.7.1796172006403; Tue, 01 Dec 2026 16:40:06 -0800 (PST) Date: Wed, 2 Dec 2026 00:39:44 +0000 In-Reply-To: <20261202003955.3607156-1-dmatlack@google.com> X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261202003955.3607156-1-dmatlack@google.com> X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog Message-ID: <20261202003955.3607156-8-dmatlack@google.com> Subject: [PATCH 07/18] selftests/liveupdate: Support kernel modules in vmtest.sh From: David Matlack To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Albert Ou , Alexandre Ghiti , Alex Williamson , Bjorn Helgaas , David Matlack , Jacob Pan , Jason Gunthorpe , Josh Hilke , Lukas Wunner , Mike Rapoport , Palmer Dabbelt , Parav Pandit , Pasha Tatashin , Paul Walmsley , Pranjal Shrivastava , Pratyush Yadav , Samiullah Khawaja , Shuah Khan , Vipin Sharma Content-Type: text/plain; charset="UTF-8" Add TEST_MODULES to vmtest.sh test definitions. vmtest.sh builds the modules in the Makefile's TEST_GEN_MODS_DIR against the test kernel, and places the listed modules at the root of both kernels' initrds, where the test binary can load them. The modules are built with MO= so that their build output goes into the workspace rather than the source tree. The kernel's own modules are built too, since external modules need Module.symvers. Signed-off-by: David Matlack --- tools/testing/selftests/liveupdate/vmtest.sh | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/testing/selftests/liveupdate/vmtest.sh b/tools/testing/selftests/liveupdate/vmtest.sh index 797190d4b47c..937f10fc9592 100755 --- a/tools/testing/selftests/liveupdate/vmtest.sh +++ b/tools/testing/selftests/liveupdate/vmtest.sh @@ -21,10 +21,13 @@ KEEP_WORKSPACE=0 # TEST_BINARY Test binary to run, as named in the Makefile # (default: the test name) # TEST_ARGS Arguments for the test binary in both stages +# TEST_MODULES Kernel modules to place at /.ko in the +# initrd, built from the Makefile's TEST_GEN_MODS_DIR # TEST_QEMU_ARGS Extra QEMU arguments # TEST_TIMEOUT Timeout for the QEMU run # test_check() Host-side check, run after the test passes in the VM TEST_ARGS=() +TEST_MODULES=() TEST_QEMU_ARGS=() TEST_TIMEOUT="30s" @@ -152,6 +155,11 @@ function build_kernel() { $make_cmd "$kimage" $make_cmd headers_install INSTALL_HDR_PATH="$headers_dir" + + # External modules need Module.symvers + if [ ${#TEST_MODULES[@]} -gt 0 ]; then + $make_cmd modules + fi } function mkinitrd() { @@ -161,12 +169,26 @@ function mkinitrd() { local output="$workspace_dir/build" local init="$output/init" local test_binary="$output/$TEST_BINARY" + local extra_files="$workspace_dir/cpio_list_extra" + local module ko # Build the test binary and the init process mkdir -p "$output" $make_cmd -C "$test_dir" NOLIBC=1 OUTPUT="$output" \ KHDR_INCLUDES="-I$headers_dir/include" "$init" "$test_binary" + # Build the test modules against the test kernel, and place the ones + # the test needs in both initrds + : > "$extra_files" + if [ ${#TEST_MODULES[@]} -gt 0 ]; then + $make_cmd -C "$test_dir" KDIR="$build_dir" MO="$output/modules" gen_mods_dir + fi + for module in "${TEST_MODULES[@]}"; do + ko="$output/modules/$module.ko" + [ -f "$ko" ] || fail "Module $module was not built" + echo "file /$module.ko $ko 0644 0 0" >> "$extra_files" + done + # init passes these to the test binary in both stages echo "${TEST_ARGS[*]}" > "$workspace_dir/test_args" @@ -179,6 +201,7 @@ file /init $init 0755 0 0 file /test_binary $test_binary 0755 0 0 file /test_args $workspace_dir/test_args 0644 0 0 EOF + cat "$extra_files" >> "$workspace_dir/cpio_list_inner" # Generate inner_initrd.cpio "$build_dir/scripts/gen_init_cpio" "$workspace_dir/cpio_list_inner" > "$workspace_dir/inner_initrd.cpio" @@ -194,6 +217,7 @@ file /test_binary $test_binary 0755 0 0 file /test_args $workspace_dir/test_args 0644 0 0 file /initrd.img $workspace_dir/inner_initrd.cpio 0644 0 0 EOF + cat "$extra_files" >> "$workspace_dir/cpio_list" # Generate the final initrd "$build_dir/scripts/gen_init_cpio" "$workspace_dir/cpio_list" > "$initrd" -- 2.56.1.911.g883d8bcb20-goog