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 C435AC28B2C for ; Mon, 15 Aug 2022 19:12:39 +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:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nFc6vEy40g7Fa5KhLdFmSXgUwaeBee+G14aIbXro8R8=; b=mvBqz3oAa1rWQQ ORJQ0S63/UvvtPnFFhndYYsU3F8WMSaQyOJMW4hBCdNRnULrxOMQ53rcgWZS8Vz30UcI/v/YUVK1Z Ihm6b7rm1MMakGFLlQuKHnaCz8DNSwFfFy/4CP6ievFYxtjNjteWmeTM/uoNthjiWBXq0PFmU/yfW FExOhn8+fgNbfmIn8WGqRK7FkZubHaeCuFWEkwhy1RIsIHlZKjhoouzKGBYciil8oevi03W+PrAg6 6CLVUKFJYp1mzvKmt4P62Fs1pDmoS1o6CQkqtnZdSuyRE/XCnjjMYM4IDfd9nFEFXvhZeUCGSa5wJ TF7Ufs9IG7Fi5s63Roiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNfUf-003mMt-Ue; Mon, 15 Aug 2022 19:11:22 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNfU0-003lOi-HQ for linux-arm-kernel@lists.infradead.org; Mon, 15 Aug 2022 19:10:42 +0000 Received: by mail-pj1-x1036.google.com with SMTP id p14-20020a17090a74ce00b001f4d04492faso7568960pjl.4 for ; Mon, 15 Aug 2022 12:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc; bh=KUjRZPqE91jzSYN2iE0zIp+wxb3Fz8jBCptNiXCO28k=; b=nl5D74t6p6a2b7Jz2/xeLL85eNGxMaG3q869rymjnx1KUzapWeOISxWX+Bvmkl4271 z2s1HKqnfi00Leht9JdsPLQHpEJip7s09mwJrSD/co/QWkM4CP7FbOTt3cR8LqhGZjVX W39fR3JaIwng1yNdPmuW5bbBYDG/XxtfJdQhkl0eAfpCrKbB8ByBNKFQEgDQj4WCo46E Vq9u5iMZ2Z1FDRfICD6WBo7Z3wvd9rBk6M0Y1jDkBER6vmrodcDrxVS7C1gpbg576Ugx LpxTfqWuUSnDDOhQVS7U9pznNGBzDyQN40bxh5ZUTnzCn7V53y72UzUUiVUMmUasHbIw FkKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc; bh=KUjRZPqE91jzSYN2iE0zIp+wxb3Fz8jBCptNiXCO28k=; b=HtvZJsG4kOVdkI2uAFQs9wup6GyLJikFlfVB6E2vWeKqMLiNa6P6HffuhGyhXBRIhS MBK6NzYsLlbjPU0Y1wcrprVmRT54SD1cRYey+77ZrAT9fozm2XCb7WiHTDVOBxkEom3t udIjhQ9vNu7yJhAXcuWWbQ9zbC2+lN+Iuq8fI+a3fWzMlR68TQXY9ZLw+QZ3epd5XRha A9Kcyt8BUusgoV/sdMm/9liVNRDzbE44vU/P6oOvDwqPi3i1NmcpEwu89G4e9AuX2r9E oWePz35FNSddiQnpE0Kb6Krsjx3OZCrL6364uTnhW9J67RN1LgkleoqbhFjZ5xNHayKK bKNQ== X-Gm-Message-State: ACgBeo1UmqD+8JQ6PlqF7Is7AzQ2X/Ta518IDaNYeEa28I7oNyoIeDXW G3LMsiA0z+Cfb+0iOJho8zQ= X-Google-Smtp-Source: AA6agR4vn6iDlfADGbaSh46rlmxbHe822Dd3CTfESNqOHC4cvV2/XfoCT4HkKO1FddAI/ECHIaJ6qQ== X-Received: by 2002:a17:90a:20f:b0:1f8:cc20:1216 with SMTP id c15-20020a17090a020f00b001f8cc201216mr17823341pjc.225.1660590637729; Mon, 15 Aug 2022 12:10:37 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:3a69]) by smtp.gmail.com with ESMTPSA id b6-20020a1709027e0600b0016b90620910sm7361957plm.71.2022.08.15.12.10.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 12:10:36 -0700 (PDT) Date: Mon, 15 Aug 2022 09:10:35 -1000 From: Tejun Heo To: Hector Martin Cc: Will Deacon , Peter Zijlstra , jirislaby@kernel.org, Marc Zyngier , Mark Rutland , Boqun Feng , Catalin Marinas , Oliver Neukum , Roman Pen , Asahi Linux , Linux ARM , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] workqueue: Fix memory ordering race in queue_work*() Message-ID: References: <20220815175810.17780-1-marcan@marcan.st> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220815175810.17780-1-marcan@marcan.st> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220815_121041_185214_1BA0C5FB X-CRM114-Status: GOOD ( 14.78 ) 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 Tue, Aug 16, 2022 at 02:58:10AM +0900, Hector Martin wrote: > This has been broken since the dawn of time, and it was incompletely > fixed by 346c09f80459, which added the necessary barriers in the work > execution path but failed to account for the missing barrier in the > test_and_set_bit() failure case. Fix it by switching to > atomic_long_fetch_or(), which does have unconditional barrier semantics > regardless of whether the bit was already set or not (this is actually > just test_and_set_bit() minus the early exit path). ... 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. Thanks. -- tejun _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel