[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6003804-1f91-45db-8ae7-368fda354acd@amd.com>
Date: Thu, 24 Oct 2024 04:35:20 -0500
From: "Kalra, Ashish" <ashish.kalra@....com>
To: Russ Weight <russ.weight@...ux.dev>, Dionna Glaze <dionnaglaze@...gle.com>
Cc: linux-kernel@...r.kernel.org, Luis Chamberlain <mcgrof@...nel.org>,
Danilo Krummrich <dakr@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH 1/1] firmware_loader: Move module refcounts to allow
unloading
On 10/23/2024 3:16 PM, Russ Weight wrote:
>
> On Tue, Oct 15, 2024 at 08:14:24PM +0000, Dionna Glaze wrote:
>> If a kernel module registers a firmware upload API ops set, then it's
>> unable to be moved due to effectively a cyclic reference that the module
>> depends on the upload which depends on the module.
>>
>> Instead, only require the try_module_get when an upload is requested to
>> disallow unloading a module only while the upload is in progress.
>
> Generally, the parent driver that registers for firmware_upload would
> want the module to be present until it unregisters.
>
> Is there a case where this change is needed?
We are using the firmware_upload_register() API interface for SEV firmware loader/update
with the AMD Crypto CCP driver.
Now, when we call firmware_upload_register() it does a module_get() and bumps the module refcnt and
then we do the firmware_upload_unregister() as part of the CCP module's exit() callback, but the
CCP module's exit() callback is never invoked as it's refcnt is non-zero, so it is like a catch 22
situation, we want the module's exit() callback to be invoked to call firmware_upload_unregister()
to do a module_put() and decrement module's refcnt, but the callback is never invoked as it's
refcnt is non-zero.
Isn't the firmware_upload_register() API interface intended to be used by standalone drivers ?
Thanks,
Ashish
Powered by blists - more mailing lists