Bug 261075 - iwlwifi: 8265 / 9650 problems
Summary: iwlwifi: 8265 / 9650 problems
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Bjoern A. Zeeb
URL:
Keywords:
Depends on:
Blocks: iwlwifi
  Show dependency treegraph
 
Reported: 2022-01-10 08:08 UTC by Xin LI
Modified: 2023-09-07 19:29 UTC (History)
10 users (show)

See Also:


Attachments
iwlwifi traceback (8.11 KB, text/plain)
2022-01-17 07:45 UTC, Ruslan Makhmatkhanov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xin LI freebsd_committer freebsd_triage 2022-01-10 08:08:02 UTC
My laptop (Lenovo P51) was previously using if_iwm and when trying to use if_iwlwifi, it panicked immediately after the interface is configured (the module was loaded via kld_list="if_iwlwifi" in /etc/rc.conf, and wlan confugration was just replacing 'iwm' with 'iwlwifi' in /etc/rc.conf).

Backtrace:


__curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
55		__asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu,
(kgdb) #0  __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
#1  doadump (textdump=textdump@entry=1)
    at /usr/src/sys/kern/kern_shutdown.c:399
#2  0xffffffff80c0cca3 in kern_reboot (howto=260)
    at /usr/src/sys/kern/kern_shutdown.c:487
#3  0xffffffff80c0d10e in vpanic (
    fmt=0xffffffff81239887 "%s: lsta %p state not NONE: %#x\n", 
    ap=<optimized out>) at /usr/src/sys/kern/kern_shutdown.c:920
#4  0xffffffff80c0ce63 in panic (fmt=<unavailable>)
    at /usr/src/sys/kern/kern_shutdown.c:844
#5  0xffffffff80e733ed in lkpi_sta_auth_to_scan (vap=0xfffffe01717d8010, 
    nstate=<optimized out>, arg=<optimized out>)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:936
#6  0xffffffff80e775d3 in lkpi_iv_newstate (vap=0xfffffe01717d8010, 
    nstate=IEEE80211_S_SCAN, arg=<unavailable>)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:1494
#7  0xffffffff80db18f6 in ieee80211_newstate_cb (xvap=0xfffffe01717d8010, 
    npending=<optimized out>) at /usr/src/sys/net80211/ieee80211_proto.c:2518
#8  0xffffffff80c705ba in taskqueue_run_locked (
    queue=queue@entry=0xfffff800021ef300)
    at /usr/src/sys/kern/subr_taskqueue.c:477
#9  0xffffffff80c71642 in taskqueue_thread_loop (
    arg=arg@entry=0xfffffe00e36dc110)
    at /usr/src/sys/kern/subr_taskqueue.c:794
#10 0xffffffff80bc49c0 in fork_exit (
    callout=0xffffffff80c71580 <taskqueue_thread_loop>, 
    arg=0xfffffe00e36dc110, frame=0xfffffe0145ec7f40)
    at /usr/src/sys/kern/kern_fork.c:1102
#11 <signal handler called>
#12 0x000031e6d6afefea in ?? ()
Backtrace stopped: Cannot access memory at address 0x7fffdf208f48


Messages before panic:

Loading kernel modules:
Intel(R) Wireless WiFi based driver for FreeBSD
iwlwifi0: <iwlwifi> mem 0xecc00000-0xecc01fff at device 0.0 on pci3
iwlwifi0: successfully loaded firmware image 'iwlwifi-8265-36.ucode'
iwlwifi0: loaded firmware version 36.ca7b901d.0 8265-36.ucode op_mode iwlmvm
iwlwifi0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
[...]
Starting wpa_supplicant.
iwlwifi0: lkpi_ic_getradiocaps: Adding chan 1/2412/0/0/0/0 returned error 55
iwlwifi0: lkpi_ic_getradiocaps: Adding chan 36/5180/0/0/0/0 returned error 55
[drm:edp_panel_vdd_off_sync] Turning [ENCODER:94:DDI A] VDD off
[drm:edp_panel_vdd_off_sync] PP_STATUS: 0x80000008 PP_CONTROL: 0x00000007
lagg0: link state changed to DOWN
iwlwifi0: Microcode SW error detected.  Restarting 0x2000000.
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 6
iwlwifi0: Loaded firmware version: 36.ca7b901d.0 8265-36.ucode
iwlwifi0: 0x0000340A | ADVANCED_SYSASSERT          
iwlwifi0: 0x000002F0 | trm_hw_status0
iwlwifi0: 0x00000000 | trm_hw_status1
iwlwifi0: 0x00024A8C | branchlink2
iwlwifi0: 0x0003AC1E | interruptlink1
iwlwifi0: 0x00000000 | interruptlink2
iwlwifi0: 0x00000000 | data1
iwlwifi0: 0xDEADBEEF | data2
iwlwifi0: 0xDEADBEEF | data3
iwlwifi0: 0x00000000 | beacon time
iwlwifi0: 0x000D8C93 | tsf low
iwlwifi0: 0x00000000 | tsf hi
iwlwifi0: 0x00000000 | time gp1
iwlwifi0: 0x000D8C93 | time gp2
iwlwifi0: 0x00000001 | uCode revision type
iwlwifi0: 0x00000024 | uCode version major
iwlwifi0: 0xCA7B901D | uCode version minor
iwlwifi0: 0x00000230 | hw version
iwlwifi0: 0x00489000 | board version
iwlwifi0: 0x0023012B | hcmd
iwlwifi0: 0x00022080 | isr0
iwlwifi0: 0x00000000 | isr1
iwlwifi0: 0x08201802 | isr2
iwlwifi0: 0x00417CC0 | isr3
iwlwifi0: 0x00000000 | isr4
iwlwifi0: 0x00220108 | last cmd Id
iwlwifi0: 0x00000000 | wait_event
iwlwifi0: 0x00000000 | l2p_control
iwlwifi0: 0x00000000 | l2p_duration
iwlwifi0: 0x00000000 | l2p_mhvalid
iwlwifi0: 0x00000000 | l2p_addr_match
iwlwifi0: 0x0000000D | lmpm_pmg_sel
iwlwifi0: 0x10032209 | timestamp
iwlwifi0: 0x00003848 | flow_handler
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 7
iwlwifi0: 0x00000070 | NMI_INTERRUPT_LMAC_FATAL
iwlwifi0: 0x00000000 | umac branchlink1
iwlwifi0: 0xC008694C | umac branchlink2
iwlwifi0: 0xC0083B0C | umac interruptlink1
iwlwifi0: 0xC0083B0C | umac interruptlink2
iwlwifi0: 0x00000800 | umac data1
iwlwifi0: 0xC0083B0C | umac data2
iwlwifi0: 0xDEADBEEF | umac data3
iwlwifi0: 0x00000024 | umac major
iwlwifi0: 0xCA7B901D | umac minor
iwlwifi0: 0xC088628C | frame pointer
iwlwifi0: 0xC088628C | stack pointer
iwlwifi0: 0x0023012B | last host cmd
iwlwifi0: 0x00000000 | isr status reg
iwlwifi0: IML/ROM dump:
iwlwifi0: 0x00000000 | IML/ROM error/state
iwlwifi0: 0x00000003 | IML/ROM data1
iwlwifi0: Fseq Registers:
iwlwifi0: 0x22F1B718 | FSEQ_ERROR_CODE
iwlwifi0: 0xC1AD2588 | FSEQ_TOP_INIT_VERSION
iwlwifi0: 0xA8C2CD2F | FSEQ_CNVIO_INIT_VERSION
iwlwifi0: 0x0000A10B | FSEQ_OTP_VERSION
iwlwifi0: 0x849D6F57 | FSEQ_TOP_CONTENT_VERSION
iwlwifi0: 0x42D10FC1 | FSEQ_ALIVE_TOKEN
iwlwifi0: 0x57DF6693 | FSEQ_CNVI_ID
iwlwifi0: 0xAC7958FF | FSEQ_CNVR_ID
iwlwifi0: 0x00000010 | CNVI_AUX_MISC_CHIP
iwlwifi0: 0x0BADCAFE | CNVR_AUX_MISC_CHIP
iwlwifi0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
iwlwifi0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
iwlwifi0: Collecting data: trigger 2 fired.
iwlwifi0: FW error in SYNC CMD BINDING_CONTEXT_CMD
#0 0xffffffff80e7d7c3 at linux_dump_stack+0x23
#1 0xffffffff85325b05 at iwl_trans_txq_send_hcmd+0x3d5
#2 0xffffffff852d161e at iwl_trans_send_cmd+0xce
#3 0xffffffff8530df53 at iwl_mvm_send_cmd_status+0x53
#4 0xffffffff8530e05f at iwl_mvm_send_cmd_pdu_status+0x4f
#5 0xffffffff852d94b9 at iwl_mvm_binding_update+0x289
#6 0xffffffff852ea88d at __iwl_mvm_assign_vif_chanctx+0x9d
#7 0xffffffff852e7308 at iwl_mvm_assign_vif_chanctx+0x68
#8 0xffffffff80e78312 at lkpi_80211_mo_assign_vif_chanctx+0x22
#9 0xffffffff80e73847 at lkpi_sta_scan_to_auth+0x3b7
#10 0xffffffff80e775d3 at lkpi_iv_newstate+0x163
#11 0xffffffff80db18f6 at ieee80211_newstate_cb+0x1d6
#12 0xffffffff80c705ba at taskqueue_run_locked+0xaa
#13 0xffffffff80c71642 at taskqueue_thread_loop+0xc2
#14 0xffffffff80bc49c0 at fork_exit+0x80
#15 0xffffffff810accce at fork_trampoline+0xe
iwlwifi0: Failed to send binding (action:1): -5
iwlwifi0: PHY ctxt cmd error. ret=-5
iwlwifi0: lkpi_iv_newstate: error -5 during state transition 1 (SCAN) -> 2 (AUTH)
iwlwifi0: No queue was found. Dropping TX
iwlwifi0: iwl_trans_wait_tx_queues_empty bad state = 0
                                        WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&dev->mode_config.connection_mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:661
      
