On Tue, 28 Apr 2026 12:58:01 +0200, Sebastian Andrzej Siewior wrote:

>> This patch avoids this problem by checking whether the child thread is

>This patch.

Sorry, I haven't submitted patches many times.

> The pthread_barrier you introduced is not enough?
> You also increase the wait-timeout to 3s and parse the wait function.
> You could describe what the expectation here is. I would assume that the
> barrier on its own should be enough. But the barrier and the state
> parsing is a bit much. This makes me curious what is so special on your
> side that it does not work as-is. Is this some big-little case where the
> big creates the thread and does requeue while the littke is supposed to
> do futex_wait but falls behind?

Originally, I also thought that using pthread_barrier would be sufficient.
However, according to the actual tests on our platform, it's not enough.
After adding pthread_barrier, the problem occurs even more frequently.

Based on my speculation and actual tests, using pthread_barrier still cannot
guarantee that the child threads will reach the futex_wait stage.

>> +    EXPECT_EQ(0, futex_thread_create(&waiter, waiterfn, NULL));

> Why this ASSERT_EQ -> EXPECT_EQ ?

Sorry, ASSERT_EQ should indeed be used here. When thread creation fails,
the subsequent execution should be stopped directly.

>> -    pthread_t waiter[10];
>> -    int i;
>> +    struct futex_thread waiter[10];

> Couldn't that `i# remain where it was and that waiter moved as per Xmas
> notation?

Of course. Thank you very much for your suggestions.

My native language is Chinese. I can't perceive the subtle changes in various
expressions. Please forgive me if there is something inappropriate in my tone
of expression.

Meanwhile, I'd also be very glad if you could help make some modifications.
I've just joined the community and there are still many things I don't 
understand.

The following link is an earlier version of this patch:
https://lore.kernel.org/all/[email protected]/

yuwen


Reply via email to