Received: by 2002:ac0:b7d5:0:0:0:0:0 with SMTP id v21csp103827ime; Thu, 28 Jul 2022 18:52:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tHe3MznVQjH0a2LEX0GkdBRjnn9Rz35zEEuUryw5czGt3dcWTef34anV7xJX3zv3hjSuBz X-Received: by 2002:a05:6402:e96:b0:43a:f21f:42a0 with SMTP id h22-20020a0564020e9600b0043af21f42a0mr1490230eda.382.1659059534990; Thu, 28 Jul 2022 18:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659059534; cv=none; d=google.com; s=arc-20160816; b=aLj3ApuDiRRkMjF3CZHz44mAIsaL0Pc314dVN4JKnKH0xz4wtp67A85hexmPjBt4AO ujTMQImG/5yHO+9HMZo54mfAOQL5S/YckT9wmF02jfYy4Zysi8LWwijKXVPBaLVb+7NW 1TviUYMuERNkaNked83dGA4DF+Q5Bn2l3AVsDK+t2ZCT2haSTRkI3UVdpQyP4ep71utQ nzRzr2GrQ/NrFIx1+RQ86CaQTmn4ndNp5fVA9hEpoqzrdVCYHcVLa3o0qDdOVXXI4z+m JlJn0iMv0f9lhCJswK3V1CNjmZPREZmcWyedmeMzQKVTSQa7ZL2hg0mtrfT/6Iw7ReD1 UlqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id; bh=5BRMzC0ITcYPAaoeS/QELcXmjhewi3OZcVxpNHT3bZA=; b=vwl4Bzeuka2vk5BN0eBza20blMKKwP+zsDW75cGcI3601vlXJ+9JC8S5VFAuHXdpqX NMieznaIb+sq+Rnw9U9OQcuaei4v+noX5Hj+c6JB22Ew0OINhpdjbs2wO8g77rxwnxVt XskrycUSPF4h9WuZFW5ILpt2rm8Hag69eVQIf0dRb6sP26jrzWFeef+YhfEBvIjir/Sa qc1+a1sAzsgHeOHFzideJgYQUeNCDOr3Yqf9c0FzSMpCDKj0V3NAOJL9OI0O3hSL4TSo pYCGWM9TAIzCXBr7iWu1UdsFfga+eVHUEDIPgKpmmybV4LpPyzpEuDzDnmWlwALmIUEu bc8A== 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 lz20-20020a170906fb1400b0072f36fddba7si1831610ejb.812.2022.07.28.18.51.50; Thu, 28 Jul 2022 18:52:14 -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 S233708AbiG2BtU (ORCPT + 99 others); Thu, 28 Jul 2022 21:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbiG2BtT (ORCPT ); Thu, 28 Jul 2022 21:49:19 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C813D54AF1 for ; Thu, 28 Jul 2022 18:49:17 -0700 (PDT) Received: from fsav115.sakura.ne.jp (fsav115.sakura.ne.jp [27.133.134.242]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 26T1n3Gp068884; Fri, 29 Jul 2022 10:49:03 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav115.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav115.sakura.ne.jp); Fri, 29 Jul 2022 10:49:03 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav115.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 26T1n2W8068878 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Fri, 29 Jul 2022 10:49:03 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <97cbf8a9-d5e1-376f-6a49-3474871ea6b4@I-love.SAKURA.ne.jp> Date: Fri, 29 Jul 2022 10:49:01 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] workqueue: don't skip lockdep wq dependency in cancel_work_sync() Content-Language: en-US From: Tetsuo Handa To: Johannes Berg Cc: Lai Jiangshan , Hillf Danton , LKML , Tejun Heo References: <21b9c1ac-64b7-7f4b-1e62-bf2f021fffcd@I-love.SAKURA.ne.jp> <0ad532b2-df5f-331a-ae7f-21460fc62fe2@I-love.SAKURA.ne.jp> In-Reply-To: <0ad532b2-df5f-331a-ae7f-21460fc62fe2@I-love.SAKURA.ne.jp> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE 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 Johannes, why did you think that flagging it as if cancel_work_sync() was flush_work() is a problem? Unconditionally recording "struct mutex" mutex->lockdep_map => "struct work_struct" work1->lockdep_map "struct mutex" mutex->lockdep_map => "struct work_struct" work2->lockdep_map chains has zero problem. Unconditionally recording "struct mutex" mutex->lockdep_map => "struct workqueue_struct" ordered_wq->lockdep_map chain when ordered_wq can process only one work item at a time in order to indicate that the ordered_wq is currently unable to process other works has zero problem. The example shown in commit d6e89786bed977f3 ("workqueue: skip lockdep wq dependency in cancel_work_sync()") is nothing but violation of a rule that "Do not hold a lock from a work callback function (do not record "struct work_struct" work1->lockdep_map => "struct mutex" mutex->lockdep_map "struct workqueue_struct" ordered_wq->lockdep_map => "struct mutex" mutex->lockdep_map chain) if somebody might wait for completion of that callback function with that lock held (might record "struct mutex" mutex->lockdep_map => "struct work_struct" work1->lockdep_map "struct mutex" mutex->lockdep_map => "struct workqueue_struct" ordered_wq->lockdep_map chain)." Which in-tree ordered workqueue instance is hitting this problem?