]> www.infradead.org Git - users/hch/dma-mapping.git/commit
selftests/mm: replace atomic_bool with pthread_barrier_t
authorEdward Liaw <edliaw@google.com>
Thu, 3 Oct 2024 21:17:10 +0000 (21:17 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 17 Oct 2024 07:28:06 +0000 (00:28 -0700)
commite61ef21e27e8deed8c474e9f47f4aa7bc37e138c
tree85e2c6ba8f5b7dbc53d63cd1cb385c1cdeef0521
parent963a7f4d3b90ee195b895ca06b95757fcba02d1a
selftests/mm: replace atomic_bool with pthread_barrier_t

Patch series "selftests/mm: fix deadlock after pthread_create".

On Android arm, pthread_create followed by a fork caused a deadlock in the
case where the fork required work to be completed by the created thread.

Update the synchronization primitive to use pthread_barrier instead of
atomic_bool.

Apply the same fix to the wp-fork-with-event test.

This patch (of 2):

Swap synchronization primitive with pthread_barrier, so that stdatomic.h
does not need to be included.

The synchronization is needed on Android ARM64; we see a deadlock with
pthread_create when the parent thread races forward before the child has a
chance to start doing work.

Link: https://lkml.kernel.org/r/20241003211716.371786-1-edliaw@google.com
Link: https://lkml.kernel.org/r/20241003211716.371786-2-edliaw@google.com
Fixes: cff294582798 ("selftests/mm: extend and rename uffd pagemap test")
Signed-off-by: Edward Liaw <edliaw@google.com>
Cc: Lokesh Gidra <lokeshgidra@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/uffd-common.c
tools/testing/selftests/mm/uffd-common.h
tools/testing/selftests/mm/uffd-unit-tests.c