mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "André Almeida" <andrealmeid@igalia.com>
To: Wake Liu <wakel@google.com>
Cc: Shuah Khan <shuah@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Darren Hart <dvhart@infradead.org>,
	linux-kselftest@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Carlos Llamas <cmllamas@google.com>,
	linux-kernel@vger.kernel.org, kernel-dev@igalia.com
Subject: Re: [PATCH 1/3] selftests/futex: Migrate futex_wait to harness
Date: Mon, 25 May 2026 15:51:09 -0300	[thread overview]
Message-ID: <5ae41797-83ef-4896-b67f-0ec6f957de67@igalia.com> (raw)
In-Reply-To: <20260525092002.3762888-2-wakel@google.com>

Em 25/05/2026 06:20, Wake Liu escreveu:
> Migrate futex_wait test to the kselftest harness framework,
> removing mixed legacy ksft_* API usages and ensuring proper thread joining.
> 

Why is this patchset not part of the same series that you just sent?

> Signed-off-by: Wake Liu <wakel@google.com>
> ---
>   .../selftests/futex/functional/futex_wait.c   | 125 +++++++++++-------
>   1 file changed, 77 insertions(+), 48 deletions(-)
> 
> diff --git a/tools/testing/selftests/futex/functional/futex_wait.c b/tools/testing/selftests/futex/functional/futex_wait.c
> index 7b8879409007..ed4b040600b8 100644
> --- a/tools/testing/selftests/futex/functional/futex_wait.c
> +++ b/tools/testing/selftests/futex/functional/futex_wait.c
> @@ -9,6 +9,7 @@
>   #include <sys/shm.h>
>   #include <sys/mman.h>
>   #include <fcntl.h>
> +#include <stdlib.h>
>   
>   #include "futextest.h"
>   #include "kselftest_harness.h"
> @@ -19,125 +20,153 @@
>   
>   void *futex;
>   
> +struct waiter_args {
> +	struct __test_metadata *_metadata;
> +	unsigned int flags;
> +};
> +
>   static void *waiterfn(void *arg)
>   {
> +	struct waiter_args *args = (struct waiter_args *)arg;
> +	struct __test_metadata *_metadata = args->_metadata;

As much as I like the benefits of being able to properly use the harness 
macros in threads, I fell like we are touching private structs here. Are 
they safe to be used concurrently? If a child thread an the main thread 
fails, does that counts as two fails?

Perhaps we should have a look to create a kselftest wrapper for 
pthread_create().

>   	struct timespec to;
> -	unsigned int flags = 0;
> -
> -	if (arg)
> -		flags = *((unsigned int *) arg);
> +	int res;
>   
>   	to.tv_sec = 0;
>   	to.tv_nsec = timeout_ns;
>   
> -	if (futex_wait(futex, 0, &to, flags))
> -		printf("waiter failed errno %d\n", errno);
> +	res = futex_wait(futex, 0, &to, args->flags);
> +	if (res) {
> +		EXPECT_EQ(res, 0)

I have changed it to ASSERT_EQ(res, -1) just to see what happens when a 
child thread fails, but the test still reported PASSED: 3 / 3

  reply	other threads:[~2026-05-25 18:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25  9:19 [PATCH 0/3] selftests/futex: Migrate wait functional tests " Wake Liu
2026-05-25  9:20 ` [PATCH 1/3] selftests/futex: Migrate futex_wait " Wake Liu
2026-05-25 18:51   ` André Almeida [this message]
2026-05-26  1:25     ` Wake Liu
2026-07-05 19:54   ` [tip: locking/futex] " tip-bot2 for Wake Liu
2026-05-25  9:20 ` [PATCH 2/3] selftests/futex: Migrate futex_wait_private_mapped_file " Wake Liu
2026-07-05 19:54   ` [tip: locking/futex] " tip-bot2 for Wake Liu
2026-05-25  9:20 ` [PATCH 3/3] selftests/futex: Migrate futex_wait_uninitialized_heap " Wake Liu
2026-07-05 19:54   ` [tip: locking/futex] " tip-bot2 for Wake Liu

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=5ae41797-83ef-4896-b67f-0ec6f957de67@igalia.com \
    --to=andrealmeid@igalia.com \
    --cc=cmllamas@google.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@kernel.org \
    --cc=wakel@google.com \
    /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®