From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC49CC2BB41 for ; Tue, 16 Aug 2022 08:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W2n7ZO7Qkk/cbWV/ZwicgazNwXAPx6zZEFfD4WVDzUw=; b=dProsAPTojf9hu Nj6/yzIrOi5fOIcz9ObIAI59dg/HXX8EWlj9pxKvLbdlavvKveh9Llcva5mdqz8MJUuvGNNGMH69u TRcSs5EJC6/MOBdvz3LgZAbxX/wX8vLGOM/spmcuTb16u6z+ij/sIseTCOF5U4PfTADqiGpsA8XfV 2f9WvgGKoiQ9vyIMVRjBtUUwZ/V3OJiGo4gqj2+O25L/AXSWltvmRbxSuWdH1m61CLZrfXMaUX5+F mzHBzzc9FmvWsirQj2T8BOoZi+tZNRJZ2J0FG+WdpL8ol5r2DxrU/Uq7LG5nZx3tAU7sFZd8q5Jqg mGov13lwPwxPPr4w66fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNrWR-00FxLY-3u; Tue, 16 Aug 2022 08:02:03 +0000 Received: from marcansoft.com ([212.63.210.85] helo=mail.marcansoft.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNrWI-00Fx8X-GU for linux-arm-kernel@lists.infradead.org; Tue, 16 Aug 2022 08:01:53 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id 8E23941A42; Tue, 16 Aug 2022 08:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1660636907; bh=hdO0VK1BgxthiOSTlr+e1eaO5dfWp+h7FMXRza4Hsq4=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=DaLeUy6iahjaMjN9JrVNc57ZozIWEObhc79ETbuWH6F4g2xflaB0R2I9U12Ei7s5z c2ZH7+UHYhXpQJr/ul4lQrS49JpL1YF7DD9LwwdH4J5nC8ZbMlz2YlPqtjkybNBjIs NsSOqPqMrknOup3Ju2HGcGoQYJ2pptLHhZNC0aP439quZj3TRIADaHsix5DBPMXU53 ELmGSpq3U830ZMod7U3u/QdZK09aGS4ZGkyip3lnTzJPuVW6UtzLV26E3hyR39MfK1 RBnjaozfwBmzm+dzR+FXJ11o1uU1z/E9CG2t1asjvQoCksdVzIj+wetB8Lw79d7aAV eol3iUbS6rPYQ== Message-ID: <0c0ba856-a4ba-7133-e751-3a81c82311a9@marcan.st> Date: Tue, 16 Aug 2022 17:01:39 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*() Content-Language: en-US To: Herbert Xu 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 References: <24c88c4f-aea5-1fb7-0ead-95c88629d72b@marcan.st> From: Hector Martin In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220816_010150_790665_8621251D X-CRM114-Status: GOOD ( 15.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022/08/16 16:48, Herbert Xu wrote: > 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. Now I'm surprised this isn't failing all over the place, given that... these things are annoyingly subtle. Still would want Will & Peter to chime in, of course. >> 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. Already did, but I just realized I forgot to Cc you. Sorry about that, hope you can pick it up through the MLs: https://lore.kernel.org/asahi/20220816070311.89186-1-marcan@marcan.st/T/#u - Hector _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel