On Sun, May 09, 2021 at 01:45:08PM +0200, Anton Lindqvist wrote:
> On Sat, May 08, 2021 at 10:32:36AM +0100, Stuart Henderson wrote:
> > Forwarding to bugs@ because this does not look Raspberry Pi specific
> > rather connected with uhidpp (Logitech keyboard driver new in 6.9).
> > 
> > Justin, you can probably bypass this for now if you "boot -c" at the
> > bootloader prompt and "disable uhidpp". If that works you can modify
> > an on-disk kernel to disable it with config(8) -ef.
> > 
> > Trace roughly transcribed from the first photo. (It's always easier
> > to have text rather than photos).
> > 
> > panic: assertwaitok: non-zero mutex count: 1, active process usbtask
> > assertwaitok at malloc
> > malloc at taskq_create+0x3c
> > taskq_create at sensor_task_register+0x50
> > sensor_task_register at uhidpp_device_connect+0x234
> > uhidpp_device_connect at uhidpp_task+0x10c
> > 
> > 
> > ----- Forwarded message from Justin Yang <[email protected]> -----
> > 
> > From: Justin Yang <[email protected]>
> > Date: Fri, 7 May 2021 23:58:02 +0800
> > To: Stuart Henderson <[email protected]>
> > Cc: Mark Kettenis <[email protected]>, "[email protected]" 
> > <[email protected]>
> > Subject: Re: Raspberry Pi 4B randomly kernel panics after upgrading to 6.9
> > 
> > I found that my previous mail was still incomplete, so I reinstalled the
> > whole system, and captured again:
> > https://i.postimg.cc/jjrd07xZ/2021-05-07-23-38-49.jpg
> > https://i.postimg.cc/qRq8nYPt/2021-05-07-23-40-09.jpg
> > https://i.postimg.cc/9QM2TYx4/2021-05-07-23-41-45.jpg
> > https://i.postimg.cc/N0kxcRc4/2021-05-07-23-42-53.jpg
> > https://i.postimg.cc/FKkf4LJ6/2021-05-07-23-43-18.jpg
> > https://i.postimg.cc/VLTmcHBY/2021-05-07-23-45-34.jpg
> > 
> > On Friday, May 7, 2021, Justin Yang <[email protected]> wrote:
> > 
> > > OK, I captured the trace and ddbcpu output:
> > >
> > > https://i.postimg.cc/hGcQfznj/2021-05-07-20-37-56.jpg
> > > https://i.postimg.cc/nz54W4jz/2021-05-07-20-38-56.jpg
> > >
> > > On Friday, May 7, 2021, Stuart Henderson <[email protected]> wrote:
> > >
> > >> At least "trace" from ddb is required.
> > >>
> > >> --
> > >>   Sent from a phone, apologies for poor formatting.
> > >>
> > >> On 6 May 2021 15:21:25 Justin Yang <[email protected]> wrote:
> > >>
> > >> Hi,
> > >>> Sorry for the late reply. Here are the dmesg links for both 6.8 and 6.9:
> > >>>
> > >>> 6.8:
> > >>> https://dmesgd.nycbug.org/index.cgi?do=view&id=5924
> > >>>
> > >>> 6.9:
> > >>> https://dmesgd.nycbug.org/index.cgi?do=view&id=6067
> > >>>
> > >>> and some ddb output:
> > >>> https://i.postimg.cc/tTWPLzCB/2021-05-06-21-42-54.jpg
> > >>>
> > >>> On Sat, May 1, 2021 at 9:57 PM Mark Kettenis <[email protected]>
> > >>> wrote:
> > >>>
> > >>> From: Justin Yang <[email protected]>
> > >>>>> Date: Sat, 1 May 2021 21:15:31 +0800
> > >>>>>
> > >>>>> Hi,
> > >>>>>
> > >>>>> I have a Raspberry Pi 4B (8G mem) with OpenBSD 6.8 installed on a USB 
> > >>>>> 3
> > >>>>> disk drive, and with edk2 firmware v1.22 flashed on SD card. It works
> > >>>>>
> > >>>> fine
> > >>>>
> > >>>>> untill I upgrade to 6.9 Release by 'sysupgrade' today. After this
> > >>>>> upgrading, the system becomes unstable and crashes randomly and says:
> > >>>>>
> > >>>>> panic: assertwaitok: non-zero mutex count: 1
> > >>>>>
> > >>>>> The screenshot can be viewed here: https://ibb.co/K6N1DdM
> > >>>>>
> > >>>>> Then I flashed edk2 firmware v1.21 to SD card just now, and booted it
> > >>>>> again, but still, it didn't work and crashed as before. I can confirm
> > >>>>> there's not such issue in 6.8. Am I missing something or is this a 
> > >>>>> bug?
> > >>>>>
> > >>>>
> > >>>> Please post the full dmesg of both the 6.8 and the 6.9 kernel.  And if
> > >>>> the panic happens again, follow the instructions pointed at on your
> > >>>> screen.
> > >>>>
> > >>>>
> > >>>
> > >>> --
> > >>> Justin Yang
> > >>>
> > >>
> > >>
> > >
> > > --
> > > Justin Yang
> > >
> > >
> > 
> > -- 
> > Justin Yang
> 
> Thanks for the report. This can only happen if uhidpp is the first one
> calling sensor_task_register() causing the sensors task queue to be
> allocated. The following diff should fix it, only compile time tested.
> 
> Index: dev/usb/uhidpp.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/uhidpp.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 uhidpp.c
> --- dev/usb/uhidpp.c  18 Mar 2021 09:21:53 -0000      1.13
> +++ dev/usb/uhidpp.c  9 May 2021 11:32:32 -0000
> @@ -605,6 +605,8 @@ uhidpp_device_connect(struct uhidpp_soft
>               return;
>       }
>  
> +     dev->d_connected = 1;
> +
>       sens = &dev->d_battery.b_sens[0];
>       strlcpy(sens->desc, "battery level", sizeof(sens->desc));
>       sens->type = SENSOR_PERCENT;
> @@ -617,10 +619,16 @@ uhidpp_device_connect(struct uhidpp_soft
>       sens->value = dev->d_battery.b_nlevels;
>       sensor_attach(&sc->sc_sensdev, sens);
>  
> -     if (sc->sc_senstsk == NULL)
> +     if (sc->sc_senstsk == NULL) {
> +             /*
> +              * The mutex must be temporarily released while calling
> +              * sensor_task_register() as it might end up sleeping.
> +              */
> +             mtx_leave(&sc->sc_mtx);
>               sc->sc_senstsk = sensor_task_register(sc, uhidpp_refresh, 30);
> +             mtx_enter(&sc->sc_mtx);
> +     }
>  
> -     dev->d_connected = 1;
>       uhidpp_device_refresh(sc, dev);
>  }

The fix has now been committed.

Reply via email to