mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: tglx@kernel.org, peterz@infradead.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	juri.lelli@redhat.com, vincent.guittot@linaro.org,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	kprateek.nayak@amd.com, paulmck@kernel.org, boqun@kernel.org,
	shuah@kernel.org, kees@kernel.org, viro@zeniv.linux.org.uk,
	brauner@kernel.org, jack@suse.cz, oleg@redhat.com,
	bestswngs@gmail.com, xmei5@asu.edu, xujiakai24@mails.ucas.ac.cn,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, kmehltretter@gmail.com
Subject: [PATCH v2 10/13] selftests/rseq: Test two race windows of the concurrency ID mode switches
Date: Tue,  1 Dec 2026 19:27:58 -0500	[thread overview]
Message-ID: <212cdc1e4b36069d1fb0129e8179b5350df329d8.1796169827.git.mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <cover.1796169827.git.mathieu.desnoyers@efficios.com>

Two bugs of the concurrency ID mode switches show only when a task is
scheduled inside a narrow window. The header comment of the new test
draws each sequence as a diagram:

- Case 1: a failed execve() rejoins the mm and switches it to per CPU
  mode. This needs a kernel where a failed execve() leaves the mm.
- Case 2: a thread migrates while the mm switches to per CPU mode. This
  is the sequence of commit 4327fb13fa47 ("sched/mmcid: Prevent live
  lock on task to CPU mode transition").

Without a delay in the kernel, a test reaches these windows only by
chance. Add mm_cid_window_test, with one case for each window. Each case
makes 40 attempts, each with another delay. Case 1 runs on 2 CPUs. It
fails on an mm_cid at or above the number of possible CPUs, or when the
failed execve() takes more than 100ms. An mm_cid of 2 or more only gets
a note, as in mm_cid_execve_test. Case 2 needs 3 to 256 CPUs, all
possible CPUs allowed. It fails when the moving thread has not moved
after 2s.

On tip sched/urgent, case 1 fails on guests with 2 to 64 CPUs. It fails
on another bug of the same rejoin, which mm_cid_execve_test also finds.
Unless the task is scheduled out in the window, it returns to user space
with no ID. Its mm_cid is 0x80000000, printed in decimal:

  mm_cid 2147483648 after a failed execve, 2 possible CPUs
  not ok 1 failed execve switches to per CPU mode

Case 1 passes after "sched/mmcid: Move the execve() hooks into
exec_mmap()". A failed execve() then no longer leaves the mm. Case 1
stays as a guard: if the rejoin comes back, it fails on 0x80000000
again. Case 2 passes on tip sched/urgent and after each of patches 1
to 4.

A kernel that makes a thread sleep in the window hits it on every
attempt. The test header names the places. Case 2 was checked this way,
on a kernel with patches 1 to 4 and two changes:

- The switch to per CPU mode skipped its transit phase. This undoes
  the fix of the commit above.
- sched_mm_cid_fork() slept 3ms in fsleep(), after the mode change and
  before mm_cid_fixup_tasks_to_cpus().

Case 2 then hung eight guests with 3 to 16 CPUs. RCU stall reports
showed a test thread looping in __schedule(). With the fsleep() alone,
case 2 passed on the same eight guests.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 tools/testing/selftests/rseq/.gitignore       |   1 +
 tools/testing/selftests/rseq/Makefile         |   3 +-
 .../selftests/rseq/mm_cid_window_test.c       | 525 ++++++++++++++++++
 3 files changed, 528 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/rseq/mm_cid_window_test.c

diff --git a/tools/testing/selftests/rseq/.gitignore b/tools/testing/selftests/rseq/.gitignore
index 4c02ff8dccca..0065f51f53ab 100644
--- a/tools/testing/selftests/rseq/.gitignore
+++ b/tools/testing/selftests/rseq/.gitignore
@@ -13,6 +13,7 @@ mm_cid_bound_test
 mm_cid_execve_test
 mm_cid_transition_test
 mm_cid_exec_affinity_test
+mm_cid_window_test
 syscall_errors_test
 slice_test
 legacy_check
diff --git a/tools/testing/selftests/rseq/Makefile b/tools/testing/selftests/rseq/Makefile
index 006e2e281ca8..d72502fc7652 100644
--- a/tools/testing/selftests/rseq/Makefile
+++ b/tools/testing/selftests/rseq/Makefile
@@ -21,7 +21,8 @@ OVERRIDE_TARGETS = 1
 TEST_GEN_PROGS = basic_test basic_percpu_ops_test basic_percpu_ops_mm_cid_test \
 		 param_test_benchmark param_test_mm_cid_benchmark \
 		 mm_cid_execve_test mm_cid_transition_test \
-		 mm_cid_bound_test mm_cid_exec_affinity_test
+		 mm_cid_bound_test mm_cid_exec_affinity_test \
+		 mm_cid_window_test
 
 TEST_GEN_PROGS_EXTENDED = librseq.so \
 	param_test \
diff --git a/tools/testing/selftests/rseq/mm_cid_window_test.c b/tools/testing/selftests/rseq/mm_cid_window_test.c
new file mode 100644
index 000000000000..32527fd3015f
--- /dev/null
+++ b/tools/testing/selftests/rseq/mm_cid_window_test.c
@@ -0,0 +1,525 @@
+// SPDX-License-Identifier: LGPL-2.1
+/*
+ * Two race windows of the concurrency ID mode switches.
+ *
+ * Each case drives its threads through one sequence in which the kernel
+ * used to loop in mm_get_cid(), looking for a free ID. The window is
+ * narrow, so an attempt rarely lands in it. Each attempt uses another
+ * delay. On a kernel with the bug, an attempt that misses the window
+ * passes. A kernel that loops shows as a timeout.
+ *
+ * Case 1 needs a kernel where a failed execve(2) leaves the mm and
+ * rejoins it, as before "sched/mmcid: Move the execve() hooks into
+ * exec_mmap()". The process runs on two CPUs, in per task mode. A and B
+ * are its two threads, on CPU 0 and CPU 1. C is the vfork(2) child of B,
+ * so it shares the mm. The mm uses two IDs, 0 and 1. On a machine with
+ * two possible CPUs, these are the only IDs.
+ *
+ *   CPU 0                                  CPU 1
+ *
+ *   A: execve(2)
+ *      sched_mm_cid_before_execve()
+ *        drops the ID of A
+ *                                          B: vfork(2)
+ *                                             sched_mm_cid_fork(C)
+ *                                               C takes the free ID
+ *                                          B: waits for C
+ *                                          C: spins, never schedules
+ *   A: execve(2) fails with ELOOP
+ *      sched_mm_cid_after_execve()
+ *        sched_mm_cid_fork(A): 3 users,
+ *        sets MM_CID_ONCPU | MM_CID_TRANSIT
+ *   A: is scheduled out, and in again
+ *      mm_cid_schedin()
+ *        mm_get_cid() loops: B and C
+ *        hold both IDs
+ *   A: mm_cid_fixup_tasks_to_cpus()
+ *      is never reached
+ *
+ * Only that fixup could free an ID, and it runs in A. With more possible
+ * CPUs, mm_get_cid() does not loop. It takes an ID of 2 or more. That ID is
+ * below the number of possible CPUs, the only bound, so the case prints a
+ * note and passes.
+ *
+ * Before that change, sched_mm_cid_fork() gives A no ID in per CPU mode.
+ * Unless A is scheduled out in the window, it returns to user space with
+ * no ID and reads an mm_cid of 0x80000000. Case 1 then fails on that
+ * value. Since that change, a failed execve(2) stays in the mm and the
+ * sequence cannot happen. Case 1 stays as a guard against a return of the
+ * rejoin.
+ *
+ * Case 2 is the sequence of commit 4327fb13fa47 ("sched/mmcid: Prevent
+ * live lock on task to CPU mode transition"). The diagram shows a kernel
+ * without the transit phase which that commit added. The process is
+ * allowed on all possible CPUs, so the mm has one ID per CPU. M is its
+ * main thread, on CPU 0. T1 and T2 are two of the threads which M starts,
+ * one on each other CPU.
+ *
+ *   CPU 0                     CPU 1                     CPU 2
+ *
+ *   M: starts one spinning
+ *      thread on each other
+ *      CPU: every ID is taken
+ *                             T1: spins                 T2: spins
+ *   M: pthread_create()
+ *      sched_mm_cid_fork():
+ *        one user too many,
+ *        switches to per CPU
+ *        mode
+ *                             T1: usleep(), then
+ *                                 mm_cid_schedin():
+ *                                 CPU 1 takes the
+ *                                 ID of T1
+ *                             T1: sched_setaffinity()
+ *                                 to CPU 2
+ *                                                       T2: preempted,
+ *                                                           keeps its ID
+ *                                                       T1: mm_cid_schedin()
+ *                                                           mm_get_cid()
+ *                                                           loops, with the
+ *                                                           rq lock held
+ *   M: mm_cid_fixup_tasks_to_cpus()
+ *      waits for the rq lock
+ *      of CPU 2
+ *
+ * With that commit, T1 drops its ID when it leaves CPU 1. mm_get_cid() on
+ * CPU 2 then takes it.
+ *
+ * A kernel with an added sleep inside the window hits it on every
+ * attempt. The thread which switches the mode, A in case 1 and M in case
+ * 2, would sleep in these places:
+ * - in sched_mm_cid_fork(), after the mode change and before
+ *   mm_cid_fixup_tasks_to_cpus() (both cases);
+ * - in sched_mm_cid_after_execve(), before sched_mm_cid_fork(), on a
+ *   kernel where a failed execve(2) rejoins the mm (case 1).
+ */
+
+#define _GNU_SOURCE
+#include <errno.h>
+#include <limits.h>
+#include <pthread.h>
+#include <sched.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/prctl.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "rseq.h"
+#include "kselftest.h"
+
+#define ATTEMPTS	40
+#define MAX_DELAY_US	400
+#define SPIN_MS		300
+#define SLOW_MS		100
+#define MAX_SPINNERS	256
+#define MOVE_WAIT_MS	2000
+
+#define CHILD_PASS	0
+#define CHILD_FAIL	1
+#define CHILD_SKIP	2
+#define CHILD_ERROR	3
+
+static int go, done, moved, ready, stop;
+static int pin_failed;
+static int delay_us;
+static int nr_possible;
+static int cpus[MAX_SPINNERS], nr_cpus;
+static char exec_path[PATH_MAX];
+
+static long long now_us(void)
+{
+	struct timespec ts;
+
+	clock_gettime(CLOCK_MONOTONIC, &ts);
+	return ts.tv_sec * 1000000LL + ts.tv_nsec / 1000;
+}
+
+static void busy_wait_us(int us)
+{
+	long long end = now_us() + us;
+
+	while (now_us() < end)
+		;
+}
+
+/* Join @t. Return 0, or the error number after reporting it. */
+static int join_thread(pthread_t t)
+{
+	int err = pthread_join(t, NULL);
+
+	if (err)
+		fprintf(stderr, "pthread_join: %s\n", strerror(err));
+	return err;
+}
+
+/* Remove @path. Return 0, or -1 after reporting the error. */
+static int remove_file(const char *path)
+{
+	if (unlink(path)) {
+		fprintf(stderr, "unlink %s: %s\n", path, strerror(errno));
+		return -1;
+	}
+	return 0;
+}
+
+static int pin(int cpu)
+{
+	cpu_set_t set;
+
+	CPU_ZERO(&set);
+	CPU_SET(cpu, &set);
+	return sched_setaffinity(0, sizeof(set), &set);
+}
+
+/* Fill @cpus with the allowed CPUs. Return their number. */
+static int read_allowed_cpus(void)
+{
+	cpu_set_t set;
+	int cpu;
+
+	if (sched_getaffinity(0, sizeof(set), &set))
+		return -1;
+	nr_cpus = 0;
+	for (cpu = 0; cpu < CPU_SETSIZE && nr_cpus < MAX_SPINNERS; cpu++) {
+		if (CPU_ISSET(cpu, &set))
+			cpus[nr_cpus++] = cpu;
+	}
+	return CPU_COUNT(&set);
+}
+
+/*
+ * Create a script that names itself as its interpreter. execve(2) on it
+ * follows the interpreter a few times and fails with ELOOP. On a kernel
+ * where a failed execve(2) rejoins the mm, that keeps the task out of its
+ * mm longer than a file of unknown format. Return 0, or -1 if execve(2) on
+ * it does not fail with ELOOP.
+ */
+static int make_loop_script(void)
+{
+	char *const av[] = { exec_path, NULL };
+	FILE *f;
+
+	snprintf(exec_path, sizeof(exec_path), "/tmp/mm_cid_window_test.%d", getpid());
+	f = fopen(exec_path, "w");
+	if (!f)
+		return -1;
+	fprintf(f, "#!%s\n", exec_path);
+	if (fclose(f) || chmod(exec_path, 0755))
+		goto unlink;
+	if (execve(exec_path, av, NULL) == -1 && errno == ELOOP)
+		return 0;
+unlink:
+	remove_file(exec_path);
+	return -1;
+}
+
+/* Run thread B of case 1: call vfork(2) after a delay and wait for C. */
+static void *vfork_thread(void *arg)
+{
+	pid_t pid;
+
+	if (pin(cpus[1])) {
+		RSEQ_WRITE_ONCE(pin_failed, 1);
+		return NULL;
+	}
+	while (!RSEQ_READ_ONCE(go))
+		;
+	busy_wait_us(delay_us);
+	pid = vfork();
+	if (!pid) {
+		long long end = now_us() + SPIN_MS * 1000;
+
+		/* Hold an ID on this CPU without scheduling. */
+		while (!RSEQ_READ_ONCE(done) && now_us() < end)
+			;
+		_exit(0);
+	}
+	if (pid < 0 || waitpid(pid, NULL, 0) != pid) {
+		fprintf(stderr, "vfork: %s\n", strerror(errno));
+		abort();
+	}
+	return NULL;
+}
+
+/*
+ * Run one attempt of case 1 in a new mm on two CPUs. Return a CHILD_*
+ * status.
+ */
+static int run_child_join(int us)
+{
+	char *const av[] = { exec_path, NULL };
+	long long start, end;
+	unsigned int cid;
+	pthread_t b;
+	int err, exec_errno;
+
+	delay_us = us;
+	if (read_allowed_cpus() != 2 || pin(cpus[0]))
+		return CHILD_ERROR;
+	if (make_loop_script()) {
+		fprintf(stderr, "cannot run a script from /tmp\n");
+		return CHILD_SKIP;
+	}
+	if (pthread_create(&b, NULL, vfork_thread, NULL)) {
+		remove_file(exec_path);
+		return CHILD_ERROR;
+	}
+	usleep(200);
+	start = now_us();
+	RSEQ_WRITE_ONCE(go, 1);
+	execve(exec_path, av, NULL);
+	exec_errno = errno;
+	end = now_us();
+	cid = rseq_current_mm_cid();
+	RSEQ_WRITE_ONCE(done, 1);
+	err = join_thread(b);
+	if (remove_file(exec_path) || err)
+		return CHILD_ERROR;
+	if (exec_errno != ELOOP) {
+		fprintf(stderr, "execve(%s): %s, expected ELOOP\n",
+			exec_path, strerror(exec_errno));
+		return CHILD_ERROR;
+	}
+
+	/* B did not run its part if it could not pin itself. */
+	if (pin_failed) {
+		fprintf(stderr, "a thread could not pin itself\n");
+		return CHILD_ERROR;
+	}
+	/* The number of possible CPUs is the only bound. Two is a target. */
+	if (cid >= (unsigned int)nr_possible) {
+		fprintf(stderr, "mm_cid %u after a failed execve, %d possible CPUs\n",
+			cid, nr_possible);
+		return CHILD_FAIL;
+	}
+	if (cid >= 2)
+		fprintf(stderr,
+			"mm_cid %u after a failed execve, reaches the 2 allowed CPUs\n",
+			cid);
+	if (end - start > SLOW_MS * 1000) {
+		fprintf(stderr, "the failed execve took %lld ms\n", (end - start) / 1000);
+		return CHILD_FAIL;
+	}
+	return CHILD_PASS;
+}
+
+/* Spin on the CPU cpus[@arg], as a thread of case 2. Thread 1 also moves. */
+static void *spinner(void *arg)
+{
+	int nr = (long)arg;
+
+	if (pin(cpus[nr])) {
+		RSEQ_WRITE_ONCE(pin_failed, 1);
+		return NULL;
+	}
+	__atomic_add_fetch(&ready, 1, __ATOMIC_RELAXED);
+	while (!RSEQ_READ_ONCE(stop)) {
+		if (nr != 1 || !RSEQ_READ_ONCE(go) || RSEQ_READ_ONCE(moved))
+			continue;
+		busy_wait_us(delay_us);
+		/* Schedule out and in on this CPU, with the new mode set. */
+		usleep(1000);
+		/* Move to the CPU of thread 2, which still holds its own ID. */
+		if (pin(cpus[2]))
+			RSEQ_WRITE_ONCE(pin_failed, 1);
+		RSEQ_WRITE_ONCE(moved, 1);
+	}
+	return NULL;
+}
+
+static void *idler(void *arg)
+{
+	while (!RSEQ_READ_ONCE(stop))
+		usleep(1000);
+	return NULL;
+}
+
+/*
+ * Run one attempt of case 2 in a new mm on all CPUs. Return a CHILD_*
+ * status.
+ */
+static int run_child_migrate(int us)
+{
+	static pthread_t threads[MAX_SPINNERS];
+	int i, started = 0, waited = 0, ret = CHILD_PASS;
+	pthread_t extra;
+
+	delay_us = us;
+	if (read_allowed_cpus() < 3 || pin(cpus[0]))
+		return CHILD_ERROR;
+	for (i = 1; i < nr_cpus; i++) {
+		if (pthread_create(&threads[i], NULL, spinner, (void *)(long)i))
+			break;
+		started++;
+	}
+	if (started < nr_cpus - 1) {
+		ret = CHILD_ERROR;
+		goto out;
+	}
+	/*
+	 * Wait until every thread runs on its CPU and holds an ID. A thread
+	 * whose pin failed sets pin_failed and never gets ready.
+	 */
+	while (RSEQ_READ_ONCE(ready) < started && !RSEQ_READ_ONCE(pin_failed))
+		usleep(100);
+	if (RSEQ_READ_ONCE(pin_failed))
+		goto out;
+	usleep(1000);
+	RSEQ_WRITE_ONCE(go, 1);
+	if (pthread_create(&extra, NULL, idler, NULL)) {
+		ret = CHILD_ERROR;
+		goto out;
+	}
+	while (!RSEQ_READ_ONCE(moved) && waited++ < MOVE_WAIT_MS)
+		usleep(1000);
+	if (!RSEQ_READ_ONCE(moved)) {
+		fprintf(stderr, "the moving thread did not move\n");
+		ret = CHILD_FAIL;
+	}
+	RSEQ_WRITE_ONCE(stop, 1);
+	if (join_thread(extra) && ret == CHILD_PASS)
+		ret = CHILD_ERROR;
+out:
+	RSEQ_WRITE_ONCE(stop, 1);
+	for (i = 1; i <= started; i++) {
+		if (join_thread(threads[i]) && ret == CHILD_PASS)
+			ret = CHILD_ERROR;
+	}
+	/* The sequence did not run as written if a thread could not pin itself. */
+	if (pin_failed) {
+		fprintf(stderr, "a thread could not pin itself\n");
+		ret = CHILD_ERROR;
+	}
+	return ret;
+}
+
+static int read_nr_possible(void)
+{
+	int first, last, total = 0;
+	char sep;
+	FILE *f;
+
+	f = fopen("/sys/devices/system/cpu/possible", "r");
+	if (!f)
+		return -1;
+	/* A list of ranges: "0-63" or "0,2-5". */
+	while (fscanf(f, "%d", &first) == 1) {
+		last = first;
+		sep = '\n';
+		if (fscanf(f, "%c", &sep) == 1 && sep == '-') {
+			if (fscanf(f, "%d", &last) != 1)
+				break;
+			if (fscanf(f, "%c", &sep) != 1)
+				sep = '\n';
+		}
+		total += last - first + 1;
+		if (sep != ',')
+			break;
+	}
+	fclose(f);
+	return total;
+}
+
+/*
+ * Run @fn(@arg) in a new process that starts on the CPUs in @start, and
+ * return its exit status. The new process dies with this one.
+ */
+static int run_under_test(int (*fn)(int), int arg, const cpu_set_t *start,
+			  const cpu_set_t *all)
+{
+	int status = 0;
+	pid_t child;
+
+	if (sched_setaffinity(0, sizeof(*start), start))
+		ksft_exit_fail_msg("sched_setaffinity: %s\n", strerror(errno));
+	child = fork();
+	if (!child) {
+		if (prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0)) {
+			fprintf(stderr, "prctl(PR_SET_PDEATHSIG): %s\n", strerror(errno));
+			_exit(CHILD_ERROR);
+		}
+		_exit(fn(arg));
+	}
+	if (child < 0)
+		ksft_exit_fail_msg("fork: %s\n", strerror(errno));
+	if (sched_setaffinity(0, sizeof(*all), all))
+		ksft_exit_fail_msg("sched_setaffinity: %s\n", strerror(errno));
+	if (waitpid(child, &status, 0) != child)
+		ksft_exit_fail_msg("waitpid: %s\n", strerror(errno));
+	if (!WIFEXITED(status))
+		ksft_exit_fail_msg("the process under test was killed by signal %d\n",
+				   WTERMSIG(status));
+	if (WEXITSTATUS(status) == CHILD_ERROR)
+		ksft_exit_fail_msg("the process under test failed to run\n");
+	return WEXITSTATUS(status);
+}
+
+static void report(int status, const char *name)
+{
+	if (status == CHILD_SKIP)
+		ksft_test_result_skip("%s\n", name);
+	else
+		ksft_test_result(status == CHILD_PASS, "%s\n", name);
+}
+
+int main(void)
+{
+	const char *join = "failed execve switches to per CPU mode";
+	const char *migrate = "thread migrates during the switch to per CPU mode";
+	cpu_set_t all, two;
+	int status, i, cpu, nr_all;
+
+	ksft_print_header();
+	ksft_set_plan(2);
+
+	if (!rseq_available())
+		ksft_exit_skip("rseq is unavailable\n");
+	if (rseq_register_current_thread())
+		ksft_exit_fail_msg("rseq_register_current_thread: %s\n", strerror(errno));
+	if (!rseq_mm_cid_available())
+		ksft_exit_skip("the rseq mm_cid field is unavailable\n");
+	if (sched_getaffinity(0, sizeof(all), &all))
+		ksft_exit_fail_msg("sched_getaffinity: %s\n", strerror(errno));
+	nr_all = CPU_COUNT(&all);
+	nr_possible = read_nr_possible();
+	if (nr_possible <= 0)
+		ksft_exit_skip("cannot read the possible CPUs\n");
+
+	if (nr_all < 2) {
+		ksft_test_result_skip("%s: fewer than 2 CPUs\n", join);
+	} else {
+		CPU_ZERO(&two);
+		for (cpu = 0; cpu < CPU_SETSIZE && CPU_COUNT(&two) < 2; cpu++) {
+			if (CPU_ISSET(cpu, &all))
+				CPU_SET(cpu, &two);
+		}
+		for (i = 0; i < ATTEMPTS; i++) {
+			status = run_under_test(run_child_join, (i * 37) % MAX_DELAY_US,
+						&two, &all);
+			if (status != CHILD_PASS)
+				break;
+		}
+		report(status, join);
+	}
+
+	/* Every ID is taken only when one thread spins on each possible CPU. */
+	if (nr_all < 3 || nr_all > MAX_SPINNERS || nr_all != nr_possible) {
+		ksft_test_result_skip("%s: needs 3 to %d CPUs, all of them allowed\n",
+				      migrate, MAX_SPINNERS);
+	} else {
+		for (i = 0; i < ATTEMPTS; i++) {
+			status = run_under_test(run_child_migrate, (i * 37) % MAX_DELAY_US,
+						&all, &all);
+			if (status != CHILD_PASS)
+				break;
+		}
+		report(status, migrate);
+	}
+	ksft_finished();
+}
-- 
2.47.3


  parent reply	other threads:[~2026-12-02  0:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  0:27 [PATCH v2 00/13] sched/mmcid: fixes for execve, mode switches and affinity Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 01/13] sched/mmcid: Move the execve() hooks into exec_mmap() Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 02/13] sched/mmcid: Add the allowed CPUs of each joining task to the mm Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 03/13] sched/mmcid: Serialize joins and exits with affinity changes by pi_lock Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 04/13] sched/mmcid: Give no concurrency ID to user workers Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 05/13] selftests/rseq: Test the concurrency ID after a failed execve Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 06/13] selftests/rseq: Test the concurrency IDs across ownership mode switches Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 07/13] selftests/rseq: Test the upper bound of the concurrency IDs Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 08/13] selftests/rseq: Test an affinity change by another process during execve Mathieu Desnoyers
2026-12-02  0:27 ` [PATCH v2 09/13] selftests/rseq: Test the concurrency IDs after the affinity is widened Mathieu Desnoyers
2026-12-02  0:27 ` Mathieu Desnoyers [this message]
2026-12-02  0:27 ` [PATCH v2 11/13] selftests/rseq: Test the last user after an affinity change during execve Mathieu Desnoyers
2026-12-02  0:28 ` [PATCH v2 12/13] selftests/rseq: Test the concurrency IDs with an io_uring SQPOLL thread Mathieu Desnoyers
2026-12-02  0:28 ` [PATCH v2 13/13] selftests/rseq: Test the concurrency IDs after clone3() into a wider cpuset Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=212cdc1e4b36069d1fb0129e8179b5350df329d8.1796169827.git.mathieu.desnoyers@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=bestswngs@gmail.com \
    --cc=boqun@kernel.org \
    --cc=brauner@kernel.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jack@suse.cz \
    --cc=juri.lelli@redhat.com \
    --cc=kees@kernel.org \
    --cc=kmehltretter@gmail.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vschneid@redhat.com \
    --cc=xmei5@asu.edu \
    --cc=xujiakai24@mails.ucas.ac.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®