Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3438433rwb; Tue, 16 Aug 2022 03:06:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR7iJTbZQSZcOZfd0cJ8z10XVlMTtOycQbar/piRjs7ZxFQ8Kffm8NKHiRmHYpTYx6JfNC9f X-Received: by 2002:a17:90b:b03:b0:1f3:6fb:bd20 with SMTP id bf3-20020a17090b0b0300b001f306fbbd20mr33016107pjb.38.1660644393177; Tue, 16 Aug 2022 03:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660644393; cv=none; d=google.com; s=arc-20160816; b=ejF7OaqChKLOWum+3hMh7gkHeDiRH+O/uKi6s7t3cx0ZABBipO4x8kse0ujZy+2B0R 6MdlXwuqPjc/yYclT/NOOHft1y7rbbOBR5iA48rzywiSJnkh0Pd3bOXHugbq9rQ74Qnm dQnXVBJOLLzzUfu+WlyA//jlMng5Hd0kCUT7W++if884Tmc70f3fLZz3AUctTiCa28WY DzwRE2rpyEU8S64McWIDZTTyCDrwOR0zHV3ArL3Jj0oTI1V8K+wrmOvzxoWnpyHRwMEl gZ67L6dHSO1tG6hFgtaVj4/eX+E1Q63EbyJWkNO3PXLQvw9PVZsyjfvxtXgCjaWtg3FO 76ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=xFjdScezQnlA2wf8gV0X7CpK7mHFpc5aDWW/aGjfCd4=; b=rRGEVVLlV/GgkVL8HXMZHFD90qPJlKQ81UGlYSnEHxig2aRbohsYXQ+6KOL3Doe/2B YN+GZtEiu9Tsz/H69d9aMxK5r871LPhQuyNibkvrezx738OW2EscjOvnO/CYBcyikxr0 nt1LoG/Ne2vkt+3meGhfuz1HbcM6VjMRO4OcrvRHZyYTFDMTdj20NphbgpilfC1OiPMZ uoVj3Kl1tHddP+vU0OcglCir6v2Tz38qFeo72D0wi/5a2GpRTTtLOwQx1F/8V7CddzIg /Km3IcfursnA893twbvPVFDlUO2XvZxguaYBaPvRPNCH+/1S9WRCfvKiLP3ShYlYCQ2M C4xA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a170902c40e00b001727963f929si2727272plk.130.2022.08.16.03.06.20; Tue, 16 Aug 2022 03:06:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233468AbiHPJaF (ORCPT + 99 others); Tue, 16 Aug 2022 05:30:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233435AbiHPJ3V (ORCPT ); Tue, 16 Aug 2022 05:29:21 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8F4DA0616; Tue, 16 Aug 2022 00:48:32 -0700 (PDT) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1oNrIu-00BXvH-6U; Tue, 16 Aug 2022 17:48:01 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Tue, 16 Aug 2022 15:48:00 +0800 Date: Tue, 16 Aug 2022 15:48:00 +0800 From: Herbert Xu To: Hector Martin Cc: Linus Torvalds , Will Deacon , Tejun Heo , peterz@infradead.org, jirislaby@kernel.org, maz@kernel.org, mark.rutland@arm.com, boqun.feng@gmail.com, catalin.marinas@arm.com, oneukum@suse.com, roman.penyaev@profitbricks.com, asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*() Message-ID: References: <24c88c4f-aea5-1fb7-0ead-95c88629d72b@marcan.st> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24c88c4f-aea5-1fb7-0ead-95c88629d72b@marcan.st> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 16, 2022 at 03:28:50PM +0900, Hector Martin wrote: > > This is the same reason I argued queue_work() itself needs to have a > similar guarantee, even when it doesn't queue work (and I updated the > doc to match). If test_and_set_bit() is used in this kind of context > often in the kernel, clearly the current implementation/doc clashes with > that. Kernel code all over the place rely on the fact that test_and_set_bit provides a memory barrier. So this bug that you've discovered is not at all isolated to the workqeueue system. It'll break the kernel in lots of places in exactly the same way. > As I said, I don't have any particular beef in this fight, but this is > horribly broken on M1/2 right now, so I'll send a patch to change the > bitops instead and you all can fight it out over which way is correct :) Please do. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt