Skip to content

Commit

Permalink
iwlwifi: avoid (hard) hang on loading module
Browse files Browse the repository at this point in the history
For certain users or chipsets (reports were for CNVi devices but
we are not sure if this is limited or specific to them) loading
if_iwlwifi hangs.

The reason for this is that a SYSINIT (module_load_order()) has not
yet run in this case and the Linux driver tries to load the
chipsets-specific module.  On FreeBSD all supported sub-modules are
part of if_iwlwifi so we do not have to load them separately but
calling into kern_kldload via LinuxKPI request_module while loading
the module gives us a hard hang.

iwlwifi calls request_module_nowait() so we can simply skip over this
and continue and the SYSINIT will do the job later if no other
dependencies fail.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
PR:		282789
Tested by:	Ruslan Makhmatkhanov, Pete Wright
Differential Revision: https://reviews.freebsd.org/D47994
  • Loading branch information
Bjoern A. Zeeb authored and Bjoern A. Zeeb committed Dec 9, 2024
1 parent 4285e02 commit 87e140a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sys/contrib/dev/iwlwifi/iwl-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,20 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
goto out_unbind;
}
} else {
#if defined(__linux__)
request_module_nowait("%s", op->name);
#elif defined(__FreeBSD__)
/*
* In FreeBSD if_iwlwifi contains all drv modules in a single
* module. SYSINIT will do the job later. We cannot call
* into kern_kldload() while being called from kern_kldload():
* LinuxKPI request_module[_nowait] will hang hard.
* Given this is request_module_nowait() we can simply skip it.
*/
if (bootverbose)
printf("%s: module '%s' not yet available; will be"
"initialized in a moment\n", __func__, op->name);
#endif
}
mutex_unlock(&iwlwifi_opmode_table_mtx);

Expand Down

0 comments on commit 87e140a

Please sign in to comment.