Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: "André Almeida" <andrealmeid@igalia.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Darren Hart" <dvhart@infradead.org>,
	"Davidlohr Bueso" <dave@stgolabs.net>,
	"Shuah Khan" <shuah@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kernel-dev@igalia.com, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v2] selftests/futex: Create test for robust list
Date: Wed, 4 Sep 2024 10:46:11 -0600	[thread overview]
Message-ID: <fe02f42b-7ba8-4a3b-a86c-2a4a7942fd3b@linuxfoundation.org> (raw)
In-Reply-To: <20240903134033.816500-1-andrealmeid@igalia.com>

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@igalia.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@igalia.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

  reply	other threads:[~2024-09-04 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 13:40 [PATCH v2] selftests/futex: Create test for robust list André Almeida
2024-09-04 16:46 ` Shuah Khan [this message]
2024-09-08  2:24 ` kernel test robot

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=fe02f42b-7ba8-4a3b-a86c-2a4a7942fd3b@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=andrealmeid@igalia.com \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    /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