xs oracle 2009 pv usb
DESCRIPTION
Noboru Iwamatsu: Paravirtualized USB SupportTRANSCRIPT
Paravirtualized USB Support for Xen:
Status Update
Noboru Iwamatsu
FUJITSU LABORATORIES LTD.
Xen Summit at Oracle Feb 24-25, 2009
Contents
Background and Motivation
Development Status
PVUSB Design
Demo (Video)
Test Results
Copyright 2009 FUJITSU LIMITED1
Background: Client virtualization and USB
Copyright 2009 FUJITSU LIMITED
In client virtualization, special Service-VMs work in the background of User-VM, and provide various functions.
Both User-VM and Service-VMs require using the USB devices at the same time by the same USB host controller.
Hypervisor
User VM Service VM Service VM
LaptopUSB Host Controller
User OS Service OS Service OS
AuthenticationVoIP/
Messenger
Office/Music
apps
USB devices
Usage example of
client virtualization
2
Motivation
USB support for Xen today
Qemu-dm UHCI emulation
• USB 1.1 only
PCI pass-through with IOMMU
• Works well. But the entire controller is assigned to a single domain and can’t be used from other domains.
Current options are not suitable for client virtualization!
We have started development to achieve a good performance and flexibility!
Copyright 2009 FUJITSU LIMITED3
Aug. 2008 Started development.
Proposed in XCI (Xen Client Initiative).
Sep. 2008 “PV USB support” was on the roadmap of Xen 3.4.
Nov. 2008 Just started working!
Xen Summit @Tokyo 2008
Development Status
CHANGES from the last summit
What we did
Emulation of the CLEAR_HALT command added in the backend.
RING operations and queue usage changed.
Initial hotplug code added.
Results
Various devices worked (HID, Storage, Serial, Ethernet)
Performance improved (6MB/s to 33MB/s on USB storage)
Hotplug worked, but unplug not worked yet :-)
What we left
No code posted yet!
Disconnection and canceling functions not completed.
Not well tested.
Copyright 2009 FUJITSU LIMITED4
PVUSB Design: Driver Architecture
Frontend driver (usbfront) - Implemented as a USB host controller driver
Backend driver (usbback) - Implemented as a USB function driver
Copyright 2009 FUJITSU LIMITED5
usbback
usbfront
Xen frontend interface
RING xenbus
Virtual USB
Host Controller Driver
USB Function Driver
USB Core
Host Controller Driver
USB Core
USB Function Driver
Xen backend interface
RINGxenbus
urb urb
Cloned
urb
Driver domain kernel-space Guest domain kernel-space
Cloned
urb
Hardware
(USB Host Controller)
.urb_enqueue() usb_hcd_giveback_urb()
usb_submit_urb () urb->complete
free
usb_alloc_urb() free or reuse
usb_alloc_urb()
urb (USB Request Block structure):
In linux kernel, all USB drivers communicate
with urb. (described in include/linux/usb.h).
PVUSB Design: Hotplug
Copyright 2009 FUJITSU LIMITED
Hotplug-rule is set from sysfs interface in the backend driver.
The hotplug-rule format
• <usbbusname>:<domid>:<vusb number>:<virtual port number>
Example settings% echo 1-2.3:1:0:3 > /sys/bus/usb/drivers/usbback/new_vport
% echo 1-4:2:0:1 > /sys/bus/usb/drivers/usbback/new_vport
% echo 1-2.1:2:0:2 > /sys/bus/usb/drivers/usbback/new_vport
6
Guest VM 1
(domain ID:1)
usbfrontHost Controller
(vusb-0)
Virtual
roothub
Guest VM 2
(domain ID:2)
usbfrontHost Controller
(vusb-0)
Virtual
roothub
device
Dom 0
Host Controller
(usb1)
roothub
hub
device
device device device device
device
1-4
1-2.1 1-2.3
usbback
Claim the device,
and notify by xenbus.
Hotplug notification
PVUSB Design: Source Code Tree
Copyright 2009 FUJITSU LIMITED7
Xen USB frontend driver
Makefile
usbfront header file
Debugging functions for Host Controller
USB2.0 Host Controller interface
Root Hub emulations for Host Controller
USB frontend RING operations and URB transmissions
Xenbus operations
Xen USB backend driver
Backend interface management
Makefile
USB backend RING operations and URB transmissions
usbback header file
USB stub driver – grabbing and managing USB devices
Xenbus operations
Xen USB public I/O header
usbif header file
Require no change in existing kernel code!
Demo (Video)
Copyright 2009 FUJITSU LIMITED8
Hotplug Keyboard, Mouse, Flash drive, HDD and Ethernet.
All devices successfully connected to guest domain and work fine.
Results: Tested Devices (USB2.0)
Copyright 2009 FUJITSU LIMITED
Device
TypeName Manufacturer
Transfer
TypeDriver Status
Flash drive RUF2-R2GS Buffalo Bulk usb-storage
Flash drive RUF-C1G/U2 Buffalo Bulk usb-storage
Flash drive DataTraveler DTI/1G Kingston Bulk usb-storage
HDD HDCN-U500 IO DATA Bulk usb-storage
Memory Card
Reader/WriterBSCRA38U2 Buffalo Bulk usb-storage
Ethernet
(100Base-TX)ETX2-US2 IO DATA Bulk/Intr pegasus
Ethernet
(1000Base-T)ETG2-US2 IO DATA Bulk/Intr asix
[1]
VGA USB2.0 SVGA
AdapterKAIREN Bulk/Intr sisusbvga
[2]
9
Works Works with issues Not work
[1] Interrupt URB fails, and the device goes into a stall.
[2] No URB fails, but fails to output the correct screen.
Results: Tested Devices (USB1.1)
Copyright 2009 FUJITSU LIMITED
Device
TypeName Manufacturer
Transfer
TypeDriver Status
Keyboard FMV-KB333 Fujitsu Intr usbhid
Keyboard FKB-108-EU FILCO Intr usbhid
MouseCordless Notebook
MouseLogitech Intr usbhid
Mouse Optical Mouse USB Logitech Intr usbhid
FDD USB-FDU Y-E DATA Bulk/Intr usb-storage
Serial USB-RSAQ5 IO DATA Bulk/Intr pl2303
Webcam WebCam 3 USB Creative Labs Isoc ov511 [3]
Webcam WebCam NX pro Creative Labs Isoc gspca [4]
10
Works Works with issues Not work
[3] No URB fails, but incorrect horizontal stripes are into the video image.
[4] No URB fails, but the video image has incorrect blinking and flickers.
Results: Performance (USB Storage)
Copyright 2009 FUJITSU LIMITED11
29.0
20.3
33.3
24.9
31.5
24.9
33.8
25.2
0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0
Read
Write
Read
Write
US
B F
lash D
rive
US
B H
DD
USB Mass Storage Read/Write Throughput (MB/s)
Paravirtualized USB
Dom0 native driver
Read/Write 1GB block using dd command.
USB Flash Drive: Buffalo RUF2-R2GS
USB HDD: IODATA HDCN-U500
Test environment:
CPU: Intel Core 2 Duo 6700 2.66GHz
Kernel: linux-2.6.18-xen (c/s 789), x86_64
Xen: 3.3.0 release, x86_64
92% vs native
82% vs native
99% vs native
99% vs native
Results: Performance (USB Ethernet)
Copyright 2009 FUJITSU LIMITED12
77.7
62.2
89.9
92.5
0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0
Rx
Tx
US
B E
the
rne
tUSB Ethernet(100Base-TX) TCP Throughput (Mbps)
Paravirtualized USB
Dom0 native driver
Test environment:
CPU: Intel Core 2 Duo 6700 2.66GHz
Kernel: linux-2.6.18-xen (c/s 789), x86_64
Xen: 3.3.0 release, x86_64
TCP throughput measured by ttcp command.
USB Ethernet: IODATA ETX2-US2
86% vs native
67% vs native
0
10
20
30
40
50
Paravirtualized USB
Dom0 native driver
Paravirtualized USB
Dom0 native driver
Read Write
CP
U(%
)
CPU utilization: USB HDD Read/Write
Paravirtualized USB
Domain 0 native driver
Results: CPU Utilization (USB Storage)
Copyright 2009 FUJITSU LIMITED13
Test environment:
CPU: Intel Core 2 Duo 6700 2.66GHz
Kernel: linux-2.6.18-xen (c/s 789), x86_64
Xen: 3.3.0 release, x86_64
Xentop average while Read/Writ with dd command.
USB HDD: IODATA HDCN-U500
Guest
Dom0
Guest
Dom0
x1.9 vs native
x2.6 vs native
Dom0
Dom0
0
10
20
30
40
50
60
70
80
90
Paravirtualized USB
Dom0 native driver
Paravirtualized USB
Dom0 native driver
Rx Tx
CP
U(%
)
CPU utilization: USB Ethernet Rx/Tx
Paravirtualized USB
Domain 0 native driver
Results: CPU Utilization (USB Ethernet)
Copyright 2009 FUJITSU LIMITED14
Test environment:
CPU: Intel Core 2 Duo 6700 2.66GHz
Kernel: linux-2.6.18-xen (c/s 789), x86_64
Xen: 3.3.0 release, x86_64
Xentop average while using ttcp command.
USB Ethernet: IODATA ETX2-US2
Guest
Dom0
Guest
Dom0
x3 vs native
x3.4 vs native
Dom0Dom0
TODO & Future Work
TODO (for posting the code)
Complete the device disconnection and the URB canceling functions.
• Current PVUSB can hotplug, but can’t unplug, and can’t cancel the URBs that already transferred to the backend.
• When the device fails and actually stops, current PVUSB can do nothing.
Add Xend support.
Future Work (after initial posted)
Isochronous transfer support (for WebCAM)
• Driver has no errors, the problem seems timing related.
Some optimizations
• Reducing the buffer allocation overhead
• Better handling of the large buffer transfer
• Netchannel2 support
Copyright 2009 FUJITSU LIMITED15
We take a month to post the code.
Conclusion
Paravirtualized USB achieved:
Various devices worked.
Worked devices
Keyboard(2), Mouse(2), FDD(1), Serial(1), Flash drive(3), HDD(1), Ethernet(1)
Performance improved.
• USB Storage: 99 % of the native driver
• USB Ethernet: 67% - 86% of the native driver
Hotplug worked.
Toward the initial release
Complete the several essential functions.
More test
• SMP(Quad-core), multiple-domain, heavy load, …
Copyright 2009 FUJITSU LIMITED16
Copyright 2009 FUJITSU LIMITED17
Appendix: dmesg output
Copyright 2009 FUJITSU LIMITED18
dmesg output after usbfront loaded.
Appendix: lsusb output
Copyright 2009 FUJITSU LIMITED19
lsusb output after connected the devices.
Appendix: Webcam(ov511) output
Copyright 2009 FUJITSU LIMITED20
xawtv video streaming output
Appendix: USB-VGA(sisusbvga) output
Copyright 2009 FUJITSU LIMITED21
USB-VGA output: CentOS 5.2 default login screen (res. 1024x768)