All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Russ Weight <russ.weight@linux.dev>, <djbw@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>, <mcgrof@kernel.org>,
	<dakr@kernel.org>, <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH 0/3] firmware_loader: Fix shutdown ordering and reference counting
Date: Wed, 8 Apr 2026 10:26:03 +0800	[thread overview]
Message-ID: <adW8uyfRnnoA9T14@intel.com> (raw)
In-Reply-To: <l5c5kckmjkey7yxfmrkahgumrc6pgnz6kunmqxovopifflwimx@65n66fqrxhz7>

On Tue, Apr 07, 2026 at 01:24:03PM -0600, Russ Weight wrote:
>On Tue, Mar 31, 2026 at 02:47:23PM -0700, Dan Williams wrote:
>> Chao Gao raised a module reference circular dependency report resulting
>> from *correct* usage of the firmware_upload_register() API [1]. The
>> module reference count is not necessary nor sufficient for protecting
>> against racing unregister against in-flight requests. After that is
>> fixed, a couple more cleanups fall out.
>> 
>> [1]: https://sashiko.dev/#/patchset/20260326084448.29947-1-chao.gao%40intel.com?patch=10705
>> 
>> 
>> Dan Williams (3):
>>   firmware_loader: Stop pinning modules on registration
>>   firmware_loader: Stop pinning parent device per workqueue invocation
>>   treewide: firmware_loader: Drop the unused @module argument
>> 
>>  .../driver-api/firmware/fw_upload.rst         |  2 +-
>>  include/linux/firmware.h                      | 15 +++---
>>  drivers/base/firmware_loader/sysfs_upload.c   | 48 ++++++++-----------
>>  drivers/cxl/core/memdev.c                     |  4 +-
>>  drivers/firmware/microchip/mpfs-auto-update.c |  2 +-
>>  drivers/fpga/intel-m10-bmc-sec-update.c       |  4 +-
>>  drivers/greybus/gb-beagleplay.c               |  2 +-
>>  drivers/media/i2c/thp7312.c                   |  2 +-
>>  drivers/net/pse-pd/pd692x0.c                  |  4 +-
>>  lib/test_firmware.c                           |  3 +-
>>  10 files changed, 38 insertions(+), 48 deletions(-)
>> 
>> 
>> base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
>
>Hi Dan,
>
>Thanks for making these changes! Overall, the changes look good to
>me. However, when I apply these changes to the specified base-commit
>and attempt to build, I'm getting these errors:

(+Dan's new email)

Yes, I noticed that Sashiko reported them.

>
>drivers/base/firmware_loader/sysfs_upload.c:229:24: warning: unused variable ‘fw_dev’ [-Wunused-variable]
>  229 |         struct device *fw_dev = &fw_sysfs->dev;
>      |                        ^~~~~~

This can be fixed by applying the following diff to patch 2:

diff --git a/drivers/base/firmware_loader/sysfs_upload.c b/drivers/base/firmware_loader/sysfs_upload.c
index e0cf4c55b520..4ce64411f656 100644
--- a/drivers/base/firmware_loader/sysfs_upload.c
+++ b/drivers/base/firmware_loader/sysfs_upload.c
@@ -226,7 +226,6 @@ static void fw_upload_main(struct work_struct *work)
 int fw_upload_start(struct fw_sysfs *fw_sysfs)
 {
	struct fw_priv *fw_priv = fw_sysfs->fw_priv;
-	struct device *fw_dev = &fw_sysfs->dev;
	struct fw_upload_priv *fwlp;
 
	if (!fw_sysfs->fw_upload_priv)

>drivers/base/firmware_loader/sysfs_upload.c: In function ‘firmware_upload_register’: 
>drivers/base/firmware_loader/sysfs_upload.c:323:34: error: ‘module’ undeclared (first use in this function)
>  323 |         fw_upload_priv->module = module;
>      |                                  ^~~~~~

the @module field should be removed in patch 3:

diff --git a/drivers/base/firmware_loader/sysfs_upload.c b/drivers/base/firmware_loader/sysfs_upload.c
index 4ce64411f656..ee4d78443e3b 100644
--- a/drivers/base/firmware_loader/sysfs_upload.c
+++ b/drivers/base/firmware_loader/sysfs_upload.c
@@ -319,7 +319,6 @@ struct fw_upload *firmware_upload_register(struct device *parent,
	fw_upload_priv->fw_upload = fw_upload;
	fw_upload_priv->ops = ops;
	mutex_init(&fw_upload_priv->lock);
-	fw_upload_priv->module = module;
	fw_upload_priv->name = name;
	fw_upload_priv->err_code = 0;
	fw_upload_priv->progress = FW_UPLOAD_PROG_IDLE;
diff --git a/drivers/base/firmware_loader/sysfs_upload.h b/drivers/base/firmware_loader/sysfs_upload.h
index 31931ff7808a..dc7ccdceb96f 100644
--- a/drivers/base/firmware_loader/sysfs_upload.h
+++ b/drivers/base/firmware_loader/sysfs_upload.h
@@ -26,7 +26,6 @@ enum fw_upload_prog {
 
 struct fw_upload_priv {
	struct fw_upload *fw_upload;
-	struct module *module;
	const char *name;
	const struct fw_upload_ops *ops;
	struct mutex lock;		  /* protect data structure contents */

  reply	other threads:[~2026-04-08  2:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 21:47 [PATCH 0/3] firmware_loader: Fix shutdown ordering and reference counting Dan Williams
2026-03-31 21:47 ` [PATCH 1/3] firmware_loader: Stop pinning modules on registration Dan Williams
2026-03-31 21:47 ` [PATCH 2/3] firmware_loader: Stop pinning parent device per workqueue invocation Dan Williams
2026-03-31 21:47 ` [PATCH 3/3] treewide: firmware_loader: Drop the unused @module argument Dan Williams
2026-04-09 16:06   ` Conor Dooley
2026-04-07 19:24 ` [PATCH 0/3] firmware_loader: Fix shutdown ordering and reference counting Russ Weight
2026-04-08  2:26   ` Chao Gao [this message]
2026-04-08  2:34     ` Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adW8uyfRnnoA9T14@intel.com \
    --to=chao.gao@intel.com \
    --cc=dakr@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=djbw@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=rafael@kernel.org \
    --cc=russ.weight@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.