mbox series

[0/2] selftests/mm: fix deadlock after pthread_create

Message ID 20241003211716.371786-1-edliaw@google.com (mailing list archive)
Headers show
Series selftests/mm: fix deadlock after pthread_create | expand

Message

Edward Liaw Oct. 3, 2024, 9:17 p.m. UTC
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.

Updated the synchronization primitive to use pthread_barrier instead of
atomic_bool.

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

Edward Liaw (2):
  selftests/mm: replace atomic_bool with pthread_barrier_t
  selftests/mm: fix deadlock for fork after pthread_create on ARM

 tools/testing/selftests/mm/uffd-common.c     |  5 +++--
 tools/testing/selftests/mm/uffd-common.h     |  3 +--
 tools/testing/selftests/mm/uffd-unit-tests.c | 21 ++++++++++++++------
 3 files changed, 19 insertions(+), 10 deletions(-)

--
2.46.1.824.gd892dcdcdd-goog

Comments

Andrew Morton Oct. 4, 2024, 11:54 p.m. UTC | #1
On Thu,  3 Oct 2024 21:17:09 +0000 Edward Liaw <edliaw@google.com> wrote:

> 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.
> 
> Updated the synchronization primitive to use pthread_barrier instead of
> atomic_bool.
> 
> Applied the same fix to the wp-fork-with-event test.
> 
> Edward Liaw (2):
>   selftests/mm: replace atomic_bool with pthread_barrier_t
>   selftests/mm: fix deadlock for fork after pthread_create on ARM

These fixes have different Fixes: targets, which might cause
backporting issues - some kernels might end up with one patch and not
the other.  Was this intended?  Is it OK?