Re: earlyprintk=xdbc seems broken

From: Peter Zijlstra
Date: Fri Dec 17 2021 - 08:56:52 EST


On Fri, Dec 17, 2021 at 01:01:43PM +0200, Mathias Nyman wrote:
> I can reproduce this.
> Looks like problems started when driver converted to readl_poll_timeout_atomic() in:
>
> 796eed4b2342 usb: early: convert to readl_poll_timeout_atomic()

I can confirm, reverting that solves the boot hang, things aren't quite
working for me though.

> Seems to hang when read_poll_timeout_atomic() calls ktime_* functions.
> Maybe it's too early for ktime.

It certainly is, using ktime for delay loops sounds daft to me anyhow.

> After reverting that patch it works again for me.

[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.16.0-rc3+ root=UUID=a652986c-fbc6-4341-85c3-b4ad4402f130 ro debug ignore_loglevel sysrq_always_enabled usbcore.autosuspend=-1 earlyprintk=xdbc force_early_printk sched_verbose ftrace=nop mitigations=off nokaslr
...
[ 0.000000] xhci_dbc:early_xdbc_parse_parameter: dbgp_num: 0
...
[ 3.161367] xhci_dbc:early_xdbc_setup_hardware: failed to setup the connection to host

The machine does boot.. but I *am* getting tons of:

[ 485.546898] usb usb4-port4: Cannot enable. Maybe the USB cable is bad?
[ 485.546963] usb usb4-port4: config error

However, when I do:

$ echo enable > /sys/bus/pci/devices/0000:00:14.0/dbc

I get:

[ 569.442899] xhci_hcd 0000:00:14.0: DbC connected
[ 569.898910] xhci_hcd 0000:00:14.0: DbC configured

And the remote machine gets:

[2318863.729022] usb 2-3: new SuperSpeed USB device number 8 using xhci_hcd
[2318863.749299] usb 2-3: LPM exit latency is zeroed, disabling LPM.
[2318863.749529] usb 2-3: New USB device found, idVendor=1d6b, idProduct=0010, bcdDevice= 0.10
[2318863.749531] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[2318863.749532] usb 2-3: Product: Linux USB Debug Target
[2318863.749533] usb 2-3: Manufacturer: Linux Foundation
[2318863.749534] usb 2-3: SerialNumber: 0001
[2318863.751142] usb_debug 2-3:1.0: xhci_dbc converter detected
[2318863.751268] usb 2-3: xhci_dbc converter now attached to ttyUSB0

and a subsequent:

$ echo ponies > /dev/ttyDBC0

Does show up on the remote machine...


So XDBC 'works' but earlyprintk is still refusing service.