[Please, don't toppost]
On 14.10.2012 17:03, abb wrote:
> On Sunday, October 14, 2012 10:07:06 AM UTC+2, Marek Marczykowski wrote:
>>
>> On 13.10.2012 20:36, abb wrote:
>>> Abel, do Marek's scripts work for you?
>>
>> I will test it tomorrow. Basically it looks good ("no exploits detected"
>> ;) ).
> I've tried PVUSB on original FC17, still no luck (kernel 3.6.1-1 + pvusb
> patch from [1]). Same issues as with Qubes 1.0 with 3.4 kernel. Both with
> Marek's tools and from [2]. For the latter to work a bunch of syntax issues
> needs to be corrected and it also fails to do an equivalent of 'vusb-ctl.py
> bind' so this needs to be done manually for the device to appear in domU. I
> have not tried patched xm [3] yet.
>
> I guess before continue spending time on qvm-usb, we need to have a stable
> pvusb kernel support. There are not that many success stories by the way,
> [2] is one of them and it is for kernel 2.6.
>
> [1]
http://wiki.xen.org/wiki/Xen_USB_Passthrough
> [2]
http://article.gmane.org/gmane.comp.emulators.xen.devel/70980
> [3]
>
http://old-list-archives.xen.org/archives/html/xen-devel/2009-12/msg00478.html
>
I've tried your changes, and qvm-usb tool is great work, but indeed pvusb
kernel driver isn't as stable as I though.
Some notes/observations:
0. I've tested only most simple scenarios: no dedicated UsbVM (usbback in
dom0), only one device at the same time. Kernel 3.4.12 (both dom0 and VM).
Used devices:
- usb stick (USB 2.0) - usb-storage driver
- bluetooth controller (USB 1.1) - btusb driver
- USB->serial converter (USB 1.1) - pl2303 driver
- Canon camera (USB 2.0) - generic usb driver + gphoto2
1. USB 1.1 devices don't work with USB 2.0 hub (the only created by usb_setup)
-> needed two USB hubs: one USB 2.0 and one USB 1.1 (and appropriate device
connection)
2. when changed default usb-ver to "1" (USB 1.1), xen-usbback crashes at
bluetooth controller attach (message 1 below)...
3. Sometimes qvm-usb -a failed to bind device at the first try. It success at
second try. Message 2 below.
4. Usb stick (USB 2.0) mount + read worked, but mkfs hanged, write to device
produced I/O errors...
5. USB->serial converter worked without any problem.
6. Camera (PTP mode) doesn't work - gphoto2 sends some data, but no answer
from device (not sure if it even get initial packet - no change on device
screen, but normally it blanks when communicating with computer)
Regarding the code technically:
1. Are you planning to integrate your files into rpm package (rpm_spec/*.spec)?
2. Regarding disconnecting USB device from VM, when device is physically
disconnected - there is some piece of code in block_remove for this - very
similar can be used for USB (it should clean one port instead of shutting down
whole hub).
So yes, you're right about stability of pvusb driver. When I've tried this
some time ago probably I had just more luck (and tried only usb sticks...).
Anyway most of above problems can be caused by one common bug (eg some ring
buffer overflow not handled properly), so I think it worth sending some
reports about the problems to driver author(s) + cc: xen-devel.
Listings:
1. kernel crash at bluetooth controller attach (backend):
[26852.334654] kernel BUG at
/home/user/qubes-src/kernel/kernel-3.4.12/linux-3.4.12/mm/slab.c:505!
[26852.334696] invalid opcode: 0000 [#1] SMP
[26852.334729] CPU 0
[26852.334743] Modules linked in: usb_storage uas xen_usbback dm_snapshot
binfmt_misc dm_mirror dm_region_hash dm_log xen_netback xen_gntdev xen_evtchn
snd_hda_codec_analog snd_hda_
intel xen_blkback snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm
thinkpad_acpi coretemp tpm_tis tpm nsc_ircc irda tpm_bios crc_ccitt thermal
battery ac btusb iTCO_wdt iTCO_v
endor_support snd_timer snd bluetooth i2c_i801 joydev soundcore rfkill pcspkr
snd_page_alloc mac_hid sg microcode ext4 jbd2 crc16 pcmcia sr_mod sd_mod cdrom
pata_acpi ata_generic at
a_piix ahci libahci yenta_socket pcmcia_rsrc pcmcia_core libata scsi_mod
ehci_hcd uhci_hcd usbcore intel_agp usb_common button video intel_gtt radeon
ttm drm_kms_helper drm agpgart
hwmon i2c_algo_bit i2c_core xen_pciback [last unloaded: scsi_wait_scan]
[26852.335440]
[26852.335454] Pid: 27665, comm: usbback.7.0 Not tainted
3.4.12-2.pvops.qubes.x86_64 #1 LENOVO 2007FVG/2007FVG
[26852.335514] RIP: e030:[<ffffffff811305dc>] [<ffffffff811305dc>]
kfree+0x1bc/0x200
[26852.335561] RSP: e02b:ffff88000f3dfda0 EFLAGS: 00010046
[26852.335591] RAX: ffffea0000088330 RBX: ffff8800026ea040 RCX: 0000000000000080
[26852.335625] RDX: 4000000000000000 RSI: 0000000000000200 RDI: ffff8800026ea040
[26852.335659] RBP: ffff88000f3dfdf0 R08: dead000000200200 R09: dead000000100100
[26852.335692] R10: 0000000019000000 R11: 0000000000000000 R12: ffff88003339c600
[26852.335726] R13: 0000000000000200 R14: ffff88002ee78640 R15: ffff88002ee78640
[26852.335764] FS: 00007f656622e700(0000) GS:ffff8800b5600000(0000)
knlGS:0000000000000000
[26852.335807] CS: e033 DS: 0000 ES: 0000 CR0: 000000008005003b
[26852.335834] CR2: 00007fcabd1bd000 CR3: 000000000a4c3000 CR4: 0000000000002660
[26852.335868] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[26852.335902] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[26852.335937] Process usbback.7.0 (pid: 27665, threadinfo ffff88000f3de000,
task ffff88002ee78640)
[26852.335983] Stack:
[26852.335997] ffff880002f46800 0000000000000010 ffff8800026ea040
ffff880002f46ce8
[26852.336050] ffff88002ee78640 ffff88003339c600 ffff88003339c600
ffff880002f46ce8
[26852.336102] ffff88002ee78640 ffff88002ee78640 ffff88000f3dfe10
ffffffffa01e9abb
[26852.336154] Call Trace:
[26852.336184] [<ffffffffa01e9abb>] urb_destroy+0x1b/0x30 [usbcore]
[26852.336222] [<ffffffffa01e9af5>] usb_free_urb+0x25/0x30 [usbcore]
[26852.336259] [<ffffffffa00377a0>] usbbk_free_urbs+0x90/0x140 [xen_usbback]
[26852.338299] [<ffffffffa003909d>] xen_usbif_schedule+0x8d/0x20c [xen_usbback]
[26852.338299] [<ffffffff8106bfa0>] ? wake_up_bit+0x40/0x40
[26852.338299] [<ffffffffa0039010>] ? usbbk_start_submit_urb+0x160/0x160
[xen_usbback]
[26852.338299] [<ffffffff8106ba96>] kthread+0x96/0xa0
[26852.338299] [<ffffffff814703a4>] kernel_thread_helper+0x4/0x10
[26852.338299] [<ffffffff814675b8>] ? retint_restore_args+0x5/0x6
[26852.338299] [<ffffffff814703a0>] ? gs_change+0x13/0x13
[26852.338299] Code: 66 41 83 46 40 01 41 8b 14 24 4b 8d 34 38 4c 89 c7 29 c2
41 89 14 24 89 d2 48 c1 e2 03 e8 4d e5 0f 00 41 8b 04 24 e9 f9 fe ff ff <0f>
0b eb fe 4d 8d 44 24 18 89 c2 4c 89 ff 31 c9 89 45 c8 4c 89
[26852.338299] RIP [<ffffffff811305dc>] kfree+0x1bc/0x200
[26852.338299] RSP <ffff88000f3dfda0>
[26852.338299] ---[ end trace 076d5528b3b04718 ]---
============================
2. Failed first qvm-usb -a call:
[user@dom0 ~]$ qvm-usb -l
dom0:4-1 0a5c:2110 Broadcom_Corp_BCM2045B
dom0:5-5 0457:0150 0457_0150
dom0:4-2 0483:2016 STMicroelectronics_Biometric_Coprocessor
[user@dom0 ~]$ qvm-usb -a test2 dom0:5-5
Traceback (most recent call last):
File "/usr/lib/qubes/vusb-ctl.py", line 18, in <module>
vusb_util.bind_usb_device(device)
File "/usr/lib64/python2.6/site-packages/xen/util/vusb_util.py", line 325,
in bind_usb_device
raise UsbDeviceBindingError("can't bind intf (%s). " % intf)
xen.util.vusb_util.UsbDeviceBindingError: vusb: Failed to bind/unbind USB
device: can't bind intf (5-5:1.0).
[user@dom0 ~]$ qvm-usb -a test2 dom0:5-5
[user@dom0 ~]$