From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B86846D17 for ; Tue, 22 Jul 2025 01:19:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753147166; cv=none; b=WidGcOaD7JtXrbweFi6ZcV2Q1WZ0+VORpmSDWGWE1+Td+Vo/0QaiEKC5OVtoX/Ry40vkJa8sWp9GvkMVxBU4+VIZdD7yr93+w2GOYCEdyiY725p+7gmtgJzcGj+SF8iqdJb05dd9R73aKzABa2fuZYy0x2DROBBygHNBVjcF++0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753147166; c=relaxed/simple; bh=ziBQbCdtvzozt02wWQU4++Eiba/5udQmb7BqUyHdPvs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ftKH7rOLdRv0jjI9PTptganwhbqYmEI/+BeWxrJ7e6Fsy59RR8WMlxzVKOOS1S2j9bVUq3OIEOnooLmyOZxUmHeF7/fAM6jAdDEAl7DYWreAE9LrwfyqGwowfCJq0tmYRzy0prr9ci2g5mrI5uGpp+RU9mKoDTJBizi6pwo/PVg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=QkQA5NVG; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="QkQA5NVG" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=XKJpsbqk3RpngrI0hiSzOMqGIMv9hbXTWZhbdcfNcmo=; b=QkQA5NVGbL/TyY6ZcqmmM4Zye0 Z6LUVHN4d3qA4OI7/ZIlvjSki77aci3yWrXq69k6Az20AW7Ua2G3+A2qZyhN6vJgYy0xEGMOYwbqI tLCo1kmAvkJTqFHtDe2QTF1tUuK9ozXmm+G57BWFNMvnYzUBIWa7l+GglYr4XKe3cOZDhgMDRsh0U 43gS8S+X3J4/4ko2AGtKPlhCTfmwZdkJviSalKllon9oZMFpdJPpKLgBql+y7rj44rD9gFpdEdmlt mWYqObB3rpZPz6T3TgaPgJ3k7rtLMXfthRPNWguK7s8xOzN3d4lueVouxoL6PKI9j79vkHzDv+8B9 Pwj2AgJw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ue1f8-000000010Zp-328z; Tue, 22 Jul 2025 01:19:22 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , Viacheslav Dubeyko , David Bueso , "Liam R . Howlett" , Lorenzo Stoakes , kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [PATCH] selftests: add support for VMA userspace tests Date: Mon, 21 Jul 2025 18:19:21 -0700 Message-ID: <20250722011921.240542-1-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain Add support for testing VMA userspace tests under the radix tree test bundle. The VMA tests are located in tools/testing/vma and are userspace-only tests that don't require kernel module loading like the existing xarray and maple tree tests. This extends the SELFTESTS_TEST_BUNDLE_RADIX_TREE configuration to include VMA testing alongside the existing xarray and maple tree tests. Demo: make DEVOPS_HOSTS_PREFIX="mm" defconfig-seltests-radix-tree make make linux make selftests make sefltests-baseline HOSTS=mm-vma cat workflows/selftests/results/last-run/6.16.0-rc7/vma.userspace.log 16 tests run, 16 passed, 0 failed Generated-by: Claude AI Suggested-by: Liam Howlett Signed-off-by: Luis Chamberlain --- I just asked Claude AI to add support. I hope this shows that adding support is really easy for new selftests even odd tests which are not part of the formal selftests or kunit like this one. This and all my pending patches can be found here: https://github.com/linux-kdevops/kdevops/tree/mcgrof/vma-v2 In case folks are curious, the prompt I used to Claude AI was just (get the npm version, don't use the web interface, that's ancient stuff): We already support testing the Linux kernel maple tree and radix tree on the selftests workflow. These are custom tests and each of these are tested on kdevops in-kernel and then in userspace. The kernel testing is done is there is loadable kernel module for each. We have support for bundling these two tests under the defconfigs/seltests-radix-tree and use SELFTESTS_TEST_BUNDLE_RADIX_TREE to help us bundle radix-tree related tests. We want to extend this with a new userspace only test. Its the vma tests on the kernel but for userspace. So it won't have a corresponding Linux kernel module load, contrary to test_xarray and test_maple_tree. The only thing that needs to be done to test it is to change directory on the linux kernel directory sources into tools/testing/vma and as a user run make -j$(nproc) and then just run sudo ./vma. So add support for this and augment SELFTESTS_TEST_BUNDLE_RADIX_TREE to select this. playbooks/roles/selftests/defaults/main.yml | 2 + playbooks/roles/selftests/tasks/main.yml | 52 ++++++++++++++++----- workflows/selftests/Kconfig | 12 +++++ 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/playbooks/roles/selftests/defaults/main.yml b/playbooks/roles/selftests/defaults/main.yml index 9700b00cfd18..dc5982fb5f63 100644 --- a/playbooks/roles/selftests/defaults/main.yml +++ b/playbooks/roles/selftests/defaults/main.yml @@ -22,6 +22,7 @@ selftests_section_kmod: False selftests_section_maple: False selftests_section_sysctl: False selftests_section_xarray: False +selftests_section_vma: False selftests_ksrc: "tools/testing/selftests/" selftests_data: "{{ target_linux_dir_path }}/{{ selftests_ksrc }}" @@ -35,3 +36,4 @@ selftest_kernelspace: False selftest_xarray: False selftest_maple: False +selftest_vma: False diff --git a/playbooks/roles/selftests/tasks/main.yml b/playbooks/roles/selftests/tasks/main.yml index f080d8c0c8c2..657f93bbb6a9 100644 --- a/playbooks/roles/selftests/tasks/main.yml +++ b/playbooks/roles/selftests/tasks/main.yml @@ -28,15 +28,17 @@ vars: is_selftest_xarray: "{{ 'xarray' in ansible_host }}" is_selftest_maple: "{{ 'maple' in ansible_host }}" + is_selftest_vma: "{{ 'vma' in ansible_host }}" set_fact: selftest_xarray: "{{ is_selftest_xarray }}" selftest_maple: "{{ is_selftest_maple }}" + selftest_vma: "{{ is_selftest_vma }}" tags: ['vars'] - name: Check if this node is in charge of userspace tests vars: set_fact: - selftest_userspace: "{{ selftest_xarray or selftest_maple }}" + selftest_userspace: "{{ selftest_xarray or selftest_maple or selftest_vma }}" tags: ['vars'] - name: Check if this node is in charge of running kernel tests @@ -50,6 +52,7 @@ Host: {{ ansible_host }} - selftest_xarray: {{ selftest_xarray }} - selftest_maple: {{ selftest_maple }} + - selftest_vma: {{ selftest_vma }} - selftest_kernelspace: {{ selftest_kernelspace }} - selftest_userspace: {{ selftest_userspace }} tags: ['run_tests'] @@ -69,7 +72,7 @@ - name: Fail if selftest_kernelspace is true on incorrect host fail: msg: "Both selftest_userspace and selftest_kernelspace are True for host {{ ansible_host }}. This is not expected." - when: (selftest_kernelspace and (selftest_xarray or selftest_maple)) + when: (selftest_kernelspace and (selftest_xarray or selftest_maple or selftest_vma)) tags: ['vars'] - name: Remove /lib/udev/rules.d/50-firmware.rules @@ -189,6 +192,26 @@ - bootlinux_9p|bool - selftests_build_radix_tree|bool +- name: Build VMA tools/testing/vma + tags: [ 'selftests', 'build' ] + make: + chdir: "{{ target_linux_dir_path }}/tools/testing/vma" + jobs: "{{ nproc.stdout }}" + when: + - not bootlinux_9p|bool + - selftest_vma|bool + +- name: Build VMA tools/testing/vma on host + tags: [ 'selftests', 'build' ] + command: "make -j{{ nproc.stdout }}" + args: + chdir: "{{ bootlinux_9p_host_path }}/tools/testing/vma" + delegate_to: localhost + run_once: true + when: + - bootlinux_9p|bool + - selftest_vma|bool + # We use the target node only, not the host as if you've enaabled # 9p the path will be available and everything will have been built # for us. @@ -315,6 +338,7 @@ - kdevops_run_selftests|bool - selftests_build_radix_tree|bool - selftest_userspace|bool + - not selftest_vma|bool vars: command_to_run: > {%- if selftest_xarray -%} @@ -332,20 +356,25 @@ become_method: sudo command: "{{ command_to_run }}" args: - chdir: "{{ target_linux_dir_path }}/tools/testing/radix-tree" + chdir: "{{ test_target_dir }}" register: selftests_userspace_out when: - kdevops_run_selftests|bool - - selftests_build_radix_tree|bool - - selftest_userspace|bool + - (selftests_build_radix_tree|bool and selftest_userspace|bool and not selftest_vma|bool) or selftest_vma|bool vars: - command_to_run: > - {%- if selftest_xarray -%} - ./xarray - modprobe test_xarray + test_target_dir: >- + {%- if selftest_vma -%} + {{ target_linux_dir_path }}/tools/testing/vma + {%- else -%} + {{ target_linux_dir_path }}/tools/testing/radix-tree + {%- endif -%} + command_to_run: >- + {%- if selftest_vma -%} + ./vma + {%- elif selftest_xarray -%} + ./xarray && modprobe test_xarray {%- elif selftest_maple -%} - ./maple - modprobe test_maple_tree + ./maple && modprobe test_maple_tree {%- else -%} echo missing command {%- endif -%} @@ -450,6 +479,7 @@ dest: "{{ selftests_workdir}}/module.log" when: - selftest_userspace|bool + - not selftest_vma|bool - name: Look for the test output logs files on {{ selftests_workdir }} tags: [ 'selftests', 'copy_results' ] diff --git a/workflows/selftests/Kconfig b/workflows/selftests/Kconfig index ea69775c7f9e..f34e2f145bd6 100644 --- a/workflows/selftests/Kconfig +++ b/workflows/selftests/Kconfig @@ -33,6 +33,7 @@ config SELFTESTS_TEST_BUNDLE_RADIX_TREE output yaml select SELFTESTS_SECTION_MAPLE select SELFTESTS_SECTION_XARRAY + select SELFTESTS_SECTION_VMA help This will ensure you test the radix tree in the kernel. @@ -78,6 +79,12 @@ config SELFTESTS_SECTION_XARRAY help This will create a host to test the xarray. +config SELFTESTS_SECTION_VMA + bool "VMA" + output yaml + help + This will create a host to test the VMA userspace tests. + endif # SELFTESTS_MANUAL_COVERAGE if !SELFTESTS_MANUAL_COVERAGE @@ -107,6 +114,11 @@ config SELFTESTS_SECTION_XARRAY output yaml default y +config SELFTESTS_SECTION_VMA + bool + output yaml + default y + endif # !SELFTESTS_MANUAL_COVERAGE endmenu -- 2.45.2