From patchwork Thu Oct 3 21:17:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 13821595 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 47CF8CF34C3 for ; Thu, 3 Oct 2024 21:17:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA4FB8D0006; Thu, 3 Oct 2024 17:17:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B55A78D0003; Thu, 3 Oct 2024 17:17:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1CFD8D0006; Thu, 3 Oct 2024 17:17:30 -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 84AE58D0003 for ; Thu, 3 Oct 2024 17:17:30 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 06A96C0882 for ; Thu, 3 Oct 2024 21:17:30 +0000 (UTC) X-FDA: 82633552260.15.0D88C74 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by imf26.hostedemail.com (Postfix) with ESMTP id 41C10140017 for ; Thu, 3 Oct 2024 21:17:27 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=a2sI2xfL; spf=pass (imf26.hostedemail.com: domain of 35Qn_ZgYKCDQUTbYQmWeeWbU.SecbYdkn-ccalQSa.ehW@flex--edliaw.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=35Qn_ZgYKCDQUTbYQmWeeWbU.SecbYdkn-ccalQSa.ehW@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=1727990118; 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: references:dkim-signature; bh=UcHV8WURcnYuTep7jYDWQX5sxa0kfFCRTwwcajmItvQ=; b=RFyGkE4xVudibhg7ul4l1gWSErEdpEpxYT8mlnF5EBct44IGO2OYYTN6CyAp+RZWkAK2Dv o17BgxTNCdN0inm7R+KFzCx5lFJ5AnRcJEMknH1gDtZxo0BzyZ7cQt2Xrh3ANOl9VMm3NE wJ9PToeGs+HOhhVOvMyMzk7sHsBZJYg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727990118; a=rsa-sha256; cv=none; b=ZlJyA8kk/YVMESO8t8IcpauV/q2Pnsz4VulYjM1AbKg4k5j0cQ3t0bLLc/bsyfwFJul2RN KkzWJcJ3rZ140/tv4rOJmc2KO0lYxMwr55JtsqY6mPu+SepApL4yZbD2H5mkOOy422bFQu 1EHkr4C9qjGnN73rxT0AHhZWJ5qzRNY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=a2sI2xfL; spf=pass (imf26.hostedemail.com: domain of 35Qn_ZgYKCDQUTbYQmWeeWbU.SecbYdkn-ccalQSa.ehW@flex--edliaw.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=35Qn_ZgYKCDQUTbYQmWeeWbU.SecbYdkn-ccalQSa.ehW@flex--edliaw.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-70ac9630e3aso1017076a12.1 for ; Thu, 03 Oct 2024 14:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727990246; x=1728595046; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=UcHV8WURcnYuTep7jYDWQX5sxa0kfFCRTwwcajmItvQ=; b=a2sI2xfLaLLMNOFm3+o+fPqfbWIOTAUYLdlczMvnTVfRwttDJMwVcWh3wPkmFbJhbP RgVLzpqpN01aXSrjnSNTAzMauRikzwejqgn2tlCCW6WhYomaMspxqqbx5m1t9hbrRWBn h0fN5+ok6OydzhaoFLS+6RgHHrU70owYQtcMkY4AeAAq89IPS5Iv25BuwwRpSLPIESu6 92liPW0Xhq3oSpTJnqm4HnK6Ne6VEgJlFXhabBykmTg95zrkLs8cLJcGiQUvvpbas97g HMg1zsY7h0BPN8zdSJCUkjsC7EhN/Cc14X7Wvd5m6c0lUiEXCHdKyzsDNvW5hhuUzMP/ yTtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727990246; x=1728595046; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=UcHV8WURcnYuTep7jYDWQX5sxa0kfFCRTwwcajmItvQ=; b=udfkyefwpSvf58BONNvpek5URIoIpcOn0Hf7sBoas3UypPBZnCzgiscmYZvVS3MHIl aVytsy+EoMHf8xRYkawj2wz58Aro1eTfzv72+jYbFGkgKL0ZmaqBICRUtbT/HDqJZhRn YmkHwsuU0Zo0ErcjyCueBmoYvV2/PNgYfMXJLIevZUrJzYqTVi67/tGEjpSKjyepGhYs e5GbO+h7UfHk3SkY6cZDhDpy+bhj1rsZILuzbGC2rpt0SxJ0Np7wQGo8Iw1zUlDqZNoe RwujUfLrf2gP/tVs57+BV+ygfdVLqQ5AkO1wf0pQABOal8psGU08Hbxlmv6EWu36DW1X afjA== X-Forwarded-Encrypted: i=1; AJvYcCXaoIrdRZaAVXkTUl2Wx8KoFF8mqvdQOStm3qBGwey5VPpEApo+q5EWRpfkLMaIG72j5MQvi8/Nyg==@kvack.org X-Gm-Message-State: AOJu0Yw76uKl0IitXSN8lvT1U16wkuP3N8WD5IIZ10P6MARo1Z/h/jfD H2PtHAZD35zC3fBZTEqhDEsiNQouCmEZJwMTdV957ZBw78UQOhxGB/bnjyJK1PN2pkBPrIgBJ2/ Lnw== X-Google-Smtp-Source: AGHT+IG5hVqNff98quNB5O4IO0Yjm/qlW0YAQSi7ApmuRiktThVtGG3FOUNL8wWJTpELBRqtrcCttJhelDY= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a63:fc1d:0:b0:7cd:8b5f:2567 with SMTP id 41be03b00d2f7-7e9e59bb2ccmr1656a12.4.1727990245571; Thu, 03 Oct 2024 14:17:25 -0700 (PDT) Date: Thu, 3 Oct 2024 21:17:09 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241003211716.371786-1-edliaw@google.com> Subject: [PATCH 0/2] selftests/mm: fix deadlock after pthread_create From: Edward Liaw To: linux-kselftest@vger.kernel.org, Andrew Morton , Shuah Khan , Lokesh Gidra , Edward Liaw , Peter Xu Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, linux-mm@kvack.org X-Rspamd-Queue-Id: 41C10140017 X-Stat-Signature: y57raamhqskwo9cb9b964krirdpq34y3 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1727990247-22661 X-HE-Meta: U2FsdGVkX1/yJVzjvWVzqZ+ILCNjKhWhHvIMs+RtwfPUzp75RrQ9/VxDd8Afk6MMPVx2FEXX95nhq1ex9vCVMvfPjysswCG8zhyxVu38U/vIl4T3MpEXqvB0kkrc1s1o5qzI1+WMtOZoMlo6tSOrFU73HtXI/gFrO5btpQwPeCe+yiphjIAK3szaSgoJEiXLJMv03zVCjQNa2LsIBvnHY5o01LMK/mkKMNmPFEGnk2G4OUxc9dZWyhz69v13fTnyqOW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2syOKHlj2uS5hXo7cSBNwJsSgd5IIsqPOWXW0Ttj3hnt4iGh5vkqCiP6fithtj0pbtg2GooIxrpyYolh9aENdmTrqn5eSbPY//e5TA28iMqTE6xFlZUhVL+uiiq8TSLF2Yd+bB0ZzwU07Cyf2U/uIqIX9kNJa/eyuDwM9KA2jWVBjTImwJRP+FPUti8osRaNeWPiPYBYcPbLYQCUAb1HZsh5hWnqzCrDkXz9xJeyFykw9s+cjUixa2Sry8l60Cc+UcQY0Y66Mwgf6qrtZ X-Bogosity: Ham, tests=bogofilter, spamicity=0.017195, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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