WARN_ON(!mutex_is_locked(&fbc->lock))
                          
WARN_ON(!mutex_is_locked(&fbc->lock))
        
WARN_ON(!mutex_is_locked(&fbc->lock))WARN_ON(!mutex_is_locked(&fbc->lock))WARN_ON(!mutex_is_locked(&fbc->lock))
panic: lkpi_sta_auth_to_scan: lsta 0xfffff80013648000 state not NONE: 0
Comment 1 Bjoern A. Zeeb freebsd_committer freebsd_triage 2022-01-10 18:26:59 UTC
First thanks for trying iwlwifi out.

For the bug title see here in case you can provide more details:
https://lists.freebsd.org/archives/freebsd-wireless/2022-January/000169.html

But your backtrace down there for the firmware assert is actually in lkpi_sta_scan_to_auth an earlier problem;  everything later is just a consequence of that and we still not resetting the device in order to catch these problems.

I am also seeing a lagg down and some drm events the same moment.  what's your actual configuration and could you kindly provide PCI IDs for the card so I know exactly which one?

I assume you switched back ti iwm(4) for the moment.  I'll follow-up here once I believe both issues might be fixed or I'd need some testing again.
Comment 2 Xin LI freebsd_committer freebsd_triage 2022-01-10 21:14:36 UTC
(In reply to Bjoern A. Zeeb from comment #1)
I've added the wlandebug_* options and it does give me some additional contexts.  This time it panicked at a slightly different place:

__curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
55		__asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu,
(kgdb) #0  __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
#1  doadump (textdump=textdump@entry=1)
    at /usr/src/sys/kern/kern_shutdown.c:399
#2  0xffffffff80c0cca3 in kern_reboot (howto=260)
    at /usr/src/sys/kern/kern_shutdown.c:487
#3  0xffffffff80c0d10e in vpanic (
    fmt=0xffffffff812eb096 "%s: lock (%s) %s not locked", ap=<optimized out>)
    at /usr/src/sys/kern/kern_shutdown.c:920
#4  0xffffffff80c0ce63 in panic (fmt=<unavailable>)
    at /usr/src/sys/kern/kern_shutdown.c:844
#5  0xffffffff80c7fa84 in witness_save (lock=<optimized out>, 
    filep=<optimized out>, linep=<optimized out>)
    at /usr/src/sys/kern/subr_witness.c:2381
#6  0xffffffff80c194bb in _sleep (ident=0xfffffe014529f1c0, 
    lock=0xfffffe014529f218, priority=0, 
    wmesg=0xffffffff811c265e "lhwscanstop", sbt=2147483500, pr=0, flags=256)
    at /usr/src/sys/kern/kern_synch.c:194
#7  0xffffffff80e77567 in lkpi_stop_hw_scan (lhw=0xfffffe014529f1c0, 
    vif=0xfffffe016d3e4c80)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:580
#8  lkpi_iv_newstate (vap=0xfffffe016d3e4010, nstate=IEEE80211_S_INIT, arg=-1)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:1481
#9  0xffffffff80db18f6 in ieee80211_newstate_cb (xvap=0xfffffe016d3e4010, 
    npending=<optimized out>) at /usr/src/sys/net80211/ieee80211_proto.c:2518
#10 0xffffffff80c705ba in taskqueue_run_locked (
    queue=queue@entry=0xfffff80008669800)
    at /usr/src/sys/kern/subr_taskqueue.c:477
#11 0xffffffff80c71642 in taskqueue_thread_loop (
    arg=arg@entry=0xfffffe0143bd7110)
    at /usr/src/sys/kern/subr_taskqueue.c:794
#12 0xffffffff80bc49c0 in fork_exit (
    callout=0xffffffff80c71580 <taskqueue_thread_loop>, 
    arg=0xfffffe0143bd7110, frame=0xfffffe0142091f40)
    at /usr/src/sys/kern/kern_fork.c:1102
#13 <signal handler called>
#14 0x0000296f46a9afea in ?? ()
Backtrace stopped: Cannot access memory at address 0x1009f48


