[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241024145831.6b44fqhhzwny6kc2@4VRSMR2-DT.corp.robot.car>
Date: Thu, 24 Oct 2024 07:58:31 -0700
From: Russ Weight <russ.weight@...ux.dev>
To: "Kalra, Ashish" <ashish.kalra@....com>
Cc: Dionna Glaze <dionnaglaze@...gle.com>, 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 Thu, Oct 24, 2024 at 04:35:20AM -0500, Kalra, Ashish wrote:
>
>
> 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.
That makes sense. Thanks for the explanation.
>
> Isn't the firmware_upload_register() API interface intended to be used by standalone drivers ?
Yes, it is.
Thanks,
- Russ
Powered by blists - more mailing lists