Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2727461iob; Mon, 16 May 2022 05:05:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdGmT1e+SKt9+iBXrP0r8Sq0EYS9jYwKVYdTEHTGl7bmfHxZ9Wr3F9JSJUfskZVPqpUJA4 X-Received: by 2002:a7b:cc0d:0:b0:381:220e:a3a0 with SMTP id f13-20020a7bcc0d000000b00381220ea3a0mr16318904wmh.59.1652702708420; Mon, 16 May 2022 05:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652702708; cv=none; d=google.com; s=arc-20160816; b=s8gTye+8NTqAdEG02ittw1oc+GdZ2YZpT9AB40p5cWvguf+ykC1xRGb3qLyXRdRJaB x3shhg5oOprLFKviN3HIK+VZxw9/qD0CWmFrpxGJX/AulvRIBie5vpQi1+dQheemQFHE n/pWwfZRQV9xTaTB8zyhYoUJHQbwbQCPya3YItdlvm2tMGeu802uigJJp87Q0qL4PVXo k2miMk/ijNOoVg9PI5L0UEHN+NJI1O4wErxyqtp2PkTMzmMXqEPaPIKM0loA7A+xVd/8 yjc2iG4HEfM5mjjuxIj5OzoeUDarIQG8e2lB68Wf2B2od9ND0pByLpO5LYrXABrelcxx Sltw== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=QoiT+bYyNbQ0YN5of+5iVJjYaB1I6zfgBJGbDFl00u4=; b=mcborVgpHLnAopqIagGxB6uD9LqnEjS0nBcbTt3QkO+R4cC8iCJSnv9WM5MikfPOzm AViymuywT2yyAe3x3rP5yZVwXMFzWkxjPElwt4x5lkz42+8Pc0oMGPW3bcnWjItuZH/b PLIEL905N2WwK30rq/lHvyrxhG4+rUH3xGBAAp4MkLuKt38TWaesRBnt1Lrk7YUV7oqL FWeiBkAWaULCe3g0bpriOwr8anvz+VZ2kkE1dQNVVbJltaPCqfJIKRQglqJCFgO6rALj WsNbvAkBofVHiBQO0oTgeBUozdHVdYp139Tm3LwA/5Jz/kCsVq52QlSq8YB6xP6R9vqP +b1A== 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 e1-20020a5d6d01000000b00206cc1a0200si9078982wrq.533.2022.05.16.05.04.34; Mon, 16 May 2022 05:05:08 -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 S239201AbiEPB5N (ORCPT + 99 others); Sun, 15 May 2022 21:57:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236803AbiEPB5M (ORCPT ); Sun, 15 May 2022 21:57:12 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9376AEE28 for ; Sun, 15 May 2022 18:57:10 -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 24G1v2n4002859; Mon, 16 May 2022 10:57:02 +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); Mon, 16 May 2022 10:57:02 +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 24G1v2ML002856 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Mon, 16 May 2022 10:57:02 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: Date: Mon, 16 May 2022 10:56:58 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v3 (repost)] workqueue: Warn flushing of kernel-global workqueues Content-Language: en-US To: Dmitry Torokhov Cc: Linus Torvalds , Lai Jiangshan , LKML , Tejun Heo References: <2efd5461-fccd-f1d9-7138-0a6767cbf5fe@I-love.SAKURA.ne.jp> <33772dcb-c5dd-c5e7-30c8-d2397d21b26c@I-love.SAKURA.ne.jp> From: Tetsuo Handa In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On 2022/05/12 22:13, Dmitry Torokhov wrote: > Also as far as I can see the patch was rejected. Not rejected. I sent https://lkml.kernel.org/r/7b2fecdb-59ae-2c54-5a5b-774ef7054d1b@I-love.SAKURA.ne.jp for 5.19. >> We currently don't have a flag to tell whether the caller is inside module unload >> path. And even inside module unload path, flushing the system-wide workqueue is >> problematic under e.g. GFP_NOFS/GFP_NOIO context. > > Sorry, I do not follow here. Are there module unloading code that runs > as GFP_NOFS/GFP_NOIO? It is GFP_KERNEL context when module's __exit function is called. But whether flush_workqueue() is called from restricted context depends on what locks does the module's __exit function hold. If request_module() is called from some work function using one of system-wide WQs, and flush_workqueue() is called on that WQ from module's __exit function, the kernel might deadlock on module_mutex lock. Making sure that flush_workqueue() is not called on system-wide WQs is the safer choice.