iwlwifi0: <iwlwifi> mem 0xecc00000-0xecc01fff at device 0.0 on pci3
iwlwifi0: successfully loaded firmware image 'iwlwifi-8265-36.ucode'
iwlwifi0: loaded firmware version 36.ca7b901d.0 8265-36.ucode op_mode iwlmvm
iwlwifi0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
[...]
iwlwifi0: lkpi_ic_getradiocaps: Adding chan 1/2412/0/0/0/0 returned error 55
iwlwifi0: lkpi_ic_getradiocaps: Adding chan 36/5180/0/0/0/0 returned error 55
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: start running, 0 vaps running
wlan0: ieee80211_start_locked: up parent iwlwifi0
wlan0: ieee80211_new_state_locked: INIT -> SCAN (arg 0) (nrunning 0 nscanning 0)
wlan0: ieee80211_newstate_cb: INIT -> SCAN arg 0
wlan0: sta_newstate: INIT -> SCAN (0)
wlan0: stop running, 1 vaps running
lagg0: link state changed to DOWN
wlan0: ieee80211_new_state_locked: SCAN -> INIT (arg -1) (nrunning 0 nscanning 0)
wlan0: down parent iwlwifi0
wlan0: ieee80211_newstate_cb: SCAN -> INIT arg -1
Sleeping on "lhwscanstop" with the following non-sleepable locks held:
exclusive sleep mutex iwlwifi0_com_lo (iwlwifi0_com_lo) r = 0 (0xfffffe0143bd7020) locked @ /usr/src/sys/net80211/ieee80211_scan.c:500
stack backtrace:
#0 0xffffffff80c7e4d1 at witness_debugger+0x71
#1 0xffffffff80c7f629 at witness_warn+0x3e9
#2 0xffffffff80c1938b at _sleep+0x5b
#3 0xffffffff80e77567 at lkpi_iv_newstate+0xf7
#4 0xffffffff80db18f6 at ieee80211_newstate_cb+0x1d6
#5 0xffffffff80c705ba at taskqueue_run_locked+0xaa
#6 0xffffffff80c71642 at taskqueue_thread_loop+0xc2
#7 0xffffffff80bc49c0 at fork_exit+0x80
#8 0xffffffff810accce at fork_trampoline+0xe
panic: witness_save: lock (sleep mutex) lhw not locked
cpuid = 7
time = 1641848143
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0142091c40
vpanic() at vpanic+0x17f/frame 0xfffffe0142091c90
panic() at panic+0x43/frame 0xfffffe0142091cf0
witness_save() at witness_save+0xf4/frame 0xfffffe0142091d00
_sleep() at _sleep+0x18b/frame 0xfffffe0142091da0
lkpi_iv_newstate() at lkpi_iv_newstate+0xf7/frame 0xfffffe0142091df0
ieee80211_newstate_cb() at ieee80211_newstate_cb+0x1d6/frame 0xfffffe0142091e40
taskqueue_run_locked() at taskqueue_run_locked+0xaa/frame 0xfffffe0142091ec0
taskqueue_thread_loop() at taskqueue_thread_loop+0xc2/frame 0xfffffe0142091ef0
fork_exit() at fork_exit+0x80/frame 0xfffffe0142091f30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0142091f30
--- trap 0xc, rip = 0x296f46a9afea, rsp = 0x1009f48, rbp = 0x1009f60 ---


PCI IDs:

iwm0@pci0:4:0:0:        class=0x028000 rev=0x78 hdr=0x00 vendor=0x8086 device=0x24fd subvendor=0x8086 subdevice=0x0010
    vendor     = 'Intel Corporation'
    device     = 'Wireless 8265 / 8275'
    class      = network

My configuration was a lagg device consisting em0 (not connected) and wlan0:

lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	laggproto failover lagghash l2,l3,l4
	laggport: em0 flags=1<MASTER>
	laggport: wlan0 flags=4<ACTIVE>
	groups: lagg
	media: Ethernet autoselect
	status: active


DRM -- I was using 

vgapci1@pci0:0:2:0:     class=0x030000 rev=0x04 hdr=0x00 vendor=0x8086 device=0x591d subvendor=0x17aa subdevice=0x224d
    vendor     = 'Intel Corporation'
    device     = 'HD Graphics P630'
    class      = display
    subclass   = VGA

The mobile workstation is equipped with a nVidia GPU too:

vgapci0@pci0:1:0:0:     class=0x030200 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1436 subvendor=0x17aa subdevice=0x224d
    vendor     = 'NVIDIA Corporation'
    device     = 'GM206GLM [Quadro M2200 Mobile]'
    class      = display
    subclass   = 3D

but on FreeBSD I'm using the Intel one primarily, and I didn't load the nvidia kernel module.

Hope this helps, please let me know if you need additional data or want me to test some other configurations.

(The test above was done with:

wlans_iwlwifi0="wlan0"
create_args_wlan0="wlanmode sta regdomain FCC country US"
wlandebug_wlan0="+state +crypto +node +auth +assoc +dot1xsm +wpa"
ifconfig_wlan0="WPA"
ifconfig_em0="ether XX:XX:XX:XX:XX:XX up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport em0 laggport wlan0 DHCP"
ifconfig_lagg0_ipv6="inet6 accept_rtadv"
ipv6_privacy="YES"
kld_list="if_iwlwifi acpi_wmi acpi_ibm acpi_video coretemp filemon i915kms hwpmc"

(If desirable, I can remove that lagg configuration; I'm not doing it yet as the backtrace suggests that there were some issue with the Wi-Fi negotiation).
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-01-10 22:31:20 UTC
A commit in branch main references this bug:

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

commit bec766282f242aab3a4bfba402ea74cb0ccf96fb
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-01-10 22:12:53 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-01-10 22:29:23 +0000

    LinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan()

    In lkpi_stop_hw_scan() we have to unlock around cancelling the
    hardware scan and an msleep to wait for the confirmation that the
    scan ended.  Otherwise we are sleeping with the non-sleepable
    net80211 com lock held.  At the same time we need to hold the lhw
    lock for the msleep().
    This lock change got lost in the refactoring of lkpi_iv_newstate().

    Reported by:    ambrisko, delphij
    PR:             261075
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation

 sys/compat/linuxkpi/common/src/linux_80211.c | 4 ++++
 1 file changed, 4 insertions(+)
Comment 4 Xin LI freebsd_committer freebsd_triage 2022-01-11 07:32:33 UTC
Thanks, I can confirm that the locking issue was fixed.

Now we are back to the same panic:

__curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
55		__asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu,
(kgdb) #0  __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
#1  doadump (textdump=textdump@entry=1)
    at /usr/src/sys/kern/kern_shutdown.c:399
#2  0xffffffff80c0cd03 in kern_reboot (howto=260)
    at /usr/src/sys/kern/kern_shutdown.c:487
#3  0xffffffff80c0d16e in vpanic (
    fmt=0xffffffff8123b91b "%s: lsta %p state not NONE: %#x\n", 
    ap=<optimized out>) at /usr/src/sys/kern/kern_shutdown.c:920
#4  0xffffffff80c0cec3 in panic (fmt=<unavailable>)
    at /usr/src/sys/kern/kern_shutdown.c:844
#5  0xffffffff80e734ad in lkpi_sta_auth_to_scan (vap=0xfffffe016d42d010, 
    nstate=<optimized out>, arg=<optimized out>)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:940
#6  0xffffffff80e77763 in lkpi_iv_newstate (vap=0xfffffe016d42d010, 
    nstate=IEEE80211_S_SCAN, arg=<unavailable>)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:1498
#7  0xffffffff80db19b6 in ieee80211_newstate_cb (xvap=0xfffffe016d42d010, 
    npending=<optimized out>) at /usr/src/sys/net80211/ieee80211_proto.c:2518
#8  0xffffffff80c7061a in taskqueue_run_locked (
    queue=queue@entry=0xfffff800025e9600)
    at /usr/src/sys/kern/subr_taskqueue.c:477
#9  0xffffffff80c716a2 in taskqueue_thread_loop (
    arg=arg@entry=0xfffffe014161f110)
    at /usr/src/sys/kern/subr_taskqueue.c:794
#10 0xffffffff80bc4a20 in fork_exit (
    callout=0xffffffff80c715e0 <taskqueue_thread_loop>, 
    arg=0xfffffe014161f110, frame=0xfffffe0141fe9f40)
    at /usr/src/sys/kern/kern_fork.c:1102
#11 <signal handler called>
(kgdb) 


