[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6734119c1c9a7_10bb729471@dwillia2-xfh.jf.intel.com.notmuch>
Date: Tue, 12 Nov 2024 18:40:28 -0800
From: Dan Williams <dan.j.williams@...el.com>
To: Dionna Glaze <dionnaglaze@...gle.com>, <linux-kernel@...r.kernel.org>,
<x86@...nel.org>, Luis Chamberlain <mcgrof@...nel.org>, Russ Weight
<russ.weight@...ux.dev>, Danilo Krummrich <dakr@...hat.com>, "Greg
Kroah-Hartman" <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
<rafael@...nel.org>, Tianfei zhang <tianfei.zhang@...el.com>
CC: <linux-coco@...ts.linux.dev>, Dionna Glaze <dionnaglaze@...gle.com>, "Sean
Christopherson" <seanjc@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
Ashish Kalra <ashish.kalra@....com>, Tom Lendacky <thomas.lendacky@....com>,
John Allen <john.allen@....com>, Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>, Michael Roth <michael.roth@....com>,
Alexey Kardashevskiy <aik@....com>, Russ Weight <russell.h.weight@...el.com>
Subject: Re: [PATCH v6 3/8] firmware_loader: Move module refcounts to allow
unloading
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.
Oh, interesting, I wondered why CXL did not uncover this loop in its
usage only to realize that CXL calls firmware registration from the
cxl_pci module, but the @module paramter passed to
firmware_upload_register() is the cxl_core module. I.e. we are
accidentally avoiding the problem. I assume other CONFIG_FW_UPLOAD users
simply do not test module removal.
However, I think the fix is simply to remove all module reference taking
by the firmware_loader core. It is the consumer's responsibility to call
firmware_upload_unregister() in its module removal path and that should
flush any and all future usage of the passed in ops structure.
Powered by blists - more mailing lists