* [PATCH] modules: Only return -EEXIST for modules that have finished loading
@ 2019-04-02 13:39 Prarit Bhargava
2019-04-08 14:19 ` Prarit Bhargava
2019-04-15 11:23 ` Jessica Yu
0 siblings, 2 replies; 5+ messages in thread
From: Prarit Bhargava @ 2019-04-02 13:39 UTC (permalink / raw)
To: linux-kernel; +Cc: cavery, Prarit Bhargava, Jessica Yu
Microsoft HyperV disables the X86_FEATURE_SMCA bit on AMD systems, and
linux guests boot with repeated errors:
amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
The warnings occur because the module code erroneously returns -EEXIST
for modules that have failed to load and are in the process of being
removed from the module list.
module amd64_edac_mod has a dependency on module edac_mce_amd. Using
modules.dep, systemd will load edac_mce_amd for every request of
amd64_edac_mod. When the edac_mce_amd module loads, the module has
state MODULE_STATE_UNFORMED and once the module load fails and the state
becomes MODULE_STATE_GOING. Another request for edac_mce_amd module
executes and add_unformed_module() will erroneously return -EEXIST even
though the previous instance of edac_mce_amd has MODULE_STATE_GOING.
Upon receiving -EEXIST, systemd attempts to load amd64_edac_mod, which
fails because of unknown symbols from edac_mce_amd.
add_unformed_module() must wait to return for any case other than
MODULE_STATE_LIVE to prevent a race between multiple loads of
dependent modules.
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Reported-by: Cathy Avery <cavery@redhat.com>
Cc: Jessica Yu <jeyu@kernel.org>
---
kernel/module.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 0b9aa8ab89f0..e8c1de2ab4e1 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3566,8 +3566,7 @@ static int add_unformed_module(struct module *mod)
mutex_lock(&module_mutex);
old = find_module_all(mod->name, strlen(mod->name), true);
if (old != NULL) {
- if (old->state == MODULE_STATE_COMING
- || old->state == MODULE_STATE_UNFORMED) {
+ if (old->state != MODULE_STATE_LIVE) {
/* Wait in case it fails to load. */
mutex_unlock(&module_mutex);
err = wait_event_interruptible(module_wq,
--
2.17.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] modules: Only return -EEXIST for modules that have finished loading
2019-04-02 13:39 [PATCH] modules: Only return -EEXIST for modules that have finished loading Prarit Bhargava
@ 2019-04-08 14:19 ` Prarit Bhargava
2019-04-15 11:23 ` Jessica Yu
1 sibling, 0 replies; 5+ messages in thread
From: Prarit Bhargava @ 2019-04-08 14:19 UTC (permalink / raw)
To: linux-kernel; +Cc: cavery, Jessica Yu
Jessica? ping?
P.
On 4/2/19 9:39 AM, Prarit Bhargava wrote:
> Microsoft HyperV disables the X86_FEATURE_SMCA bit on AMD systems, and
> linux guests boot with repeated errors:
>
> amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
> amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
> amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
> amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
> amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
> amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
>
> The warnings occur because the module code erroneously returns -EEXIST
> for modules that have failed to load and are in the process of being
> removed from the module list.
>
> module amd64_edac_mod has a dependency on module edac_mce_amd. Using
> modules.dep, systemd will load edac_mce_amd for every request of
> amd64_edac_mod. When the edac_mce_amd module loads, the module has
> state MODULE_STATE_UNFORMED and once the module load fails and the state
> becomes MODULE_STATE_GOING. Another request for edac_mce_amd module
> executes and add_unformed_module() will erroneously return -EEXIST even
> though the previous instance of edac_mce_amd has MODULE_STATE_GOING.
> Upon receiving -EEXIST, systemd attempts to load amd64_edac_mod, which
> fails because of unknown symbols from edac_mce_amd.
>
> add_unformed_module() must wait to return for any case other than
> MODULE_STATE_LIVE to prevent a race between multiple loads of
> dependent modules.
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> Reported-by: Cathy Avery <cavery@redhat.com>
> Cc: Jessica Yu <jeyu@kernel.org>
> ---
> kernel/module.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/module.c b/kernel/module.c
> index 0b9aa8ab89f0..e8c1de2ab4e1 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -3566,8 +3566,7 @@ static int add_unformed_module(struct module *mod)
> mutex_lock(&module_mutex);
> old = find_module_all(mod->name, strlen(mod->name), true);
> if (old != NULL) {
> - if (old->state == MODULE_STATE_COMING
> - || old->state == MODULE_STATE_UNFORMED) {
> + if (old->state != MODULE_STATE_LIVE) {
> /* Wait in case it fails to load. */
> mutex_unlock(&module_mutex);
> err = wait_event_interruptible(module_wq,
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modules: Only return -EEXIST for modules that have finished loading
2019-04-02 13:39 [PATCH] modules: Only return -EEXIST for modules that have finished loading Prarit Bhargava
2019-04-08 14:19 ` Prarit Bhargava
@ 2019-04-15 11:23 ` Jessica Yu
2019-04-15 12:04 ` Prarit Bhargava
1 sibling, 1 reply; 5+ messages in thread
From: Jessica Yu @ 2019-04-15 11:23 UTC (permalink / raw)
To: Prarit Bhargava; +Cc: linux-kernel, cavery
+++ Prarit Bhargava [02/04/19 09:39 -0400]:
>Microsoft HyperV disables the X86_FEATURE_SMCA bit on AMD systems, and
>linux guests boot with repeated errors:
>
>amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
>amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
>amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
>amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
>amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
>amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
>
>The warnings occur because the module code erroneously returns -EEXIST
>for modules that have failed to load and are in the process of being
>removed from the module list.
>
>module amd64_edac_mod has a dependency on module edac_mce_amd. Using
>modules.dep, systemd will load edac_mce_amd for every request of
>amd64_edac_mod. When the edac_mce_amd module loads, the module has
>state MODULE_STATE_UNFORMED and once the module load fails and the state
>becomes MODULE_STATE_GOING. Another request for edac_mce_amd module
>executes and add_unformed_module() will erroneously return -EEXIST even
>though the previous instance of edac_mce_amd has MODULE_STATE_GOING.
>Upon receiving -EEXIST, systemd attempts to load amd64_edac_mod, which
>fails because of unknown symbols from edac_mce_amd.
>
>add_unformed_module() must wait to return for any case other than
>MODULE_STATE_LIVE to prevent a race between multiple loads of
>dependent modules.
>
>Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>Reported-by: Cathy Avery <cavery@redhat.com>
>Cc: Jessica Yu <jeyu@kernel.org>
Applied to modules-next. Thanks Prarit!
Jessica
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modules: Only return -EEXIST for modules that have finished loading
2019-04-15 11:23 ` Jessica Yu
@ 2019-04-15 12:04 ` Prarit Bhargava
2019-04-15 13:20 ` Jessica Yu
0 siblings, 1 reply; 5+ messages in thread
From: Prarit Bhargava @ 2019-04-15 12:04 UTC (permalink / raw)
To: Jessica Yu; +Cc: linux-kernel, cavery
On 4/15/19 7:23 AM, Jessica Yu wrote:
> +++ Prarit Bhargava [02/04/19 09:39 -0400]:
>> Microsoft HyperV disables the X86_FEATURE_SMCA bit on AMD systems, and
>> linux guests boot with repeated errors:
>>
>> amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
>> amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
>> amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
>> amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
>> amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
>> amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
>>
>> The warnings occur because the module code erroneously returns -EEXIST
>> for modules that have failed to load and are in the process of being
>> removed from the module list.
>>
>> module amd64_edac_mod has a dependency on module edac_mce_amd. Using
>> modules.dep, systemd will load edac_mce_amd for every request of
>> amd64_edac_mod. When the edac_mce_amd module loads, the module has
>> state MODULE_STATE_UNFORMED and once the module load fails and the state
>> becomes MODULE_STATE_GOING. Another request for edac_mce_amd module
>> executes and add_unformed_module() will erroneously return -EEXIST even
>> though the previous instance of edac_mce_amd has MODULE_STATE_GOING.
>> Upon receiving -EEXIST, systemd attempts to load amd64_edac_mod, which
>> fails because of unknown symbols from edac_mce_amd.
>>
>> add_unformed_module() must wait to return for any case other than
>> MODULE_STATE_LIVE to prevent a race between multiple loads of
>> dependent modules.
>>
>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>> Reported-by: Cathy Avery <cavery@redhat.com>
>> Cc: Jessica Yu <jeyu@kernel.org>
>
> Applied to modules-next. Thanks Prarit!
Jessica, could I have the URL of the git tree?
Thanks,
P.
>
> Jessica
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modules: Only return -EEXIST for modules that have finished loading
2019-04-15 12:04 ` Prarit Bhargava
@ 2019-04-15 13:20 ` Jessica Yu
0 siblings, 0 replies; 5+ messages in thread
From: Jessica Yu @ 2019-04-15 13:20 UTC (permalink / raw)
To: Prarit Bhargava; +Cc: linux-kernel, cavery
+++ Prarit Bhargava [15/04/19 08:04 -0400]:
>
>
>On 4/15/19 7:23 AM, Jessica Yu wrote:
>> +++ Prarit Bhargava [02/04/19 09:39 -0400]:
>>> Microsoft HyperV disables the X86_FEATURE_SMCA bit on AMD systems, and
>>> linux guests boot with repeated errors:
>>>
>>> amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
>>> amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
>>> amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
>>> amd64_edac_mod: Unknown symbol amd_unregister_ecc_decoder (err -2)
>>> amd64_edac_mod: Unknown symbol amd_register_ecc_decoder (err -2)
>>> amd64_edac_mod: Unknown symbol amd_report_gart_errors (err -2)
>>>
>>> The warnings occur because the module code erroneously returns -EEXIST
>>> for modules that have failed to load and are in the process of being
>>> removed from the module list.
>>>
>>> module amd64_edac_mod has a dependency on module edac_mce_amd. Using
>>> modules.dep, systemd will load edac_mce_amd for every request of
>>> amd64_edac_mod. When the edac_mce_amd module loads, the module has
>>> state MODULE_STATE_UNFORMED and once the module load fails and the state
>>> becomes MODULE_STATE_GOING. Another request for edac_mce_amd module
>>> executes and add_unformed_module() will erroneously return -EEXIST even
>>> though the previous instance of edac_mce_amd has MODULE_STATE_GOING.
>>> Upon receiving -EEXIST, systemd attempts to load amd64_edac_mod, which
>>> fails because of unknown symbols from edac_mce_amd.
>>>
>>> add_unformed_module() must wait to return for any case other than
>>> MODULE_STATE_LIVE to prevent a race between multiple loads of
>>> dependent modules.
>>>
>>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>>> Reported-by: Cathy Avery <cavery@redhat.com>
>>> Cc: Jessica Yu <jeyu@kernel.org>
>>
>> Applied to modules-next. Thanks Prarit!
>
>Jessica, could I have the URL of the git tree?
Sure, you can find the modules-next branch at:
git.kernel.org/pub/scm/linux/kernel/git/jeyu/linux.git
Thanks,
Jessica
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-15 13:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 13:39 [PATCH] modules: Only return -EEXIST for modules that have finished loading Prarit Bhargava
2019-04-08 14:19 ` Prarit Bhargava
2019-04-15 11:23 ` Jessica Yu
2019-04-15 12:04 ` Prarit Bhargava
2019-04-15 13:20 ` Jessica Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).