zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.52k stars 6.45k forks source link

drivers: PHY Microchip KSZ8081 will block system work queue for 500/1000ms #78651

Open stomschik-ask opened 1 day ago

stomschik-ask commented 1 day ago

Describe the bug I am using the NXP MIMXRT1060-EVK with Microchip KSZ8081 Ethernet PHY. The function phy_mc_ksz8081_reset() will busy wait for 500ms or even 1000ms (if a reset pin is configured) for the reset of the Ethernet PHY. The function will be called from the system workqueue for example when plugging in or out the Ethernet cable. By default, the system work queue priority is the lowest cooperative priority, i.e. the busy wait won't be preempted by any other thread until finished.

To Reproduce Use for example the Telnet console sample

  1. west build --pristine -b mimxrt1060_evk samples/net/telnet
  2. run the sample from the debugger
  3. set breakpoint at phy_mc_ksz8081_reset()
  4. unplug the Ethernet cable
  5. phy_mc_ksz8081_reset() will busy wait for 2x500ms in the context of the system workqueue

Expected behavior Items in the system workqueue shall not perform blocking operations that would delay other system workqueue processing to an unacceptable degree.

Impact Realtime deadlines might not be met. Our application is doing audio processing and blocking the thread providing audio samples to I2S driver will result in audio dropouts.

Environment

github-actions[bot] commented 1 day ago

Hi @stomschik-ask! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