Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7806334rwr; Wed, 10 May 2023 12:58:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ND0mUGOEOgAQJ6MRE/TzJz3GCC/FH2WbN7yj+iLXsZvOTcEf4AJaIgEKLFtuesPyTCz3N X-Received: by 2002:a17:903:32cb:b0:1ab:7c4:eb24 with SMTP id i11-20020a17090332cb00b001ab07c4eb24mr24171392plr.22.1683748705880; Wed, 10 May 2023 12:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683748705; cv=none; d=google.com; s=arc-20160816; b=ZiOqCTqmageAmqfV7lhmmRg5RvEmHxFEUMOjrrP3K51DArys96rWczLLJu7/sIbV3O llrYjwAoQhHDBVOLMnS2ytMjOrsWxF9pwfJh6tUW9Fvt6AaovhtWBRw71Z2bvzQn/jUp lPkVsLm/jVTBel+VpVlmXkn9GqsJ1fJBgfMT00GoJVIJCkcFGJazydLQ1FCkcovJXmg8 Ko/99FmwhgWSz1rDnY0OlIgGByex7hJhMCW3y5U/3KEWiuzJtuuxxnBE1bfGNgdG2FDH 2WPUQtKvzzcr9zwy805ih5uQcgNcKyjE4MvyGSS5oIvSitc5/0wur1n2MnvVaYplj4t6 hhdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=St8Hsth3yEssLy+3L8DNZSzYbP8LaSjJkmswj6bNhNY=; b=sYqwwDmr6BQymAs1GYMn1G2OZGmoAwapIOTCBdFV+kJJXY1hrYDkR5YLF4GZz5H+QH L7RE8B+UN+5AKihPTsAEdHW86poHnzF7VGmLumHj6ehb2e5G/8oz1pRqot6kHupLZVO9 KDaZOrwFNDT9zxMAIexH/F7qpZbkrTzZ9+uW7fVWf8zPtbqpbWonchPirDKqXWXfFsyR DgoFh4dg11VRuOf8Zgn1d6OjUmxzs8T3TtxIv+17a/Kmj699/RZZoJtpu0atr/cAHxbx IHzrSVEV4m4BjTZ7Rwu8weB6wLzb2MbW2G0R0kZahWuKsLVrZS9Fcm77lDcPDTN0cTSl 7XYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jmprtQ6v; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a170902748100b001ab1b9d50c0si4583302pll.540.2023.05.10.12.58.13; Wed, 10 May 2023 12:58:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=jmprtQ6v; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236189AbjEJT27 (ORCPT + 62 others); Wed, 10 May 2023 15:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbjEJT25 (ORCPT ); Wed, 10 May 2023 15:28:57 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 036B66A4B; Wed, 10 May 2023 12:28:57 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1ab01bf474aso58807065ad.1; Wed, 10 May 2023 12:28:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683746936; x=1686338936; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=St8Hsth3yEssLy+3L8DNZSzYbP8LaSjJkmswj6bNhNY=; b=jmprtQ6vpXwG0djM6z+KYh5xl8h/Ac8X1jiJLHIWobiFbjifXXm2vyi3dzLL8l8FCU gMtCj9s2LzKLXPphcW+x0sL3jIRVsCybxzXG73KULcUwKpMnjBJTZDQEtfxWRGVnJLCN 5My6mKN9k8Syy7gNptWZg2RQMKupWGbxmFd3k6myHjpkphei3w3WCmBlOSLyHS0Em8Kl RQW1rKBEN+MMEXR3IJABsWyW8nMvdZElwXOIix/q0IPG628wL9CFeCsWHHrZ6/JbNM76 TPVMHtbLqST4NDstlWGNC2LD8EMAVl3xpGpm083kfa2mHDjwN5tOix+zZukkW2rSfBW5 1x0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683746936; x=1686338936; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=St8Hsth3yEssLy+3L8DNZSzYbP8LaSjJkmswj6bNhNY=; b=RYd6/s3lGMjzeEFME9IwL+EHk45sQaNodqDuicGvcDnpXAnQxmxMkf2FF9+692y/Wz 7GMZkaPKMQI+RzlDlCUc692CAm4WQig4VkZur6UBsdJNeLYTwxwVndp88rjvMCLfSpNw GbzNXfm42mgVWN+OX9yLKQGcQQultUTx/SxlbWoPxL8Ni7BhqBH8LAcTYYDcC3nFSgzb dwDWutaAFzuWIHblfZzDn5tq8eudN6a/H6LieiBmLbminiKiInNJHqF5eVhIppfF3aT7 xavFOFYevxIpnx5GTLIjue14a3e8voBtvjPy4T+vM8xH4kNJfFQ4ekXyq79NEFqkVOSY 9+6A== X-Gm-Message-State: AC+VfDzfNmkdlVYgvx3Lqnz0SI3uQCXESG5h49CS8JePAE/72JYnsdmj bVocfkN5fdPVyTgDz0sbLpM= X-Received: by 2002:a17:902:c402:b0:1ac:b259:87ea with SMTP id k2-20020a170902c40200b001acb25987eamr4196664plk.0.1683746936214; Wed, 10 May 2023 12:28:56 -0700 (PDT) Received: from localhost (2603-800c-1a02-1bae-a7fa-157f-969a-4cde.res6.spectrum.com. [2603:800c:1a02:1bae:a7fa:157f:969a:4cde]) by smtp.gmail.com with ESMTPSA id x5-20020a170902b40500b0019a6cce2060sm4156156plr.57.2023.05.10.12.28.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 May 2023 12:28:55 -0700 (PDT) Sender: Tejun Heo Date: Wed, 10 May 2023 09:28:54 -1000 From: Tejun Heo To: Johannes Berg Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, Lai Jiangshan Subject: Re: [RFC PATCH 2/4] workqueue: support holding a mutex for each work Message-ID: References: <20230510160428.175409-1-johannes@sipsolutions.net> <20230510175846.cc21c84b0e6b.I9d3df459c43a78530d9c2046724bb45626402d5f@changeid> <0c44265eae421eff49e19be3ebfe20d1fb5e6f9a.camel@sipsolutions.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0c44265eae421eff49e19be3ebfe20d1fb5e6f9a.camel@sipsolutions.net> X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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-wireless@vger.kernel.org Hello, On Wed, May 10, 2023 at 09:16:09PM +0200, Johannes Berg wrote: > Yeah I thought you'd say that :) Sorry about being so predictable. :) > It isn't difficult, the issue is just that in the case I'm envisioning, > you can't just call wiphy_lock() since that would attempt to pause the > workqueue, which can't work from on the workqueue itself. So you need > wiphy_lock_from_work()/wiphy_unlock_from_work() or remember to use the > mutex directly there, which all seemed more error-prone and harder to > maintain. > > But anyway I could easily implement _both_ of these in cfg80211 > directly, with just a linked list of works and a single struct > work_struct to execute things on the list, with the right locking. That > might be easier overall, just at the expense of more churn while > converting, but that's not even necessarily _bad_, it would really > guarantee that we can tell immediately the work is properly done... > > I'll play with that idea some, I guess. Would you still want the > pause/resume patch anyway, even if I end up not using it then? I think it's something inherently useful (along with the ability to do the same thing to a work time - ie. cancel and inhibit a work item to be queued0); however, it's probably not a good idea to merge without an in-tree user. Would you mind posting a fixed patch nonetheless for future reference if it's not too much hassle? Thanks. -- tejun