iwlwifi0: <iwlwifi> mem 0xecc00000-0xecc01fff at device 0.0 on pci3
iwlwifi0: successfully loaded firmware image 'iwlwifi-8265-36.ucode'
iwlwifi0: loaded firmware version 36.ca7b901d.0 8265-36.ucode op_mode iwlmvm
iwlwifi0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
iwlwifi0: lkpi_ic_getradiocaps: Adding chan 1/2412/0/0/0/0 returned error 55
iwlwifi0: lkpi_ic_getradiocaps: Adding chan 36/5180/0/0/0/0 returned error 55
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
wlan0: _ieee80211_crypto_delkey: NONE keyix 65535 flags 0x3 rsc 0 tsc 0 len 0
[drm:edp_panel_vdd_off_sync] Turning [ENCODER:94:DDI A] VDD off
[drm:edp_panel_vdd_off_sync] PP_STATUS: 0x80000008 PP_CONTROL: 0x00000007
wlan0: start running, 0 vaps running
wlan0: ieee80211_start_locked: up parent iwlwifi0
wlan0: stop running, 1 vaps running
lagg0: link state changed to DOWN
wlan0: ieee80211_new_state_locked: INIT -> INIT (arg -1) (nrunning 0 nscanning 0)
wlan0: down parent iwlwifi0
wlan0: ieee80211_newstate_cb: INIT -> INIT arg -1
wlan0: sta_newstate: INIT -> INIT (-1)
wlan0: start running, 0 vaps running
wlan0: ieee80211_start_locked: up parent iwlwifi0
wlan0: ieee80211_new_state_locked: INIT -> SCAN (arg 0) (nrunning 0 nscanning 0)
wlan0: start running, 1 vaps running
wlan0: ieee80211_newstate_cb: INIT -> SCAN arg 0
wlan0: sta_newstate: INIT -> SCAN (0)
wlan0: [e4:8d:8c:4b:29:aa] station assoc via MLME
wlan0: ieee80211_alloc_node 0xfffffe016db73000<e4:8d:8c:4b:29:aa> in station table
wlan0: node_reclaim: remove 0xfffffe016d42f000<e4:70:b8:5c:4e:69> from station table, refcnt 1
wlan0: ieee80211_sta_join1 0xfffffe016db73000<e4:8d:8c:4b:29:aa> -> AUTH, FC0_SUBTYPE_DEAUTH
wlan0: ieee80211_new_state_locked: SCAN -> AUTH (arg 192) (nrunning 0 nscanning 0)
wlan0: ieee80211_newstate_cb: SCAN -> AUTH arg 192
iwlwifi0: Microcode SW error detected.  Restarting 0x2000000.
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 6
iwlwifi0: Loaded firmware version: 36.ca7b901d.0 8265-36.ucode
iwlwifi0: 0x0000340A | ADVANCED_SYSASSERT          
iwlwifi0: 0x000002B0 | trm_hw_status0
iwlwifi0: 0x00000000 | trm_hw_status1
iwlwifi0: 0x00024A8C | branchlink2
iwlwifi0: 0x0003AC1E | interruptlink1
iwlwifi0: 0x00000000 | interruptlink2
iwlwifi0: 0x00000000 | data1
iwlwifi0: 0xDEADBEEF | data2
iwlwifi0: 0xDEADBEEF | data3
iwlwifi0: 0x00000000 | beacon time
iwlwifi0: 0x0064ACBD | tsf low
iwlwifi0: 0x00000000 | tsf hi
iwlwifi0: 0x00000000 | time gp1
iwlwifi0: 0x0064ACBE | time gp2
iwlwifi0: 0x00000001 | uCode revision type
iwlwifi0: 0x00000024 | uCode version major
iwlwifi0: 0xCA7B901D | uCode version minor
iwlwifi0: 0x00000230 | hw version
iwlwifi0: 0x00489000 | board version
iwlwifi0: 0x0024012B | hcmd
iwlwifi0: 0x00022080 | isr0
iwlwifi0: 0x00000000 | isr1
iwlwifi0: 0x08201802 | isr2
iwlwifi0: 0x00417CC0 | isr3
iwlwifi0: 0x00000000 | isr4
iwlwifi0: 0x00230108 | last cmd Id
iwlwifi0: 0x00000000 | wait_event
iwlwifi0: 0x00000094 | l2p_control
iwlwifi0: 0x00010000 | l2p_duration
iwlwifi0: 0x0000000F | l2p_mhvalid
iwlwifi0: 0x00000000 | l2p_addr_match
iwlwifi0: 0x0000000D | lmpm_pmg_sel
iwlwifi0: 0x10032209 | timestamp
iwlwifi0: 0x00004050 | flow_handler
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 7
iwlwifi0: 0x00000070 | NMI_INTERRUPT_LMAC_FATAL
iwlwifi0: 0x00000000 | umac branchlink1
iwlwifi0: 0xC008694C | umac branchlink2
iwlwifi0: 0xC0083B0C | umac interruptlink1
iwlwifi0: 0xC0083B0C | umac interruptlink2
iwlwifi0: 0x00000800 | umac data1
iwlwifi0: 0xC0083B0C | umac data2
iwlwifi0: 0xDEADBEEF | umac data3
iwlwifi0: 0x00000024 | umac major
iwlwifi0: 0xCA7B901D | umac minor
iwlwifi0: 0xC088628C | frame pointer
iwlwifi0: 0xC088628C | stack pointer
iwlwifi0: 0x0024012B | last host cmd
iwlwifi0: 0x00000000 | isr status reg
iwlwifi0: IML/ROM dump:
iwlwifi0: 0x00000000 | IML/ROM error/state
iwlwifi0: 0x00000003 | IML/ROM data1
iwlwifi0: Fseq Registers:
iwlwifi0: 0x20F1B71C | FSEQ_ERROR_CODE
iwlwifi0: 0xC5A92588 | FSEQ_TOP_INIT_VERSION
iwlwifi0: 0x28C2CD27 | FSEQ_CNVIO_INIT_VERSION
iwlwifi0: 0x0000A10B | FSEQ_OTP_VERSION
iwlwifi0: 0x849D6E55 | FSEQ_TOP_CONTENT_VERSION
iwlwifi0: 0x42D18FD1 | FSEQ_ALIVE_TOKEN
iwlwifi0: 0x37DD6693 | FSEQ_CNVI_ID
iwlwifi0: 0xAC7958FB | FSEQ_CNVR_ID
iwlwifi0: 0x00000010 | CNVI_AUX_MISC_CHIP
iwlwifi0: 0x0BADCAFE | CNVR_AUX_MISC_CHIP
iwlwifi0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
iwlwifi0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
iwlwifi0: Collecting data: trigger 2 fired.
iwlwifi0: FW error in SYNC CMD BINDING_CONTEXT_CMD
#0 0xffffffff80e7dea3 at linux_dump_stack+0x23
#1 0xffffffff85326615 at iwl_trans_txq_send_hcmd+0x3d5
#2 0xffffffff852d18fe at iwl_trans_send_cmd+0xce
#3 0xffffffff8530e7b3 at iwl_mvm_send_cmd_status+0x53
#4 0xffffffff8530e8bf at iwl_mvm_send_cmd_pdu_status+0x4f
#5 0xffffffff852d9a29 at iwl_mvm_binding_update+0x289
#6 0xffffffff852eaefd at __iwl_mvm_assign_vif_chanctx+0x9d
#7 0xffffffff852e7968 at iwl_mvm_assign_vif_chanctx+0x68
#8 0xffffffff80e784a2 at lkpi_80211_mo_assign_vif_chanctx+0x22
#9 0xffffffff80e73907 at lkpi_sta_scan_to_auth+0x3b7
#10 0xffffffff80e77763 at lkpi_iv_newstate+0x1e3
#11 0xffffffff80db19b6 at ieee80211_newstate_cb+0x1d6
#12 0xffffffff80c7061a at taskqueue_run_locked+0xaa
#13 0xffffffff80c716a2 at taskqueue_thread_loop+0xc2
#14 0xffffffff80bc4a20 at fork_exit+0x80
#15 0xffffffff810aecce at fork_trampoline+0xe
iwlwifi0: Failed to send binding (action:1): -5
iwlwifi0: PHY ctxt cmd error. ret=-5
iwlwifi0: lkpi_iv_newstate: error -5 during state transition 1 (SCAN) -> 2 (AUTH)
wlan0: sta_newstate: SCAN -> AUTH (192)
wlan0: ieee80211_ref_node (ieee80211_send_mgmt:2704) 0xfffffe016db73000<e4:8d:8c:4b:29:aa> refcnt 4
iwlwifi0: No queue was found. Dropping TX
wlan0: ni 0xfffffe016db73000 vap 0xfffffe016d42d010 mode STA state AUTH m 0xfffff80003b4cb00 status 4543576
wlan0: ni 0xfffffe016db73000 mode STA state AUTH ostate 2 arg 0x2 status 4543576
wlan0: vap 0xfffffe016d42d010 mode STA state AUTH flags 0x2000 & 0x80
wlan0: ieee80211_new_state_locked: AUTH -> SCAN (arg 1) (nrunning 0 nscanning 0)
wlan0: ieee80211_newstate_cb: AUTH -> SCAN arg 1
wlan0: sta_newstate: AUTH -> SCAN (1)
iwlwifi0: iwl_trans_wait_tx_queues_empty bad state = 0
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&dev->mode_config.connection_mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:661
WARN_ON(!mutex_is_locked(&fbc->lock))
                          
