Received: by 2002:ac0:b7d5:0:0:0:0:0 with SMTP id v21csp118772ime; Thu, 28 Jul 2022 19:33:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s+YSzlwuWfGByEXm6cCx7XodvpDLlMgW0oEn9h+8Zjx0mgtJGAvZTbISAnD2iXIXs/fktZ X-Received: by 2002:a17:906:a089:b0:72f:826b:e084 with SMTP id q9-20020a170906a08900b0072f826be084mr1279834ejy.708.1659062001064; Thu, 28 Jul 2022 19:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659062001; cv=none; d=google.com; s=arc-20160816; b=tqIG7Xzeyf9quhLwTFrxFagkNU+BrHQw8xpL+YHPFNmRl6esGgC7AFuStuVVcaHnfk AHbp7LB/I9KDmqItA7RB/wLCHnN1PjYZeFeZlwgnMHLCjTupZ8s9RdRZYWLRqB/LJ2bh NVmv2ppLdT3ERbUMbp5itJJEec6vNevNcNB0XrDrAdLoKMs4H10FZ9u8cEh8+Db0cEvG T3utkznM6qYkwqP6sphufFqpoVvHWu4JbFNZm/ruw69aRWBwslzHOcUKZ5Sulcp7b19e wy7LiqMpdsOF2RfakUtT1cv6W9jF2bHMQ0jW6y8klZ1UrHPFvM+5tKKs79dsIkjJfjcO y4hw== 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=ZHc9nj1zG6l1lDNnRJA6n2v06Sw0GInnY1XjYJyzwrU=; b=rVoMs/TJe/wQ5YTZg/RTsn3JCtXs8nPwd3SKR5mIVwrE+S6fnIRSM6w5KOmsvbD0Dc N+Cnlr9e3jJy/lzTFWX/r/kg1by58Q/X5i1Z2DrqkLAYdCWjKmbYtlcUDx0hu/XrPcwP T4FP2TziT/+5mT/Eco4hCUSEtpSb8yOHmUrrSR7Bpe/1oaEA57FdRkNGqEyZzP+v9zja H82++Fk/ZDNF/yyH7wO5UDSxCfvtjU+M7Q0d/yJDuvLNL9GONmAxwCLZ/u7en47VL76t HLyJ7fAzmsrOuiiIYgoomopdwkD9kOxfKqm8njy+rfZE6XPXTKkFypWFtbExuyv/R7BR ORGQ== 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 xa11-20020a170906fd8b00b00702d8b7438csi681876ejb.326.2022.07.28.19.32.56; Thu, 28 Jul 2022 19:33:21 -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 S233713AbiG2C26 (ORCPT + 99 others); Thu, 28 Jul 2022 22:28:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233686AbiG2C25 (ORCPT ); Thu, 28 Jul 2022 22:28:57 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1C707AC16 for ; Thu, 28 Jul 2022 19:28:55 -0700 (PDT) Received: from fsav315.sakura.ne.jp (fsav315.sakura.ne.jp [153.120.85.146]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 26T2SfTE079144; Fri, 29 Jul 2022 11:28:41 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav315.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav315.sakura.ne.jp); Fri, 29 Jul 2022 11:28:41 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav315.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 26T2SebN079141 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Fri, 29 Jul 2022 11:28:40 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: Date: Fri, 29 Jul 2022 11:28:40 +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> <97cbf8a9-d5e1-376f-6a49-3474871ea6b4@I-love.SAKURA.ne.jp> In-Reply-To: <97cbf8a9-d5e1-376f-6a49-3474871ea6b4@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 Thinking more, I might be confused by difference between the lockdep "struct work_struct" dependency handling and the lockdep "struct work" dependency handling . In an example that work3_function() { /* nothing */ } work4_function() { mutex_lock(&mutex); ... } other_function() { queue_work(ordered_wq, &work3); queue_work(ordered_wq, &work4); mutex_lock(&mutex); cancel_work_sync(&work4); } , possibility of deadlock must be reported by lockdep via the lockdep "struct work" dependency handling. Then, prior to commit d6e89786bed977f3, lockdep flagging the lockdep "struct work_struct" dependency handling as if cancel_work_sync() was flush_work() is a problem, and lockdep not flagging the lockdep "struct work" dependency handling from cancel_work_sync() as if flush_work() is also a problem. Then, commit d6e89786bed977f3 might be OK, but commit 87915adc3f0acdf0 was wrong in that it preserved lockdep not flagging the lockdep "struct work" dependency handling from cancel_work_sync() as if flush_work().