From patchwork Sat Jan 28 02:18:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: develop--- via Libc-alpha X-Patchwork-Id: 55444 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 83B3F3858281 for ; Sat, 28 Jan 2023 02:19:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83B3F3858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674872345; bh=VtqQmfywnfkeNrJ/TAhkr3NqlYQL0JXahKMyeeQcGs8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=lMJ4Y4AR/fe7FPagpp8UdlrSICZMnZ/xZzMGWt8U2q2yAhuOq3m9S5z0Xlo5ceDU9 oRrmy/i/bDSN1KZNshYSjMyf2joJWw4NvLdALpaoyGaCEGmkhc60Z2PJV3un9MFdyY DBC4cPrbZTif7ypQ8b3j7Cc9e/489g8XBF4dvnvw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by sourceware.org (Postfix) with ESMTPS id C3E5B3858D28 for ; Sat, 28 Jan 2023 02:18:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3E5B3858D28 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 658343200908; Fri, 27 Jan 2023 21:18:35 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 27 Jan 2023 21:18:35 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddvjedggeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepmhgrlhhtvghs khgrrhhuphhkvgesfhgrshhtmhgrihhlrdhfmhenucggtffrrghtthgvrhhnpeeiudeltd efudejudefieetheduhefgudfhveegleektdekffdvgffggeffudegvdenucffohhmrghi nhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepmhgrlhhtvghskhgrrhhuphhkvgesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: ifa6c408f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 27 Jan 2023 21:18:34 -0500 (EST) To: libc-alpha@sourceware.org Cc: Malte Skarupke Subject: [PATCH 0/9] Patch to fix glibc condition variable bug (BZ 25847) Date: Fri, 27 Jan 2023 21:18:20 -0500 Message-Id: <20230128021829.7990-1-malteskarupke@fastmail.fm> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: malteskarupke--- via Libc-alpha From: develop--- via Libc-alpha Reply-To: malteskarupke@fastmail.fm Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" From: Malte Skarupke The following emails are patches to fix the glibc condition variable bug, BZ 25847. The first patch is Frank Barrus' patch, as he submitted it on bugzilla. Patch 2 fixes up comments and indentation, finishing the patch. Further patches in the series do follow-up clean-up, like removing unnecessary checks and unnecessary variables. All of these patches are verified in TLA+ so that I am at least sure that they don't introduce some similar issue. The condition variable implementation also got a lot simpler as a result, so it is now much easier to reason about, further increasing confidence. The code for the TLA+ checking is here: https://github.com/skarupke/glibc_tla_plus Please note that this will probably be my last attempt to submit a patch. I have submitted two series of patches before and was mostly greeted with silence. If the same thing happens again, I'm going to give up on glibc. Frank Barrus (1): pthreads NPTL: lost wakeup fix 2 Malte Skarupke (8): nptl: Update comments and indentation for new condvar implementation nptl: Remove unnecessary catch-all-wake in condvar group switch nptl: Remove unnecessary quadruple check in pthread_cond_wait nptl: Remove g_refs from condition variables nptl: Use a single loop in pthread_cond_wait instaed of a nested loop nptl: Fix indentation nptl: rename __condvar_quiesce_and_switch_g1 nptl: Use all of g1_start and g_signals nptl/pthread_cond_broadcast.c | 8 +- nptl/pthread_cond_common.c | 109 ++-------- nptl/pthread_cond_signal.c | 19 +- nptl/pthread_cond_wait.c | 278 +++++------------------- nptl/tst-cond22.c | 12 +- sysdeps/nptl/bits/thread-shared-types.h | 4 +- sysdeps/nptl/pthread.h | 2 +- 7 files changed, 100 insertions(+), 332 deletions(-)