WARN_ON(!mutex_is_locked(&fbc->lock))
 
WARN_ON(!mutex_is_locked(&fbc->lock))WARN_ON(!mutex_is_locked(&fbc->lock))WARN_ON(!mutex_is_locked(&fbc->lock))
panic: lkpi_sta_auth_to_scan: lsta 0xfffff80003ba1800 state not NONE: 0

cpuid = 0
time = 1641885981
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0141fe9c50
vpanic() at vpanic+0x17f/frame 0xfffffe0141fe9ca0
panic() at panic+0x43/frame 0xfffffe0141fe9d00
lkpi_sta_auth_to_scan() at lkpi_sta_auth_to_scan+0x2ed/frame 0xfffffe0141fe9d80
lkpi_iv_newstate() at lkpi_iv_newstate+0x1e3/frame 0xfffffe0141fe9df0
ieee80211_newstate_cb() at ieee80211_newstate_cb+0x1d6/frame 0xfffffe0141fe9e40
taskqueue_run_locked() at taskqueue_run_locked+0xaa/frame 0xfffffe0141fe9ec0
taskqueue_thread_loop() at taskqueue_thread_loop+0xc2/frame 0xfffffe0141fe9ef0
fork_exit() at fork_exit+0x80/frame 0xfffffe0141fe9f30
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe0141fe9f30
--- trap 0, rip = 0, rsp = 0, rbp = 0 ---
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&dev->mode_config.connection_mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:661
WARN_ON(!mutex_is_locked(&fbc->lock))
                          
WARN_ON(!mutex_is_locked(&fbc->lock))
 
WARN_ON(!mutex_is_locked(&fbc->lock))WARN_ON(!mutex_is_locked(&fbc->lock))WARN_ON(!mutex_is_locked(&fbc->lock))
Uptime: 35s
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&crtc->mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:616
WARNING !drm_modeset_is_locked(&dev->mode_config.connection_mutex) failed at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_atomic_helper.c:661
WARN_ON(!mutex_is_locked(&fbc->lock))
                             
WARN_ON(!mutex_is_locked(&fbc->lock))
 
WARN_ON(!mutex_is_locked(&fbc->lock))WARN_ON(!mutex_is_locked(&fbc->lock))WARN_ON(!mutex_is_locked(&fbc->lock))
Dumping 1361 out of 32427 MB:..2%..11%..22%..31%..42%..51%..62%..71%..82%..91%
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-01-16 23:21:36 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=82a6a8c2941ac7819b90c841484ed6a155e2a459

commit 82a6a8c2941ac7819b90c841484ed6a155e2a459
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-01-10 22:12:53 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-01-16 22:39:28 +0000

    LinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan()

    In lkpi_stop_hw_scan() we have to unlock around cancelling the
    hardware scan and an msleep to wait for the confirmation that the
    scan ended.  Otherwise we are sleeping with the non-sleepable
    net80211 com lock held.  At the same time we need to hold the lhw
    lock for the msleep().
    This lock change got lost in the refactoring of lkpi_iv_newstate().

    Reported by:    ambrisko, delphij
    PR:             261075
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit bec766282f242aab3a4bfba402ea74cb0ccf96fb)

 sys/compat/linuxkpi/common/src/linux_80211.c | 4 ++++
 1 file changed, 4 insertions(+)
Comment 6 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2022-01-17 07:45:32 UTC
Not sure if it's related, but I now have more connection stability issues after updating to main-n252480-4ca41937606. 

I'm seeing many of

iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5

until I do system netif restart. Full traceback is attached. 

my pciconv -vl entry 

iwlwifi0@pci0:0:20:3:	class=0x028000 rev=0x00 hdr=0x00 vendor=0x8086 device=0x02f0 subvendor=0x8086 subdevice=0x0070
    vendor     = 'Intel Corporation'
    device     = 'Comet Lake PCH-LP CNVi WiFi'
    class      = network

drm-kmod version is drm-current-kmod-5.4.144.g20211230.
Comment 7 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2022-01-17 07:45:55 UTC
Created attachment 231062 [details]
iwlwifi traceback
Comment 8 Poul-Henning Kamp freebsd_committer freebsd_triage 2022-02-28 15:15:29 UTC
I just got a new T14s laptop, loaded

  FreeBSD-14.0-CURRENT-amd64-20220224-45c23c2608e-253384-memstick.img.xz

and see the same thing.

Until it is usable, the machine is available for any kind of experimentation, just email me.
Comment 9 Bjoern A. Zeeb freebsd_committer freebsd_triage 2022-04-01 19:16:16 UTC
This should be fixed in recent main and stable/13.

Sorry I missed the PR tags on the commits, most notably d9f59799fc3e7940c47aa674c25994e640eae45e .

