[Bug 273295] lock order reversal and nonsleepable lock in malloc in gpioled0 attach on Raspberry Pi
Date: Tue, 22 Aug 2023 16:28:05 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273295 Bug ID: 273295 Summary: lock order reversal and nonsleepable lock in malloc in gpioled0 attach on Raspberry Pi Product: Base System Version: CURRENT Hardware: arm64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: arm Assignee: freebsd-arm@FreeBSD.org Reporter: karels@freebsd.org When booting 14.0-ALPHA2 on Raspberry Pi 3B+ and 4B, a lock order reversal is found when attaching gpioled0. This is followed by 3 or 4 complaints about malloc being called with a non-sleepable lock held (3 on RPi 4, 4 on RPi 3). The messages from RPi3 are included here: gpioled0: <GPIO LEDs> on ofwbus0 lock order reversal: (sleepable after non-sleepable) 1st 0xffff000000d446f8 LED mtx (LED mtx, sleep mutex) @ /usr/src/sys/dev/led/led.c:296 2nd 0xffffa000017b1c10 Raspberry Pi firmware gpio (Raspberry Pi firmware gpio, sx) @ /usr/src/sys/arm/broadcom/bcm2835/raspberrypi_gpio.c:250 lock order LED mtx -> Raspberry Pi firmware gpio attempted at: #0 0xffff0000004d6db8 at witness_checkorder+0xa98 #1 0xffff000000471184 at _sx_xlock+0x7c #2 0xffff0000008b6230 at rpi_fw_gpio_pin_set+0xe0 #3 0xffff0000001c75ac at led_create_state+0x158 #4 0xffff000000191280 at gpioled_attach+0x290 #5 0xffff0000004a1598 at device_attach+0x3f8 #6 0xffff0000004a1108 at device_probe_and_attach+0x7c #7 0xffff0000004a3448 at bus_generic_new_pass+0xfc #8 0xffff0000004a33f8 at bus_generic_new_pass+0xac #9 0xffff0000004a33f8 at bus_generic_new_pass+0xac #10 0xffff00000049e324 at bus_set_pass+0x4c #11 0xffff0000003eb910 at mi_startup+0x1fc #12 0xffff0000000008ac at virtdone+0x70 uma_zalloc_debug: zone "malloc-64" with the following non-sleepable locks held: exclusive sleep mutex LED mtx (LED mtx) r = 0 (0xffff000000d446f8) locked @ /usr/src/sys/dev/led/led.c:296 stack backtrace: #0 0xffff0000004d71fc at witness_debugger+0x5c #1 0xffff0000004d8400 at witness_warn+0x400 #2 0xffff0000007869cc at uma_zalloc_debug+0x30 #3 0xffff00000078654c at uma_zalloc_arg+0x2c #4 0xffff000000439b78 at malloc+0x8c #5 0xffff0000008ab498 at bcm2835_firmware_property+0x44 #6 0xffff0000008b6248 at rpi_fw_gpio_pin_set+0xf8 #7 0xffff0000001c75ac at led_create_state+0x158 #8 0xffff000000191280 at gpioled_attach+0x290 #9 0xffff0000004a1598 at device_attach+0x3f8 #10 0xffff0000004a1108 at device_probe_and_attach+0x7c #11 0xffff0000004a3448 at bus_generic_new_pass+0xfc #12 0xffff0000004a33f8 at bus_generic_new_pass+0xac #13 0xffff0000004a33f8 at bus_generic_new_pass+0xac #14 0xffff00000049e324 at bus_set_pass+0x4c #15 0xffff0000003eb910 at mi_startup+0x1fc #16 0xffff0000000008ac at virtdone+0x70 uma_zalloc_debug: zone "malloc-16" with the following non-sleepable locks held: exclusive sleep mutex LED mtx (LED mtx) r = 0 (0xffff000000d446f8) locked @ /usr/src/sys/dev/led/led.c:296 stack backtrace: #0 0xffff0000004d71fc at witness_debugger+0x5c #1 0xffff0000004d8400 at witness_warn+0x400 #2 0xffff0000007869cc at uma_zalloc_debug+0x30 #3 0xffff00000078654c at uma_zalloc_arg+0x2c #4 0xffff000000439b78 at malloc+0x8c #5 0xffff0000007d1c4c at bounce_bus_dmamem_alloc+0x50 #6 0xffff0000008adf04 at bcm2835_mbox_property+0xdc #7 0xffff0000008ab4cc at bcm2835_firmware_property+0x78 #8 0xffff0000008b6248 at rpi_fw_gpio_pin_set+0xf8 #9 0xffff0000001c75ac at led_create_state+0x158 #10 0xffff000000191280 at gpioled_attach+0x290 #11 0xffff0000004a1598 at device_attach+0x3f8 #12 0xffff0000004a1108 at device_probe_and_attach+0x7c #13 0xffff0000004a3448 at bus_generic_new_pass+0xfc #14 0xffff0000004a33f8 at bus_generic_new_pass+0xac #15 0xffff0000004a33f8 at bus_generic_new_pass+0xac #16 0xffff00000049e324 at bus_set_pass+0x4c #17 0xffff0000003eb910 at mi_startup+0x1fc uma_zalloc_debug: zone "malloc-128" with the following non-sleepable locks held: exclusive sleep mutex LED mtx (LED mtx) r = 0 (0xffff000000d446f8) locked @ /usr/src/sys/dev/led/led.c:296 stack backtrace: #0 0xffff0000004d71fc at witness_debugger+0x5c #1 0xffff0000004d8400 at witness_warn+0x400 #2 0xffff0000007869cc at uma_zalloc_debug+0x30 #3 0xffff00000078654c at uma_zalloc_arg+0x2c #4 0xffff000000439b78 at malloc+0x8c #5 0xffff0000007d1c9c at bounce_bus_dmamem_alloc+0xa0 #6 0xffff0000008adf04 at bcm2835_mbox_property+0xdc #7 0xffff0000008ab4cc at bcm2835_firmware_property+0x78 #8 0xffff0000008b6248 at rpi_fw_gpio_pin_set+0xf8 #9 0xffff0000001c75ac at led_create_state+0x158 #10 0xffff000000191280 at gpioled_attach+0x290 #11 0xffff0000004a1598 at device_attach+0x3f8 #12 0xffff0000004a1108 at device_probe_and_attach+0x7c #13 0xffff0000004a3448 at bus_generic_new_pass+0xfc #14 0xffff0000004a33f8 at bus_generic_new_pass+0xac #15 0xffff0000004a33f8 at bus_generic_new_pass+0xac #16 0xffff00000049e324 at bus_set_pass+0x4c #17 0xffff0000003eb910 at mi_startup+0x1fc uma_zalloc_debug: zone "malloc-64" with the following non-sleepable locks held: exclusive sleep mutex LED mtx (LED mtx) r = 0 (0xffff000000d446f8) locked @ /usr/src/sys/dev/led/led.c:296 stack backtrace: #0 0xffff0000004d71fc at witness_debugger+0x5c #1 0xffff0000004d8400 at witness_warn+0x400 #2 0xffff0000007869cc at uma_zalloc_debug+0x30 #3 0xffff00000078654c at uma_zalloc_arg+0x2c #4 0xffff000000439b78 at malloc+0x8c #5 0xffff0000007d1d1c at bounce_bus_dmamem_alloc+0x120 #6 0xffff0000008adf04 at bcm2835_mbox_property+0xdc #7 0xffff0000008ab4cc at bcm2835_firmware_property+0x78 #8 0xffff0000008b6248 at rpi_fw_gpio_pin_set+0xf8 #9 0xffff0000001c75ac at led_create_state+0x158 #10 0xffff000000191280 at gpioled_attach+0x290 #11 0xffff0000004a1598 at device_attach+0x3f8 #12 0xffff0000004a1108 at device_probe_and_attach+0x7c #13 0xffff0000004a3448 at bus_generic_new_pass+0xfc #14 0xffff0000004a33f8 at bus_generic_new_pass+0xac #15 0xffff0000004a33f8 at bus_generic_new_pass+0xac #16 0xffff00000049e324 at bus_set_pass+0x4c #17 0xffff0000003eb910 at mi_startup+0x1fc armv8crypto0: CPU lacks AES instructions -- You are receiving this mail because: You are the assignee for the bug.