guysoft / RealtimePi

An out-of-the-box raspebrrypi/raspbian distro with a realtime kernel
GNU General Public License v3.0
164 stars 25 forks source link

USB issues on RPI 1b, release 0.4.0 #22

Closed smx-smx closed 3 years ago

smx-smx commented 4 years ago

rootfs on USB IMG_20200503_183050

system seems to hang after the power cycle attempt

guysoft commented 4 years ago

Is anything attached to the USB?

smx-smx commented 4 years ago

Yes, a wifi dongle and a USB pendrive holding rootfs The same identical setup works fine with the following kernel

Linux raspberrypi 4.4.9-rt17+ #2 PREEMPT RT Thu May 12 00:18:09 CEST 2016 armv6l GNU/Linux Obtained from here: https://www.frank-durr.de/?p=203

guysoft commented 4 years ago

:1. The kernel there is from 2015, its version 4.4.9. Its very different from the newer 4.19.x version on 0.4.0. I can't really compare anything against it.

  1. Raspberry pi has a very problematic usb hub driver (its why they maintain their own fork). There are patches over the RT patches for it to work. Try booting without anything attaced to the USB first.
smx-smx commented 4 years ago

I noticed the patches related to the IRQ.

I tried adding dwc_otg.lpm_enable=1, which caused an error about the option being unrecognized, followed by the hub not working at all (and thus stopping the boot process waiting for root).

I'll need to move my rootfs on the SD card, but i think the best outcome will be that i boot without usb/ethernet functionalities, which would be a bummer.

I also tried building the kernel manually from the github repository (on the rpi-4.19.y-rt branch), but i get random freezes during boot (shortly after UART initialization)

Is that branch newer than the kernel on 0.4.0 release?

guysoft commented 4 years ago

AFAIK IRQ is relevant because its the USB interrupts. But thats a little beyond my scope.

The last patch in the branch is from Nov 2019: https://github.com/raspberrypi/linux/commits/rpi-4.19.y-rt

And 0.4.0 is released here: https://github.com/guysoft/RealtimePi/releases

You can see that that commit is listed in the release notes:

Huge thanks to @schnitzeltony who has made the PR fixes USB/FIQ lock-ups that made this release possible raspberrypi/linux#3336 >

So 0.4.0 is indeed up to date.

You could open an issue in the raspberrypi kernel issue tracker, but I don't think you will get much help until you unplug all USB devices. There is no grantee that they will work in a real-time environment.

smx-smx commented 4 years ago

Well they are clearly working in 4.4, so either the 4.4 kernel doesn't fully adhere to real time standards or the 4.19 kernel broke something.

I am not experiencing lockups with the 4.4 kernel, so the fix might be for a problem that didn't even exist (on the PI 1b) Note: i'm not sure how heavily i tested the system, but if the issue is related to SMP and multiple cores then the RPI 1 can't be affected given its single core nature

So clearly the issue is to research here: https://github.com/raspberrypi/linux/commits/e2e9cec6fb061ba58304fd391ef76747f2963557/drivers/usb/host/dwc_otg

It could be done in 2 ways, either by diffing the mainline and the RT patched kernel in search of differences or by (hopefully not) doing a lengthy git bisect for the top commits in that history

Extra note: it's impossible to fully release the usb bus unless you desolder the usb hub/ethernet bridge

guysoft commented 4 years ago
guysoft commented 3 years ago

Closing, use 0.5.0 I am not sure if supported 1b because no one has reported if it works.