Please re-open or report on freebsd-wireless if this is still a problem.
Comment 10 Xin LI freebsd_committer freebsd_triage 2022-04-09 23:23:34 UTC
(In reply to Bjoern A. Zeeb from comment #9)
It seems that it still crashes:


Sat Apr  9 15:45:28 PDT 2022
iwm0: detached
pci3: <network> at device 0.0 (no driver attached)
Intel(R) Wireless WiFi based driver for FreeBSD
iwm0: <Intel(R) Dual Band Wireless AC 8265> mem 0xecc00000-0xecc01fff at device 0.0 on pci3
iwm0: hw rev 0x230, fw ver 22.361476.0, address e4:70:b8:5c:4e:69
iwm0: detached
pci3: <network> at device 0.0 (no driver attached)
iwm0: <Intel(R) Dual Band Wireless AC 8265> mem 0xecc00000-0xecc01fff at device 0.0 on pci3
iwm0: hw rev 0x230, fw ver 22.361476.0, address e4:70:b8:5c:4e:69
kldunload: attempt to unload file that was loaded by the kernel
iwm0: detached
pci3: <network> at device 0.0 (no driver attached)
iwm0: <Intel(R) Dual Band Wireless AC 8265> mem 0xecc00000-0xecc01fff at device 0.0 on pci3
iwm0: hw rev 0x230, fw ver 22.361476.0, address e4:70:b8:5c:4e:69
Apr  9 15:46:31 p51 syslogd: last message repeated 1 times
Apr  9 15:48:39 p51 syslogd: last message repeated 2 times
Apr  9 15:58:25 p51 syslogd: last message repeated 9 times
Apr  9 15:59:32 p51 syslogd: last message repeated 1 times
Apr  9 16:00:37 p51 ntpd[1606]: error resolving pool 0.freebsd.pool.ntp.org: Name does not resolve (8)
Apr  9 16:01:41 p51 syslogd: last message repeated 1 times
iwm0: detached
pci3: <network> at device 0.0 (no driver attached)
Intel(R) Wireless WiFi based driver for FreeBSD
iwlwifi0: <iwlwifi> mem 0xecc00000-0xecc01fff at device 0.0 on pci3
iwlwifi0: successfully loaded firmware image 'iwlwifi-8265-36.ucode'
iwlwifi0: loaded firmware version 36.ca7b901d.0 8265-36.ucode op_mode iwlmvm
iwlwifi0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
iwlwifi0: base HW address: e4:70:b8:5c:4e:69, OTP minor version: 0x0
Apr  9 16:02:07 p51 wpa_supplicant[2022]: wlan0: Failed to initialize driver interface
wlan0: Ethernet address: e4:70:b8:5c:4e:69
Apr  9 16:02:21 p51 wpa_supplicant[2162]: ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument
iwlwifi0: Not associated and the time event is over already...
iwlwifi0: fail to flush all tx fifo queues Q 5
iwlwifi0: Queue 5 is active on fifo 3 and stuck for 10000 ms. SW [2, 3] HW [2, 3] FH TRB=0x080305002
iwlwifi0: Not associated and the time event is over already...
iwlwifi0: fail to flush all tx fifo queues Q 5
iwlwifi0: Queue 5 is active on fifo 3 and stuck for 10000 ms. SW [2, 3] HW [2, 3] FH TRB=0x080305002
iwlwifi0: Microcode SW error detected.  Restarting 0x2000000.
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 6
iwlwifi0: Loaded firmware version: 36.ca7b901d.0 8265-36.ucode
iwlwifi0: 0x0000340A | ADVANCED_SYSASSERT          
iwlwifi0: 0x00A002B0 | trm_hw_status0
iwlwifi0: 0x00000000 | trm_hw_status1
iwlwifi0: 0x00024A8C | branchlink2
iwlwifi0: 0x0003AC1E | interruptlink1
iwlwifi0: 0x00000000 | interruptlink2
iwlwifi0: 0x00000000 | data1
iwlwifi0: 0xDEADBEEF | data2
iwlwifi0: 0xDEADBEEF | data3
iwlwifi0: 0x00000000 | beacon time
iwlwifi0: 0x000C9FA9 | tsf low
iwlwifi0: 0x00000000 | tsf hi
iwlwifi0: 0x00000000 | time gp1
iwlwifi0: 0x000C9FAA | time gp2
iwlwifi0: 0x00000001 | uCode revision type
iwlwifi0: 0x00000024 | uCode version major
iwlwifi0: 0xCA7B901D | uCode version minor
iwlwifi0: 0x00000230 | hw version
iwlwifi0: 0x18489000 | board version
iwlwifi0: 0x0023012B | hcmd
iwlwifi0: 0x00022080 | isr0
iwlwifi0: 0x00000000 | isr1
iwlwifi0: 0x08201802 | isr2
iwlwifi0: 0x00417DC0 | isr3
iwlwifi0: 0x00000000 | isr4
iwlwifi0: 0x00220108 | last cmd Id
iwlwifi0: 0x00000000 | wait_event
iwlwifi0: 0x00000080 | l2p_control
iwlwifi0: 0x00010000 | l2p_duration
iwlwifi0: 0x0000003F | l2p_mhvalid
iwlwifi0: 0x00000000 | l2p_addr_match
iwlwifi0: 0x0000000D | lmpm_pmg_sel
iwlwifi0: 0x10032209 | timestamp
iwlwifi0: 0x00003040 | flow_handler
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 7
iwlwifi0: 0x00000070 | NMI_INTERRUPT_LMAC_FATAL
iwlwifi0: 0x00000000 | umac branchlink1
iwlwifi0: 0xC008694C | umac branchlink2
iwlwifi0: 0xC0083B0C | umac interruptlink1
iwlwifi0: 0xC0083B0C | umac interruptlink2
iwlwifi0: 0x00000800 | umac data1
iwlwifi0: 0xC0083B0C | umac data2
iwlwifi0: 0xDEADBEEF | umac data3
iwlwifi0: 0x00000024 | umac major
iwlwifi0: 0xCA7B901D | umac minor
iwlwifi0: 0xC088628C | frame pointer
iwlwifi0: 0xC088628C | stack pointer
iwlwifi0: 0x0023012B | last host cmd
iwlwifi0: 0x00000000 | isr status reg
iwlwifi0: IML/ROM dump:
iwlwifi0: 0x00000000 | IML/ROM error/state
iwlwifi0: 0x00000003 | IML/ROM data1
iwlwifi0: Fseq Registers:
iwlwifi0: 0x22F1B35E | FSEQ_ERROR_CODE
iwlwifi0: 0xC1A96188 | FSEQ_TOP_INIT_VERSION
iwlwifi0: 0x28C2CD4F | FSEQ_CNVIO_INIT_VERSION
iwlwifi0: 0x0000A10B | FSEQ_OTP_VERSION
iwlwifi0: 0x84BD6E55 | FSEQ_TOP_CONTENT_VERSION
iwlwifi0: 0x42D50FC1 | FSEQ_ALIVE_TOKEN
iwlwifi0: 0x175B66D3 | FSEQ_CNVI_ID
iwlwifi0: 0x8C79587F | FSEQ_CNVR_ID
iwlwifi0: 0x00000010 | CNVI_AUX_MISC_CHIP
iwlwifi0: 0x0BADCAFE | CNVR_AUX_MISC_CHIP
iwlwifi0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
iwlwifi0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
iwlwifi0: Collecting data: trigger 2 fired.
iwlwifi0: FW error in SYNC CMD BINDING_CONTEXT_CMD
#0 0xffffffff80e8c41b at linux_dump_stack+0x1b
#1 0xffffffff855e4224 at iwl_trans_txq_send_hcmd+0x414
#2 0xffffffff8558c13e at iwl_trans_send_cmd+0xce
#3 0xffffffff855cbb43 at iwl_mvm_send_cmd_status+0x53
#4 0xffffffff855cbc4f at iwl_mvm_send_cmd_pdu_status+0x4f
#5 0xffffffff85594d69 at iwl_mvm_binding_update+0x289
#6 0xffffffff855a68bd at __iwl_mvm_assign_vif_chanctx+0x9d
#7 0xffffffff855a3178 at iwl_mvm_assign_vif_chanctx+0x68
#8 0xffffffff80e86a22 at lkpi_80211_mo_assign_vif_chanctx+0x22
#9 0xffffffff80e81a48 at lkpi_sta_scan_to_auth+0x4b8
#10 0xffffffff80e863e3 at lkpi_iv_newstate+0x1b3
#11 0xffffffff80dbeda6 at ieee80211_newstate_cb+0x1d6
#12 0xffffffff80c7cf0a at taskqueue_run_locked+0xaa
#13 0xffffffff80c7df92 at taskqueue_thread_loop+0xc2
#14 0xffffffff80bd0690 at fork_exit+0x80
#15 0xffffffff810d2e5e at fork_trampoline+0xe
iwlwifi0: Failed to send binding (action:1): -5
iwlwifi0: PHY ctxt cmd error. ret=-5
iwlwifi0: lkpi_iv_newstate: error -5 during state transition 1 (SCAN) -> 2 (AUTH)
iwlwifi0: No queue was found. Dropping TX
iwlwifi0: iwl_trans_wait_tx_queues_empty bad state = 0
Dumping 1465 out of 32427 MB:..2%..11%..21%..31%..41%..51%..61%..71%..81%..91%


Unread portion of the kernel message buffer:
iwlwifi0: iwl_trans_wait_tx_queues_empty bad state = 0
Dumping 1465 out of 32427 MB:..2%..11%..21%..31%..41%..51%..61%..71%..81%..91%

__curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
55		__asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu,
(kgdb) #0  __curthread () at /usr/src/sys/amd64/include/pcpu_aux.h:55
#1  doadump (textdump=textdump@entry=0)
    at /usr/src/sys/kern/kern_shutdown.c:406
#2  0xffffffff854aa291 in vt_kms_postswitch (arg=0xfffff800023dad00, 
    arg@entry=<error reading variable: value is not available>)
    at /p51/home/delphij/kms-drm/drivers/gpu/drm/drm_os_freebsd.c:123
#3  0xffffffff80a63e61 in vt_window_switch (
    vw=vw@entry=0xffffffff81ae9ab8 <vt_conswindow>)
    at /usr/src/sys/dev/vt/vt_core.c:607
#4  0xffffffff80a6141f in vtterm_cngrab (tm=<unavailable>, 
    tm@entry=<error reading variable: value is not available>)
    at /usr/src/sys/dev/vt/vt_core.c:1875
#5  0xffffffff80bab7b6 in cngrab () at /usr/src/sys/kern/kern_cons.c:384
#6  0xffffffff80c1933e in vpanic (
    fmt=0xffffffff812f8c4e "%s: lsta %p state not NONE: %#x, nstate %d arg %d\n", ap=ap@entry=0xfffffe016fe4acf0) at /usr/src/sys/kern/kern_shutdown.c:937
#7  0xffffffff80c19193 in panic (fmt=<unavailable>)
    at /usr/src/sys/kern/kern_shutdown.c:889
#8  0xffffffff80e81563 in lkpi_sta_auth_to_scan (vap=0xfffffe01713df010, 
    nstate=IEEE80211_S_SCAN, arg=1)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:1150
#9  0xffffffff80e863e3 in lkpi_iv_newstate (vap=0xfffffe01713df010, 
    nstate=IEEE80211_S_SCAN, arg=<unavailable>)
    at /usr/src/sys/compat/linuxkpi/common/src/linux_80211.c:2021
#10 0xffffffff80dbeda6 in ieee80211_newstate_cb (xvap=0xfffffe01713df010, 
    npending=<optimized out>) at /usr/src/sys/net80211/ieee80211_proto.c:2532
#11 0xffffffff80c7cf0a in taskqueue_run_locked (
    queue=queue@entry=0xfffff80015807500)
    at /usr/src/sys/kern/subr_taskqueue.c:477
#12 0xffffffff80c7df92 in taskqueue_thread_loop (
    arg=arg@entry=0xfffffe0172743110)
    at /usr/src/sys/kern/subr_taskqueue.c:794
#13 0xffffffff80bd0690 in fork_exit (
    callout=0xffffffff80c7ded0 <taskqueue_thread_loop>, 
    arg=0xfffffe0172743110, frame=0xfffffe016fe4af40)
    at /usr/src/sys/kern/kern_fork.c:1102
#14 <signal handler called>
(kgdb)
Comment 11 Bjoern A. Zeeb freebsd_committer freebsd_triage 2022-04-10 15:15:16 UTC
The problem you are now seeing is a different issue even if it may look similar ( I adjusted the title for that).

What version exactly was this on?

Given you seem to have iwm first can you try this (if you want to try iwlwifi):
https://lists.freebsd.org/archives/freebsd-wireless/2022-April/000412.html
on HEAD of main (possibly also with a GENERIC-NODEBUG)?

