From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8860A53B0 for ; Tue, 16 Aug 2022 17:21:58 +0000 (UTC) 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 03A7241A42; Tue, 16 Aug 2022 17:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1660670515; bh=b4EG0LTa8HIU16A9LTbhnmpSiFXMqiYjr5/PwslTjn8=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=NDT/wfyLBeksVX2whoG656IQBELw8GrtdHHV+e91oqOaTh4aoCoJMqrimcMRgCKMm jcPpxORLtiwU3jdv6kY4lb55rhK3SnU5u1d+ViIbpE214Gx0s6jL3euXb1ZUcCmhqN hP6mAI8e2e2qYlB9F3LLuUKfbb02+QKOr+/idlac/vUYib2MgR6/sPAWyHNQsMJTy4 M/dk7OBEaK4kb2/93j6+4ny+f0Hd4mctuYhUIj/zJacFroP12Rh3t19U58un/RGvRB Zoi8N98LHEmAz3ocSL2lfxyODbctXAaeyrzL81rVK9vPMT1CMn58xSMgum03QxIQ+r lfGz7DmjJG3uQ== Message-ID: Date: Wed, 17 Aug 2022 02:21:48 +0900 Precedence: bulk X-Mailing-List: asahi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*() Content-Language: es-ES To: Tejun Heo , Herbert Xu Cc: Linus Torvalds , will@kernel.org, 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: From: Hector Martin In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 17/08/2022 01.26, Tejun Heo wrote: > Hello, > > On Tue, Aug 16, 2022 at 12:15:38PM +0800, Herbert Xu wrote: >> Tejun Heo wrote: >>> >>> Oh, tricky one and yeah you're absolutely right that it makes no sense to >>> not guarantee barrier semantics when already pending. I didn't even know >>> test_and_set_bit() wasn't a barrier when it failed. Thanks a lot for hunting >>> down and fixing this. Applied to wq/for-6.0-fixes. >> >> Please revert this as test_and_set_bit was always supposed to be >> a full memory barrier. This is an arch bug. > > Alright, reverting. FYI, Linus applied the alternate fix directly to his tree already, so this is fixed on M1 either way. However, you may want to pay attention to the discussion about the subtlety of the workqueue code pairing test_and_set_bit() not with clear_bit(), but rather atomic_long_set(), since it *could* imply it is still broken or might be broken in the future, on other architectures. - Hector 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 F29EBC25B0E for ; Tue, 16 Aug 2022 17:23:06 +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=9bt/emfL53bfeDevcqmgLnhDq889WiPvc1SBwJXik+A=; b=pY5e3aI/5TfCEo KkLJSvvakY/uF+A43nOE7F/HZ5OgpsPR78qZGf8j6E11PLHC3t7yuuIAluD2y3qTkjKxvtaHgNOp0 g+Y7Eh3UoIK4KDT3mKA7zpCt0g1W0LxHR97C/lMegvLIM8PhUxJox1bR5OrS6Ys/5PJbxZt6pUu/D S7rue4x5EBizMJrzkUmZMaxlYEfcWF2HWZG8sp9Y+P0aYKtZlboNi22K5OJpRTWOw/1X8mB96N57O IBGVuh8u4LMpmHVG7zLpdOAtxCf67uAE9OHNtomspIMtGRTqAAFM9wnXr8cV/6m7hyw96AxQPN+Dx qGRuBTaS98e7a8TutAOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oO0GP-005Efl-BJ; Tue, 16 Aug 2022 17:22:01 +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 1oO0GM-005EdI-CH for linux-arm-kernel@lists.infradead.org; Tue, 16 Aug 2022 17:22:00 +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 03A7241A42; Tue, 16 Aug 2022 17:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1660670515; bh=b4EG0LTa8HIU16A9LTbhnmpSiFXMqiYjr5/PwslTjn8=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=NDT/wfyLBeksVX2whoG656IQBELw8GrtdHHV+e91oqOaTh4aoCoJMqrimcMRgCKMm jcPpxORLtiwU3jdv6kY4lb55rhK3SnU5u1d+ViIbpE214Gx0s6jL3euXb1ZUcCmhqN hP6mAI8e2e2qYlB9F3LLuUKfbb02+QKOr+/idlac/vUYib2MgR6/sPAWyHNQsMJTy4 M/dk7OBEaK4kb2/93j6+4ny+f0Hd4mctuYhUIj/zJacFroP12Rh3t19U58un/RGvRB Zoi8N98LHEmAz3ocSL2lfxyODbctXAaeyrzL81rVK9vPMT1CMn58xSMgum03QxIQ+r lfGz7DmjJG3uQ== Message-ID: Date: Wed, 17 Aug 2022 02:21:48 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*() Content-Language: es-ES To: Tejun Heo , Herbert Xu Cc: Linus Torvalds , will@kernel.org, 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: From: Hector Martin In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220816_102158_619726_5B31758B X-CRM114-Status: GOOD ( 12.10 ) 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 17/08/2022 01.26, Tejun Heo wrote: > Hello, > > On Tue, Aug 16, 2022 at 12:15:38PM +0800, Herbert Xu wrote: >> Tejun Heo wrote: >>> >>> Oh, tricky one and yeah you're absolutely right that it makes no sense to >>> not guarantee barrier semantics when already pending. I didn't even know >>> test_and_set_bit() wasn't a barrier when it failed. Thanks a lot for hunting >>> down and fixing this. Applied to wq/for-6.0-fixes. >> >> Please revert this as test_and_set_bit was always supposed to be >> a full memory barrier. This is an arch bug. > > Alright, reverting. FYI, Linus applied the alternate fix directly to his tree already, so this is fixed on M1 either way. However, you may want to pay attention to the discussion about the subtlety of the workqueue code pairing test_and_set_bit() not with clear_bit(), but rather atomic_long_set(), since it *could* imply it is still broken or might be broken in the future, on other architectures. - Hector _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel