From patchwork Fri Oct 18 17:17:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 13842073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59598D3DEA0 for ; Fri, 18 Oct 2024 17:18:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA7396B0083; Fri, 18 Oct 2024 13:18:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D56226B0088; Fri, 18 Oct 2024 13:18:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1DDF6B0089; Fri, 18 Oct 2024 13:18:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9EBB56B0083 for ; Fri, 18 Oct 2024 13:18:08 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EA421ACE40 for ; Fri, 18 Oct 2024 17:17:43 +0000 (UTC) X-FDA: 82687380720.24.4D2B598 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf05.hostedemail.com (Postfix) with ESMTP id E2323100005 for ; Fri, 18 Oct 2024 17:17:44 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=ltsVJowU; spf=pass (imf05.hostedemail.com: domain of 3TJgSZwYKCAclksph3nvvnsl.jvtspu14-ttr2hjr.vyn@flex--edliaw.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3TJgSZwYKCAclksph3nvvnsl.jvtspu14-ttr2hjr.vyn@flex--edliaw.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729271812; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=09rqkYzv1mj2i541CG3quDs2Oto4Z5t/2Gr1EPh2MJY=; b=dqBbm6dqryT05qMA3k236hBa3r07a+WPgF6zm5HuW7SOPr/8eMAuI0c3yJ4MQ35UG5BAU0 92RL9SguImthRkFUy15YDzTksibSZBbQ6hObzZ23uu6rkOhG9ZP5JpQHqMzwYOIBCgaXvL SjKlfemygMN1E+BPYNr9JJgQWspssdk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=ltsVJowU; spf=pass (imf05.hostedemail.com: domain of 3TJgSZwYKCAclksph3nvvnsl.jvtspu14-ttr2hjr.vyn@flex--edliaw.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=3TJgSZwYKCAclksph3nvvnsl.jvtspu14-ttr2hjr.vyn@flex--edliaw.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729271812; a=rsa-sha256; cv=none; b=c9XZbz+GwDwpGmlffXkLZFs7hjOUFqdnuUD9qvgJb6bTA4efWezeBjAfHATlzpKwrh8zVZ bdlDlbBQMkV4JzTr+lfatSI3S5F9XuMbaDybiuw56y0CEuCt8aFzj/R42KuCo1suxY/Wi6 aunE8gdaAe35Of56QrtLekbe5u19HQA= Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-2e3ce03a701so2655779a91.0 for ; Fri, 18 Oct 2024 10:18:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729271885; x=1729876685; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=09rqkYzv1mj2i541CG3quDs2Oto4Z5t/2Gr1EPh2MJY=; b=ltsVJowUgqHKsB0QeqX55pU1OrrHvdDAjDOPywMrVcglMBbw5fkRZwkho26RA1hePN i52nq3/D3qS28bkDB1U68AmkxlkR5zPbzQuQNmn5WeurCpxzoCKweUEPZgIiEnzmyzG0 enUvaTBdo/gdawZlrJBebY9lamaRc8xu7Y1JfN5VKf5f/G7VqsVLT3wJIdqWcdcHW1bj WULFSX4E8SB9zbzB/fVh0EivtN0FQnob9cy2LwmmjQGiJcWvMhccoOeif1aw6FlROlJZ am7NRpa5w0P4u9XH5FwoDmKq8EragBvwRhq3OWkEcols7P1epV3kmlDRv42v0CIf5S54 Bv/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729271885; x=1729876685; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=09rqkYzv1mj2i541CG3quDs2Oto4Z5t/2Gr1EPh2MJY=; b=WfyQ6svCj2HZNHCo16lvB4u7cIQHrrMXPUNK/y/wRpSBDoSWMiituqJ835KD+ZLgEc zc+CoQuoH8wFKi1MhxhfniytRHnEEHxmLP9ONnHBSLhXXpeQMwLQbDMh0RERZD5GNFNp lwV50ls1fjm47iqlZlOugxxA3WqzMj6q7/QAFlB8rnU08jvBJJYpQIfFAUPOr2k7p6Ui vgr2b/huu8evR4GjQnTN3HE/lnafMEgAZuG+jZuepCVwQG5SaxZAtD7/gLQn9694ypyt RmaMRLKOk6YVKzoM++XVoTDY4o9weJbVMRSH4zUwi+xLmcljm5Do7w9yVEtdR3//3SKv ZlQQ== X-Forwarded-Encrypted: i=1; AJvYcCVANGxrlzs4EonfG9i70g/aAYomZVh7pOL398oH1DHdXwBhO1WXv8S9GPiDgoXjIsuDzYCiSYQl1A==@kvack.org X-Gm-Message-State: AOJu0YyoS53KtIby/HHgW82bHD7UzETS8VLRP/90W6xSwt4hdmXJDLW0 DR8ikwcgfGJtUFuKl0I+Kra73thQN2Sa3fFm/raTKf1+YQU9kxQvA6u/vEEjl6JzY1nFeBRiYpc daw== X-Google-Smtp-Source: AGHT+IFCzoFKtcQsGl5HORvI+qdsZRNBp3NS1MD2ovvhIYOdGqZKLlvaQri87EIXebpvo+p31wOY+8NUM+A= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a17:90a:dc02:b0:2e0:72ab:98e9 with SMTP id 98e67ed59e1d1-2e561511115mr9463a91.0.1729271884764; Fri, 18 Oct 2024 10:18:04 -0700 (PDT) Date: Fri, 18 Oct 2024 17:17:22 +0000 In-Reply-To: <20241018171734.2315053-1-edliaw@google.com> Mime-Version: 1.0 References: <20241018171734.2315053-1-edliaw@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Message-ID: <20241018171734.2315053-2-edliaw@google.com> Subject: [PATCH 1/3] Revert "selftests/mm: fix deadlock for fork after pthread_create on ARM" From: Edward Liaw To: linux-kselftest@vger.kernel.org, Andrew Morton , Shuah Khan , Edward Liaw , Peter Xu Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, linux-mm@kvack.org, Ryan Roberts X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: E2323100005 X-Stat-Signature: qo1zsw96nt1finh7j3uhfyr7d14mmmj8 X-HE-Tag: 1729271864-274404 X-HE-Meta: U2FsdGVkX187XjcMaZUFwzlSR+jaH9OMs91KZpLrZmPbw0ue/lv+4lF8R5jRVnatJKphwIxa0qT1/YuYoSiK96uipv/5cSVk8lwoWiuqnEA6vD2VNdsIUlo1VWhmIV2BVjvps18db3FHAteLl64+/TEeHZ7MxDHzxby1AMPH0vSk+6zvncEVnQ87o7G/SFZSqV66mauMu+onh/WJhi9HkzOSXK3nvgek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odhDnIy4HdJKIzfkoFWheOkVYAgGq0TkrCCIFLszYriuimt5520/kvu6bfUHOr3P7EBdA30VQz3nJjYLxaIgOuNGkm2ulIsT3lys7HIW9SspVM7eW7WmRVva/bm9mBYemN9adIemu+vMfAPOWdFmBEDf1WuNL4HAolanyHCFWpdg8fYWoS2rzEX7qgUzRcjlg7HpWhAWnqhRlRltpScE3VqyXdjVmByxiXTPfW9Yd+eQ1gK+dBZvxwUZ8cZROt/2Ey42T7Z7gGR0N7ErAZtEO9Igby2EwgYU/5adIZmDFg1gAHBQmjt/MuVM3TiskNLXQKDhA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This reverts commit e142cc87ac4ec618f2ccf5f68aedcd6e28a59d9d. fork_event_consumer may be called by other tests that do not initialize the pthread_barrier, so this approach is not correct. The subsequent patch will revert to using atomic_bool instead. Fixes: e142cc87ac4e ("fix deadlock for fork after pthread_create on ARM") CC: Ryan Roberts Signed-off-by: Edward Liaw --- tools/testing/selftests/mm/uffd-unit-tests.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c index c8a3b1c7edff..3db2296ac631 100644 --- a/tools/testing/selftests/mm/uffd-unit-tests.c +++ b/tools/testing/selftests/mm/uffd-unit-tests.c @@ -241,9 +241,6 @@ static void *fork_event_consumer(void *data) fork_event_args *args = data; struct uffd_msg msg = { 0 }; - /* Ready for parent thread to fork */ - pthread_barrier_wait(&ready_for_fork); - /* Read until a full msg received */ while (uffd_read_msg(args->parent_uffd, &msg)); @@ -311,12 +308,8 @@ static int pagemap_test_fork(int uffd, bool with_event, bool test_pin) /* Prepare a thread to resolve EVENT_FORK */ if (with_event) { - pthread_barrier_init(&ready_for_fork, NULL, 2); if (pthread_create(&thread, NULL, fork_event_consumer, &args)) err("pthread_create()"); - /* Wait for child thread to start before forking */ - pthread_barrier_wait(&ready_for_fork); - pthread_barrier_destroy(&ready_for_fork); } child = fork();