As I said in the thread, it may not be the ultimate cure for the older generation chipsets but it seems to indeed help to not have iwm(4) loaded in advance (unlcear if there is state left around that isn't wiped).
Comment 12 Xin LI freebsd_committer freebsd_triage 2022-04-10 17:54:52 UTC
It looks like with the lagg configuration:

wlans_iwlwifi0="wlan0"
create_args_wlan0="wlanmode sta regdomain FCC country US"
wlandebug_wlan0="+state +crypto +node +auth +assoc +dot1xsm +wpa"
ifconfig_wlan0="WPA"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport em0 laggport wlan0 DHCP"
ifconfig_lagg0_ipv6="inet6 accept_rtadv"

the kernel would crash after iwlwifi0: FW error in SYNC CMD BINDING_CONTEXT_CMD.  The crash happens regardless if I had devmatch_blacklist="if_iwm.ko".

No dump was saved due to a general protection fault; I was able to record a video and transcribe some of the messages, but the scrolling was too fast and the text were not always legible.

Removing these configuration and configuring this way would allow me to boot into multiuser:

wlans_iwlwifi0="wlan0"
devmatch_blacklist="if_iwm.ko"
create_args_wlan0="wlanmode sta regdomain FCC country US"
wlandebug_wlan0="+state +crypto +node +auth +assoc +dot1xsm +wpa"
ifconfig_wlan0="WPA DHCP"

but the interface won't associate (I managed to get an association while in single user mode in previous boot but only for a few seconds) with the AP.

(These "DEADBEEF" do look suspecious and may be related to the GPF I have seen when lagg is used?)

iwlwifi0: <iwlwifi> mem 0xecc00000-0xecc01fff at device 0.0 on pci3
iwlwifi0: successfully loaded firmware image 'iwlwifi-8265-36.ucode'
iwlwifi0: loaded firmware version 36.ca7b901d.0 8265-36.ucode op_mode iwlmvm
iwlwifi0: Detected Intel(R) Dual Band Wireless AC 8265, REV=0x230
iwlwifi0: base HW address: e4:70:b8:5c:4e:69, OTP minor version: 0x0
wlan0: ieee80211_start_locked: up parent iwlwifi0
iwlwifi0: Microcode SW error detected.  Restarting 0x2000000.
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 6
iwlwifi0: Loaded firmware version: 36.ca7b901d.0 8265-36.ucode
iwlwifi0: 0x00003520 | ADVANCED_SYSASSERT          
iwlwifi0: 0x000002A0 | trm_hw_status0
iwlwifi0: 0x00000000 | trm_hw_status1
iwlwifi0: 0x00024A8C | branchlink2
iwlwifi0: 0x0003AC1E | interruptlink1
iwlwifi0: 0x00000000 | interruptlink2
iwlwifi0: 0xDEADBEEF | data1
iwlwifi0: 0xDEADBEEF | data2
iwlwifi0: 0xDEADBEEF | data3
iwlwifi0: 0x000E8757 | beacon time
iwlwifi0: 0x003178A7 | tsf low
iwlwifi0: 0x00000000 | tsf hi
iwlwifi0: 0x00000000 | time gp1
iwlwifi0: 0x003178A8 | time gp2
iwlwifi0: 0x00000001 | uCode revision type
iwlwifi0: 0x00000024 | uCode version major
iwlwifi0: 0xCA7B901D | uCode version minor
iwlwifi0: 0x00000230 | hw version
iwlwifi0: 0x00489000 | board version
iwlwifi0: 0x003F0128 | hcmd
iwlwifi0: 0x00022080 | isr0
iwlwifi0: 0x00000000 | isr1
iwlwifi0: 0x08301802 | isr2
iwlwifi0: 0x00405CC0 | isr3
iwlwifi0: 0x00000000 | isr4
iwlwifi0: 0x003E0118 | last cmd Id
iwlwifi0: 0x00000000 | wait_event
iwlwifi0: 0x00000810 | l2p_control
iwlwifi0: 0x00018020 | l2p_duration
iwlwifi0: 0x0000003F | l2p_mhvalid
iwlwifi0: 0x000000CF | l2p_addr_match
iwlwifi0: 0x0000000D | lmpm_pmg_sel
iwlwifi0: 0x10032209 | timestamp
iwlwifi0: 0x00004858 | flow_handler
iwlwifi0: Start IWL Error Log Dump:
iwlwifi0: Transport status: 0x0000004B, valid: 7
iwlwifi0: 0x00000070 | NMI_INTERRUPT_LMAC_FATAL
iwlwifi0: 0x00000000 | umac branchlink1
iwlwifi0: 0xC008694C | umac branchlink2
iwlwifi0: 0xC0083B0C | umac interruptlink1
iwlwifi0: 0xC008EA20 | umac interruptlink2
iwlwifi0: 0x00000800 | umac data1
iwlwifi0: 0xC008EA20 | umac data2
iwlwifi0: 0xDEADBEEF | umac data3
iwlwifi0: 0x00000024 | umac major
iwlwifi0: 0xCA7B901D | umac minor
iwlwifi0: 0xC0887E34 | frame pointer
iwlwifi0: 0xC0887E34 | stack pointer
iwlwifi0: 0x003F0128 | last host cmd
iwlwifi0: 0x00040008 | isr status reg
iwlwifi0: IML/ROM dump:
iwlwifi0: 0x00000000 | IML/ROM error/state
iwlwifi0: 0x00000003 | IML/ROM data1
iwlwifi0: Fseq Registers:
iwlwifi0: 0x22F1B75E | FSEQ_ERROR_CODE
iwlwifi0: 0xC5A965A8 | FSEQ_TOP_INIT_VERSION
iwlwifi0: 0xA8C2CD2F | FSEQ_CNVIO_INIT_VERSION
iwlwifi0: 0x0000A10B | FSEQ_OTP_VERSION
iwlwifi0: 0x84BD6E55 | FSEQ_TOP_CONTENT_VERSION
iwlwifi0: 0x42D50FC1 | FSEQ_ALIVE_TOKEN
iwlwifi0: 0x575F6693 | FSEQ_CNVI_ID
iwlwifi0: 0x8C7958FF | FSEQ_CNVR_ID
iwlwifi0: 0x00000010 | CNVI_AUX_MISC_CHIP
iwlwifi0: 0x0BADCAFE | CNVR_AUX_MISC_CHIP
iwlwifi0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
iwlwifi0: 0x0BADCAFE | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
iwlwifi0: Collecting data: trigger 2 fired.
iwlwifi0: FW error in SYNC CMD MAC_CONTEXT_CMD
iwlwifi0: Failed to send MAC context (action:2): -5
iwlwifi0: failed to update MAC 0xfffffe016d116c9eM
iwlwifi0: Failed to send quota: -5
iwlwifi0: failed to update quotas
iwlwifi0: mcast filter cmd error. ret=-5
iwlwifi0: Failed to synchronize multicast groups update
WARNING iwl_mvm_enable_beacon_filter(mvm, vif, 0) failed at /usr/src/sys/contrib/dev/iwlwifi/mvm/mac80211.c:3510
iwlwifi0: Failed to send MAC context (action:2): -5
iwlwifi0: failed to update MAC 0xfffffe016d116c9eM
iwlwifi0: mcast filter cmd error. ret=-5
iwlwifi0: Failed to synchronize multicast groups update
iwlwifi0: mcast filter cmd error. ret=-5
iwlwifi0: Failed to synchronize multicast groups update
iwlwifi0: mcast filter cmd error. ret=-5
iwlwifi0: Failed to synchronize multicast groups update
iwlwifi0: Failed to send flush command (-5)
iwlwifi0: flush request fail
iwlwifi0: Couldn't remove the time event
iwlwifi0: Couldn't send TIME_EVENT_CMD: -5
iwlwifi0: iwl_trans_wait_tx_queues_empty bad state = 0
iwlwifi0: Failed to send MAC context (action:2): -5
iwlwifi0: Failed to synchronize multicast groups update
iwlwifi0: Failed to send MAC context (action:2): -5
iwlwifi0: failed to update MAC 0xfffffe016d116c9eM
iwlwifi0: Failed to remove station. Id=0
iwlwifi0: failed to remove AP station
iwlwifi0: Failed to send quota: -5
iwlwifi0: failed to update quotas
iwlwifi0: Failed to send MAC context (action:2): -5
iwlwifi0: failed to update MAC 0xfffffe016d116c9eM (clear after unassoc)
iwlwifi0: Failed to synchronize multicast groups update
iwlwifi0: Failed to send MAC context (action:2): -5
iwlwifi0: failed to update MAC 0xfffffe016d116c9eM
iwlwifi0: Failed to send quota: -5
iwlwifi0: Failed to send binding (action:3): -5
iwlwifi0: PHY ctxt cmd error. ret=-5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
iwlwifi0: Scan failed! ret -5
iwlwifi0: ERROR: lkpi_ic_scan_start: hw_scan returned -5
Comment 13 donaldcallen 2022-06-13 01:34:16 UTC
I have seen a similar problem when trying to use 13.1 on a Thinkpad X1 Carbon Gen 7. Because wifi was unusable, I installed Arch Linux on that machine. I hope this problem will get resolved, because I would prefer to run FreeBSD on the laptop, which I use on my (ethernet-connected) desktops.
Comment 14 Xin LI freebsd_committer freebsd_triage 2022-06-13 05:27:34 UTC
(In reply to donaldcallen from comment #13)
Note that another option is that it's now possible to passthrough the wifi interface to a BHyVe guest running Linux which will give you full 802.11ac support.  If you are interested, please give net/wifibox a try.

Basically the Linux guest would manage the Wi-Fi interface and act as a router between FreeBSD host and your Wi-Fi router.

In the meantime I still love to see iwlwifi supported natively.
Comment 15 donaldcallen 2022-06-16 01:34:18 UTC
(In reply to Xin LI from comment #14)
Thank you for the suggestion, but Arch is working fine on the Thinkpad and I will continue using it unless and until FreeBSD has reliable native wifi support.

I must say that I wonder, with all the fuss FreeBSD makes about its pre-release testing protocols, how a driver in this condition could be part of the release.
Comment 16 Xin LI freebsd_committer freebsd_triage 2022-07-18 00:13:38 UTC
I'd like to report that as of da55f86c61462b119fd1306d12411989d6610650, the Wi-Fi connection can now work at 802.11g with iwlwifi (it's not associating with the 5G band SSID, possibly because I have disabled 802.11a; the access point is capable of 802.11ac).

It's reporting:

Invalid TXQ id

occasionally, though.

Please let me know if there is something that I can help with.
Comment 17 brian 2023-05-09 13:12:40 UTC
I'm encountering similar problems on this driver with the following physical interface - Is this a problem with the firmware that ships with 13.2-RELEASE?  Or is there something else I should be looking at?

System boots into multi-user mode but gets stuck joining any networks with a lkpi_ic_scan_start: hw_scan returned -5 error loop.

iwlwifi0@pci0:0:20:3: class=0x028000 rev=0x30 hdr=0x00 vendor=0x8086 device=0x34f0 subvendor=0x8086 subdevice=0x0074
   vendor = 'Intel Corporation'
   device = 'Ice Lake-LP PCH CNVi WiFi'
   class  = network
Comment 18 Graham Perrin freebsd_committer freebsd_triage 2023-05-27 11:52:15 UTC
(In reply to brian from comment #17)

A case such as yours might be better in a new bug report; not at the tail of something that was closed/fixed so long ago. 

Thanks