On Sat, Feb 11, 2023 at 03:40:48PM +0300, Vitaliy Makkoveev wrote:
> >Synopsis:    iwx(4) panic on resume after hibernation
> >Category:    hibernate/resume
> >Environment:
>       System      : OpenBSD 7.2
>       Details     : OpenBSD 7.2-current (GENERIC.MP) #1021: Sun Feb  5 
> 09:52:50 MST 2023
>                        
> dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
>       Architecture: OpenBSD.amd64
>       Machine     : amd64
> >Description:
>       "dram->paging == NULL" assertion triggered at line 635 in
>       dev/pci/if_iwx.c when resuming after hibernate. The information
>       was not stored in dmesg, so photo also attached. Output contains
>       the mess, but report readable, providing as-is.
> >How-To-Repeat:
>       ZZZ then resume
> >Fix:
>       unknown

I suppose this could happen if you did not go through iwx_stop_device()
at suspend time for some reason. That would usually free the pointer and
set it back to NULL. It is unclear to me how skipping this step during
suspend is possible.

There is a "fatal firmware error" visible in the text before the KASSERT
failed.  Can you try to trigger this again with 'ifconfig iwx0 debug'
enabled before hibernate? A firmware error trace might tell us a bit more
about the issue.

And if you can, please also modify the driver to log all calls to
iwx_stop_device() and iwx_init_task() to dmesg.
Maybe this firmware error triggered the init task to run during the shutdown
sequence and we ended up starting the device back up while we were suspending?
If so the diff below might help.

diff /usr/src
commit - 0da56a05372165a5aa6f5376fe481a3a9f3326d7
path + /usr/src
blob - 30f9dd2bd76e79992b9b6dd2b1975b7f84d78343
file + sys/dev/pci/if_iwx.c
--- sys/dev/pci/if_iwx.c
+++ sys/dev/pci/if_iwx.c
@@ -10944,7 +10944,8 @@ iwx_init_task(void *arg1)
        int fatal = (sc->sc_flags & (IWX_FLAG_HW_ERR | IWX_FLAG_RFKILL));
 
        rw_enter_write(&sc->ioctl_rwl);
-       if (generation != sc->sc_generation) {
+       if (generation != sc->sc_generation ||
+           (sc->sc_flags & IWX_FLAG_SHUTDOWN)) {
                rw_exit(&sc->ioctl_rwl);
                splx(s);
                return;

Reply via email to