Go back to topic: What you may need to pay attention to when you are debugging xen / dom0 on USB 3.0 cable
2. In order to make debug environment controllable and stable, one can use LiveCD Ubuntu 22.04 as debug host. 3. Append `usbcore.autosuspend=-1` to the debug host kernel command line (I am not sure whether this is needed) | 2. In order to make debug environment controllable and stable, one can use LiveCD Ubuntu 22.04 as debug host. By default the LiveCD `/etc/apt/sources.list` does have only main repos and no universe repos, you need to add them if you want to use picocom in ubuntu 22.04 LiveCD. 3. (ignore this) <del>Append `usbcore.autosuspend=-1` to the debug host kernel command line (I am not sure whether this is needed)</del> Using the bind/unbind, the debug host does not need to worry about suspension - as long as the connection is closed (for example peer is sleeping) and the device is unbind (maybe you can unplug the debug cable now), host can suspend. |
12. Triple `ctrl-a` will switch _input_ between xen and dom0. When you are using `picocom` it is typing `ctrl-a` 6 times since `ctrl-a` is also escape command for `picocom` by default. | 12. Triple `ctrl-a` will switch _input_ between xen and dom0. When you are using `picocom` it is typing `ctrl-a` 6 times since `ctrl-a` is also escape command for `picocom` by default. `picocom -e b` can change the escape combination into `ctrl-b` which can save your fingers from pressing `ctrl-a` 6 times. |
``` Also there are many notes that may not apply to the topic. <details><summary>personal notes</summary> 1. (xen 4.14) xen console command '`*`' will expand to: `d 0 H I M Q V a c e g i m n q r s t u v z` 2. picocom sometimes echo back data to the debugee (usually the first 128 bytes of the data from debugee) - it is possibly because that serial port connection is not stable. I do not know a good solution on this behavior. This may cause xen to behave crazy and reset the machine when xen is accepting input rather than dom0. 3. code in `<details>` must have at least one additional new line between a html line and a "```" line, otherwise it will not be parsed as code. See: https://github.com/gettalong/kramdown/issues/155#issuecomment-339779671 </details> |
echo "Count $WAIT secs:" | |
echo " | echo -n "$i, " |
sudo picocom -b 115200 /dev/ | # escape is ctrl-b # write to file sudo picocom -e b -b 115200 /dev/ttyUSB0 -g log.txt |
UPDATE: `dbgp=xhci@pci00:14.0,share=yes console=vga,xhci loglvl=all guest_loglvl=all watchdog watchdog_timeout=20` (as suggested by andyhhp) | |
``` 14. In summary of many debug host tricks, here is a script that can save a lot of labor: ``` #!/bin/sh ADDR=0000:00:14.0 SYSFS_PATH=/sys/bus/pci/drivers/xhci_hcd WAIT=6 while true do for i in `seq ${WAIT} -1 1` do echo "In $i" sleep 1 done echo "One trial" sudo sh -c "echo ${ADDR} > ${SYSFS_PATH}/bind" sleep 0.5 if [ -e /dev/ttyUSB0 ] then sudo picocom -b 115200 /dev/ttyUSB0 fi sleep 0.5 sudo sh -c "echo ${ADDR} > ${SYSFS_PATH}/unbind" done |