Skip to content

shell: semaphore causes crashes, replacing by mutex works #99081

@josuah

Description

@josuah

Describe the bug

Testing on an ESP32-S3 (where bug happens) and nRF54LM20 (where bug does not happen).

Furthermore testing on top of experimental branch (where the shell source was not modified besides this workaround though):

At the commit 89c6af5 in particular

This was bissected to this commit 825dea6 by successively rebasing the PR above on top of it successively to test, and reliably, all ~10 commits tested after it have an issue, and all ~10 commits tested before it have an issue.

Reverting this commit anywhere solves the issue (or at least switching back to mutexes like in 9b72076).

Regression

  • This is a regression.

Steps to reproduce

ESP32:

west build -d build_esp32s3 -b esp32s3_devkitm/esp32s3/procpu samples/subsys/usb/shell/ \
    -DEXTRA_CONF_FILE=host_prj.conf -DCONFIG_USB_DEVICE_STACK_NEXT=n \
    -DCONFIG_UHC_DRIVER_LOG_LEVEL_DBG=y

west flash -d build_esp32s3 --esp-device /dev/ttyUSB1

picocom -b 115200 /dev/ttyUSB1

uart:~$ usbh init
uart:~$ usbh enable

<error seen below>

nRF54LM20:

west build -d build_nrf54lm20 -b nrf54lm20dk/nrf54lm20a/cpuapp samples/subsys/usb/shell/ \
    -DEXTRA_CONF_FILE=host_prj.conf -DCONFIG_USB_DEVICE_STACK_NEXT=n \
    -DCONFIG_UHC_DRIVER_LOG_LEVEL_DBG=y

west flash -d build_nrf54lm20

picocom -b 115200 /dev/ttyACM1

uart:~$ usbh init
uart:~$ usbh enable

<no error>

Relevant log output

uart:~$ usbh enable 
[00:00:03.853,000] <dbg> uhc_dwc2: esp32_usb_otg_enable_phy: PHY enabled
[00:00:03.853,000] <dbg> uhc_dwc2: uhc_dwc2_decode_intr: GINTSTS=05000021h, HPRT=00021403h
[00:00:03.853,000] <err> os:  ** FATAL EXCEPTION
[00:00:03.853,000] <err> os:  ** CPU 0 EXCCAUSE 29 (store prohibited)
[00:00:03.853,000] <err> os:  **  PC 0x4037771d VADDR 0
[00:00:03.853,000] <err> os:  **  PS 0x60020
[00:00:03.853,000] <err> os:  **    (INTLEVEL:0 EXCM: 0 UM:1 RING:0 WOE:1 OWB:0 CALLINC:2)
[00:00:03.853,000] <err> os:  **  A0 0x8037793b  SP 0x3fc92bc0  A2 0x3fc8f570  A3 0x3fc8f7a4
[00:00:03.853,000] <err> os:  **  A4 0x3fc8f570  A5 0x60023  A6 0x3fc99098  A7 0xffffffff
[00:00:03.853,000] <err> os:  **  A8 0  A9 0x2 A10 0x3fc8f570 A11 0x3fc98668
[00:00:03.853,000] <err> os:  ** A12 0x3fc99098 A13 0x3fc8f570 A14 0x3fc99515 A15 0x60a20
[00:00:03.853,000] <err> os:  ** LBEG 0 LEND 0 LCOUNT 0
[00:00:03.853,000] <err> os:  ** SAR 0
[00:00:03.853,000] <err> os:  **  THREADPTR 0x3fc94670
[00:00:03.853,000] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:03.854,000] <err> os: Current thread: 0x3fc8f570 (usb_otg@60080000)
[00:00:03.968,000] <err> os: Halting system

Impact

Annoyance – Minor irritation; no significant impact on usability or functionality.

Environment

  • OS: Linux
  • Toolchain: Zephyr SDK 0.17.2
  • Commit: 89c6af5 (pull request)

Additional Context

I wanted to report ASAP but if it helps, I can try to reproduce it on something upstream.

Metadata

Metadata

Assignees

Labels

RegressionSomething, which was working, does not anymorearea: ShellShell subsystembugThe issue is a bug, or the PR is fixing a bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions