[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe02f42b-7ba8-4a3b-a86c-2a4a7942fd3b@linuxfoundation.org>
Date: Wed, 4 Sep 2024 10:46:11 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: André Almeida <andrealmeid@...lia.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Darren Hart <dvhart@...radead.org>,
Davidlohr Bueso <dave@...olabs.net>, Shuah Khan <shuah@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org,
kernel-dev@...lia.com, Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH v2] selftests/futex: Create test for robust list
On 9/3/24 07:40, André Almeida wrote:
> Create a test for the robust list mechanism.
What does this test - can you elaborate on the testing
details? It will help reviewers catch if any tests are
missed or not - be able to review the patch.
Include output from the test in the chane log.
>
> Signed-off-by: André Almeida <andrealmeid@...lia.com>
> ---
> Changes from v1:
> - Change futex type from int to _Atomic(unsigned int)
> - Use old futex(FUTEX_WAIT) instead of the new sys_futex_wait()
> ---
> .../selftests/futex/functional/.gitignore | 1 +
> .../selftests/futex/functional/Makefile | 3 +-
> .../selftests/futex/functional/robust_list.c | 448 ++++++++++++++++++
> 3 files changed, 451 insertions(+), 1 deletion(-)
> create mode 100644 tools/testing/selftests/futex/functional/robust_list.c
>
> diff --git a/tools/testing/selftests/futex/functional/.gitignore b/tools/testing/selftests/futex/functional/.gitignore
> index fbcbdb6963b3..4726e1be7497 100644
> --- a/tools/testing/selftests/futex/functional/.gitignore
> +++ b/tools/testing/selftests/futex/functional/.gitignore
> @@ -9,3 +9,4 @@ futex_wait_wouldblock
> futex_wait
> futex_requeue
> futex_waitv
> +robust_list
> diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
> index f79f9bac7918..b8635a1ac7f6 100644
> --- a/tools/testing/selftests/futex/functional/Makefile
> +++ b/tools/testing/selftests/futex/functional/Makefile
> @@ -17,7 +17,8 @@ TEST_GEN_PROGS := \
> futex_wait_private_mapped_file \
> futex_wait \
> futex_requeue \
> - futex_waitv
> + futex_waitv \
> + robust_list
>
> TEST_PROGS := run.sh
>
> diff --git a/tools/testing/selftests/futex/functional/robust_list.c b/tools/testing/selftests/futex/functional/robust_list.c
> new file mode 100644
> index 000000000000..9308eb189d48
> --- /dev/null
> +++ b/tools/testing/selftests/futex/functional/robust_list.c
> @@ -0,0 +1,448 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2024 Igalia S.L.
> + *
> + * Robust list test by André Almeida <andrealmeid@...lia.com>
> + *
> + * The robust list uAPI allows userspace to create "robust" locks, in the sense
> + * that if the lock holder thread dies, the remaining threads that are waiting
> + * for the lock won't block forever, waiting for a lock that will never be
> + * released.
> + *
> + * This is achieve by userspace setting a list where a thread can enter all the
> + * locks (futexes) that it is holding. The robust list is a linked list, and
> + * userspace register the start of the list with the syscall set_robust_list().
> + * If such thread eventually dies, the kernel will walk this list, waking up one
> + * thread waiting for each futex and marking the futex word with the flag
> + * FUTEX_OWNER_DIED.
> + *
> + * See also
> + * man set_robust_list
> + * Documententation/locking/robust-futex-ABI.rst
> + * Documententation/locking/robust-futexes.rst
> + */
> +
> +#define _GNU_SOURCE
> +
> +#include "../../kselftest_harness.h"
futex test suite doesn't kselftest_harness at the moment.
Let's not mix and match the framework in the same test
suite. Keep it consistent.
thanks,
-- Shuah
Powered by blists - more mailing lists