Bug 291120 - iwlwifi: iwl_opmode_register panic
Summary: iwlwifi: iwl_opmode_register panic
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 16.0-CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Bjoern A. Zeeb
URL:
Keywords: crash
Depends on:
Blocks: iwlwifi
  Show dependency tree / graph
 
Reported: 2025-11-20 22:49 UTC by Bjoern A. Zeeb
Modified: 2026-04-05 22:42 UTC (History)
3 users (show)

See Also:
bz: mfc-stable15+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern A. Zeeb freebsd_committer freebsd_triage 2025-11-20 22:49:54 UTC
I believe we had a similar issue in the beginning of mvm.

Interestingly I had not seen this on any other of my machines (some of which have three iwlwifi cards in them currently) including BE200 which is the mvm/mld crossing child.

Now that the code got split off and partially duplicated it might be good to look through all the FreeBSD #ifdefs and see what also applies to mld and then get the not-really-FreeBSD-specifics upstreamed possibly for 6.19 still.

[86.354674] Fatal trap 12: page fault while in kernel mode
[86.354681] cpuid = 1; apic id = 01
[86.354685] fault virtual address       = 0x470
[86.354691] fault code          = supervisor read data, page not present
[86.354699] instruction pointer = 0x20:0xffffffff83c312d0
[86.354705] stack pointer               = 0x28:0xfffffe01928cca20
[86.354712] frame pointer               = 0x28:0xfffffe01928cca60
[86.354718] code segment                = base rx0, limit 0xfffff, type 0x1b
[86.354725]                     = DPL 0, pres 1, long 1, def32 0, gran 1
[86.354731] processor eflags    = interrupt enabled, resume, IOPL = 0
[86.354740] current process             = 5163 (kldload)
[86.354746] rdi: ffffffff83cd6228 rsi: ffffffff83cd6228 rdx: 0000000000000000
[86.354755] rcx: ffffffff83d01110  r8: 0000000000000080  r9: fffffe0085116a40
[86.354763] rax: 0000000000000001 rbx: 0000000000000010 rbp: fffffe01928cca60
[86.354772] r10: 0000000000000000 r11: ff928fa0cececdcf r12: 0000000000000003
[86.354781] r13: 0000000000000000 r14: 0000000000000000 r15: ffffffff83cfe500
[86.354789] trap number         = 12
[86.354807] panic: page fault
[86.370305] cpuid = 1
[86.375998] time = 1763662842
[86.381715] KDB: stack backtrace:
[86.387852] db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe01928cc770
[86.395976] vpanic() at vpanic+0x136/frame 0xfffffe01928cc8a0
[86.403807] panic() at panic+0x43/frame 0xfffffe01928cc900
[86.412023] trap_pfault() at trap_pfault+0x3cf/frame 0xfffffe01928cc950
[86.419869] calltrap() at calltrap+0x8/frame 0xfffffe01928cc950
[86.426871] --- trap 0xc, rip = 0xffffffff83c312d0, rsp = 0xfffffe01928cca20, rbp = 0xfffffe01928cca60 ---
[86.434117] iwl_opmode_register() at iwl_opmode_register+0x160/frame 0xfffffe01928cca60
[86.442736] iwl_mld_init() at iwl_mld_init+0x19/frame 0xfffffe01928cca80
[86.451387] linker_load_module() at linker_load_module+0xcd3/frame 0xfffffe01928ccd80
[86.460024] kern_kldload() at kern_kldload+0x165/frame 0xfffffe01928ccdd0
[86.468515] sys_kldload() at sys_kldload+0x59/frame 0xfffffe01928cce00
[86.477473] amd64_syscall() at amd64_syscall+0x126/frame 0xfffffe01928ccf30
[86.485960] fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe01928ccf30
[86.493817] --- syscall (304, FreeBSD ELF64, kldload), rip = 0x146df692ff1a, rsp = 0x146df35f7dc8, rbp = 0x146df35f8340 ---
[86.501332] KDB: enter: panic
Comment 1 Bjoern A. Zeeb freebsd_committer freebsd_triage 2026-03-05 12:46:05 UTC
In _iwl_op_mode_start()
drv was NULL as drv->trans is at 0x470.

That means iwl_req_fw_callback() wasn't run yet and
list_add_tail(&drv->list, &op->drv);
had not happened yet.

So why does
                /* TODO: need to handle exceptional case */
                list_for_each_entry(drv, &op->drv, list)
                        drv->op_mode = _iwl_op_mode_start(drv, op);

in iwl_opmode_register() even try to call _iwl_op_mode_start() ?

Was iwl_drv_init() not run initializing the list?  It's run as module_init().

I belive, yes, for mvm we changed that to SI_ORDER_SECOND.  Need to do for mld as well.
Comment 2 commit-hook freebsd_committer freebsd_triage 2026-03-06 02:52:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=551c4cb74a807ceae55288bf273f5cfeb37c7c91

commit 551c4cb74a807ceae55288bf273f5cfeb37c7c91
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-03-05 12:41:46 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-03-06 02:49:07 +0000

    iwlwifi: mld: move module_init() to SI_ORDER_SECOND

    In FreeBSD the iwlwifi driver is a single kernel module.
    As for iwlwifi/mvm we need to make sure the common "iwlwifi drv" code
    is initialized before trying to register the mld sub-driver
    in order for lists, etc. in the registration code to be initialized.
    We do this by using an extended (FreeBSD specific) version of
    module_init which overrides the order parameter of the SYSINIT.
    Otherwise we can randomly (depending on SYSINIT run order) run into
    a NULL pointer deref panic.

    Sponsored by:   The FreeBSD Foundation
    PR:             291120
    MFC after:      3 days

 sys/contrib/dev/iwlwifi/mld/mld.c | 4 ++++
 1 file changed, 4 insertions(+)
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-03-09 11:04:40 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=169ab967e24bbb097f228e22c07ddb89ae3bfe5f

commit 169ab967e24bbb097f228e22c07ddb89ae3bfe5f
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-03-05 12:41:46 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-03-09 11:03:11 +0000

    iwlwifi: mld: move module_init() to SI_ORDER_SECOND

    In FreeBSD the iwlwifi driver is a single kernel module.
    As for iwlwifi/mvm we need to make sure the common "iwlwifi drv" code
    is initialized before trying to register the mld sub-driver
    in order for lists, etc. in the registration code to be initialized.
    We do this by using an extended (FreeBSD specific) version of
    module_init which overrides the order parameter of the SYSINIT.
    Otherwise we can randomly (depending on SYSINIT run order) run into
    a NULL pointer deref panic.

    Sponsored by:   The FreeBSD Foundation
    PR:             291120

    (cherry picked from commit 551c4cb74a807ceae55288bf273f5cfeb37c7c91)

 sys/contrib/dev/iwlwifi/mld/mld.c | 4 ++++
 1 file changed, 4 insertions(+)
Comment 4 Bjoern A. Zeeb freebsd_committer freebsd_triage 2026-04-05 22:42:07 UTC
The weekly bugs email reminded me about this.  CLOSED.