[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <33ee1c3a-d37a-b81f-68be-d1901c7dd6e8@acm.org>
Date: Wed, 28 Sep 2022 11:17:02 -0700
From: Bart Van Assche <bvanassche@....org>
To: Luis Chamberlain <mcgrof@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: "Martin K . Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org, Christoph Hellwig <hch@....de>,
Ming Lei <ming.lei@...hat.com>, Hannes Reinecke <hare@...e.de>,
John Garry <john.garry@...wei.com>,
Mike Christie <michael.christie@...cle.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-modules@...r.kernel.org, linux-kernel@...r.kernel.org,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH v5 6/7] module: Improve support for asynchronous module
exit code
On 9/27/22 17:02, Luis Chamberlain wrote:
> On Tue, Sep 20, 2022 at 10:13:40AM -0700, Bart Van Assche wrote:
>> On 9/14/22 15:56, Bart Van Assche wrote:
>>> Some kernel modules call device_del() from their module exit code and
>>> schedule asynchronous work from inside the .release callback without waiting
>>> until that callback has finished. As an example, many SCSI LLD drivers call
>>> scsi_remove_host() from their module exit code. scsi_remove_host() may
>>> invoke scsi_device_dev_release_usercontext() asynchronously.
>>> scsi_device_dev_release_usercontext() uses the host template pointer and
>>> that pointer usually exists in static storage in the SCSI LLD. Support
>>> using the module reference count to keep the module around until
>>> asynchronous module exiting has completed by waiting in the delete_module()
>>> system call until the module reference count drops to zero.
>>
>> Hi Luis,
>>
>> I'd like to know your opinion about this patch since you are the maintainer
>> of the kernel module system.
>
> See this patch which extends the documentation of try_module_get():
>
> https://lkml.kernel.org/r/20211029184500.2821444-7-mcgrof@kernel.org
>
> You can ignore discussion around the thread as sadly it is just
> irrelevant stuff not about that patch. But the logic it spells out
> is still true.
>
> So, in short, using try_module_get() on exit is actually the wrong
> thing to do and it is no surprise it would fail. I haven't gotten
> yet around to reviewing Mauro's driver API which let's you unbind
> drivers, but it sounds related so I CC'd you on that.
>
> So I'd like to ask instead if an alternative to using try_module_get()
> on exit would be better here and for the future.
Hi Luis,
The extended documentation of try_module_get() is very helpful. But
please note that this patch is not related to try_module_get() at all.
See also patch 7/7 in this series
(https://lore.kernel.org/linux-scsi/20220914225621.415631-8-bvanassche@acm.org/).
Thanks,
Bart.
Powered by blists - more mailing lists