SlideShare a Scribd company logo
Device Virtualization and Management in Xen 
Lingfei Kong 
2014-11-10 
Contents 
1 Device Virtualization and Management in Xen 2 
1.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 
2 Agenda 3 
3 Xen Virtualizaiton Architecture 4 
3.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 
4 Device Virtualization 4 
4.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 
5 Paravirtualization of Devices 4 
6 Backends and Frontends 6 
7 Backends and Frontends 7 
7.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 
8 Backends and Frontends - Device Initialization 10 
8.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 
9 Backends and Frontends - Device Closedown 11 
10 Backends and Frontends - Device Closedown 13 
11 Full Virtualization of Devices 14 
11.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 
12 No Virtualization 15 
1
13 No Virtualization 16 
13.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 
14 No Virtualization 17 
14.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 
15 Reference 18 
16 Q & A 18 
1 Device Virtualization and Management in Xen 
slide 
2
1.1 Note notes 
• All test cases: 268, related to device: 100, The are important cases 
2 Agenda slide 
• Xen Virtualization Architecture 
• Device Virtualization 
• Paravirtualization of Devices 
• Backends and Frontends 
• Backends and Frontends - Device Initialization 
• Backends and Frontends - Device Closedown 
• Full Virtualization of Devices 
• No Virtualization 
• Q & A 
• Reference 
3
3 Xen Virtualizaiton Architecture slide 
3.1 Note notes 
• 3 layers 
4 Device Virtualization slide 
• Paravirtualization of Devices 
• Full Virtualization of Devices 
• No Virtualization 
4.1 Note notes 
5 Paravirtualization of Devices slide 
• General approach to device management 
4
• Dom0 manages the actual device driver and exports a generic class of 
device 
• Use Backend/Frontend model 
• PV on HVM 
– From rhel6 
* xen_emul_unplug=never -> this will force guest to use em-ulated 
devices 
* xen_emul_unplug=unnecessary -> will use pv driver if there 
are xen pv drivers loaded 
• Advantage of Paravirtualization Devices: 
– Allows guest operating systems to implement only one device 
driver for each generic class of devices 
– Much easier to make a new operating system usable 
– Similar performance to physical machine > 90% 
• Each virtual device has three major components 
– A shared memory page containing the ring buffers 
– An event channel signaling activity in the ring 
– A XenStore entry containing configuration information 
5
6 Backends and Frontends slide 
• Guest issues device request to frontend driver, frontend driver commu-nicates 
with backend driver. 
Backend queues up the request and eventually issues the request to the 
actual underlying hardware 
• Backend 
– Runs in privileged domain 
– Multiplexing the use of the device 
– Responsible for protecting the security and privacy of data 
• Frontend 
– Runs in unpriviledge guests 
– Need pv drivers installed on guest os 
6
7 Backends and Frontends slide 
• XenBus and XenStore 
– XenBus provides a bus abstraction for paravirtualized drivers to 
communicate between backend/frontend drivers 
– Use XenStore to exchange the basic parameters needed to make 
the connection between frontend and backend drivers 
– Both user space and kernel code can write to the XenStore.The 
kernel code writes to the XenStore by using XenBus. 
* xenstore-ls, xenstore-list, xenstore-read, xenstore-write, xenstore-r 
– Glance of XenStore 
7
– Backend and Frontend connect(take block device driver for exam-ple) 
7.1 Note notes 
• /vm/uuid/{image,device,shadow_memory,uuid,on_crash,on_reboot,start_time,on_poweroff,name,• /vm/uuid/image/{ostype,kernel,cmdline,ramdisk} 
• /vm/uuid/device/{frontend,frontend-id,backend-id,backend} 
• local/domain 
8
9
8 Backends and Frontends - Device Initialization 
slide 
10
8.1 Note notes 
• The details to be written are: 
The details to be written are: 
/local/domain/0/backend/vbd/U/<deviceID>/... 
frontend /local/domain/U/device/vbd/<deviceID> 
frontend-id U 
state XenbusStateInitialising 
... <device-specific details> 
/local/domain/U/device/vbd/<deviceID>/... 
backend /local/domain/0/backend/vbd/U/<deviceID> 
backend-id 0 
state XenbusStateInitialising 
... <device-specific details> 
• netback_probe(), blkback_prob() 
• page map, page transfer 
9 Backends and Frontends - Device Closedown 
slide 
• Device unplug request to Xend 
11
12
10 Backends and Frontends - Device Closedown 
slide 
• Device driver encounter an error 
13
11 Full Virtualization of Devices slide 
• Use actual device driver to communicate with the emulated device 
14
• No need pv/frontend drivers installed on guest os 
• Use qemu-dm to provide device emulation for HVM guests with virtu-alization 
extensions such as Intel-VT or AMD-V 
• Disadvantage of full virtualization devices 
– Less portable than the paravirtualized model 
– Less performance than the paravirtualized mode 
11.1 Note notes 
• VT-x add 10 opcodes, such as: VMCALL, VMXON, VMXOFF, VM-RESUME, 
VMWRITE, VMREAD 
• AMD-V add 8 opcodes 
• VMD-V, IOMMU, VT-D 
• VMCS, VMCB 
• There is of course a performance cost for using QEMU, so there are 
chances that usage of QEMU will be replaced in the future with dif-ferent 
soulutions which have lower performance costs. 
• SVM stands for "Secure Virtual Machine". 
12 No Virtualization slide 
• Grant physical devices directly to an unprivileged domain 
15
• The guest (domU) needs to have a driver for the actual PCI device, 
PV guests also need to have a generic Xen PCI frontend driver. 
• Xen PCI passthru to a PV (paravirtual) guest 
– If you want DMA 
* Add "swiotlb=force" to guest’s kernel command line 
– PCI quirks 
* No permission 
pciback 0000:08:00.0: Driver tried to write to a read-only 
configuration space field at offset 0xe0, size 2. This may be 
harmless, but if you have problems with your device: 
* lspci -nn 
* Add vendor id to /etc/xen/xend-pci-permissive.sxp 
13 No Virtualization slide 
• Xen PCI passthru to an HVM (fully virtualized) guest 
– No special configuration for the guest kernel 
• Granting Control of a PCI Device 
– PCI pass-through 
* Enable VT-d in BIOS 
* Hide PCI Device from Dom0 
16
#lspci -D |grep USB 
0000:00:0b.0 USB controller: NVIDIA Corporation MCP51 USB Controller (rev 0000:00:0b.1 USB controller: NVIDIA Corporation MCP51 USB Controller (rev # echo 0000:00:0b.1 > /sys/bus/pci/devices/0000:00:0b.1/driver/unbind 
13.1 Note notes 
• NIC, disk controller, HBA, USB controller, firewire controller, sound-card, 
etc 
14 No Virtualization slide 
• – * Binding the PCI Device to pciback driver 
# modprobe pciback 
# lsmod |grep pciback 
pciback 65617 0 
# echo 0000:00:0b.1 > /sys/bus/pci/drivers/pciback/new_slot 
# echo 0000:00:0b.1 > /sys/bus/pci/drivers/pciback/bind 
* Check the hidden PCI Device 
# xm pci-list-assignable-devices 
0000:00:0b.1 
* Granting the PCI Device to Another Domain 
# xm pci-detach <guest> <pci device> 
14.1 Note 
• <domain>:<bus>:<slot>.<function>: domain refers to a PCI do-main 
not xen domain 
• 
17
15 Reference slide 
• Block device model 
• PCI pass-through 
• Xen PCI Passthrough 
• XenStore 
• Backend and Fontend 
• Virtualization Background 
• Driver Domain 
16 Q & A slide 
18

More Related Content

PPTX
Hypervisors
PDF
Hypervisor Framework
PPTX
Hypervisor seminar
PPTX
Vcp6.7 episode 1
PDF
Project ACRN hypervisor introduction
PDF
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
PPTX
Principles of Virtualization - Introduction to Virtualization Software
PDF
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
Hypervisors
Hypervisor Framework
Hypervisor seminar
Vcp6.7 episode 1
Project ACRN hypervisor introduction
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
Principles of Virtualization - Introduction to Virtualization Software
ACRN vMeet-Up EU 2021 - functional safety design and certification plan

What's hot (20)

PDF
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
PDF
Project ACRN Device Model architecture introduction
PDF
XS Boston 2008 OpenSolaris
PPT
PPSX
Virtualization basics
PDF
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
PPTX
Virtualization
PDF
XS Japan 2008 BitVisor English
KEY
Hardware supports for Virtualization
PDF
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
PDF
Project ACRN Yocto Project meta-acrn layer introduction
PDF
Project ACRN configuration scenarios and config tool
PDF
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
PPTX
Hardware support for efficient virtualization
PDF
Project ACRN Device Passthrough Introduction
PDF
XPDS16: Display Handler, a Client Display Framework for Xen - Brendan Kerrig...
PDF
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
PPTX
2014.08.30 Virtual Machine Threat 세미나
PDF
Virtualization Technology Overview
PDF
ACRN vMeet-Up EU 2021 - installation and configuration introduction
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
Project ACRN Device Model architecture introduction
XS Boston 2008 OpenSolaris
Virtualization basics
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
Virtualization
XS Japan 2008 BitVisor English
Hardware supports for Virtualization
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN configuration scenarios and config tool
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
Hardware support for efficient virtualization
Project ACRN Device Passthrough Introduction
XPDS16: Display Handler, a Client Display Framework for Xen - Brendan Kerrig...
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
2014.08.30 Virtual Machine Threat 세미나
Virtualization Technology Overview
ACRN vMeet-Up EU 2021 - installation and configuration introduction
Ad

Similar to Device virtualization and management in xen (20)

PPS
Xen Euro Par07
PPTX
5. IO virtualization
PDF
Xen 10th anniversary Status Report (at SELF 2013)
ODP
S4 xen hypervisor_20080622
PPTX
LinuxCon Japan 13 : 10 years of Xen and Beyond
PDF
OSSNA18: Xen Beginners Training
PDF
2010 xen-lisa
PDF
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
PDF
GPU Virtualization in SUSE
PDF
Xen Hypervisor
PPTX
LinuxTag13: 10 years of Xen and beyond
PDF
Xen and Client Virtualization: the case of XenClient XT
PPTX
Xen Project Update LinuxCon Brazil
PDF
Xen revisited
PPT
XenServer, Hyper-V, and ESXi - Architecture, API, and Coding
PDF
RHEL5 XEN HandOnTraining_v0.4.pdf
PDF
Automated paravitualization of device drivers in xen
PDF
Cloud Computing Virtualization and containers
PDF
Linaro connect : Introduction to Xen on ARM
ODP
UDS 2012 Xen
Xen Euro Par07
5. IO virtualization
Xen 10th anniversary Status Report (at SELF 2013)
S4 xen hypervisor_20080622
LinuxCon Japan 13 : 10 years of Xen and Beyond
OSSNA18: Xen Beginners Training
2010 xen-lisa
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
GPU Virtualization in SUSE
Xen Hypervisor
LinuxTag13: 10 years of Xen and beyond
Xen and Client Virtualization: the case of XenClient XT
Xen Project Update LinuxCon Brazil
Xen revisited
XenServer, Hyper-V, and ESXi - Architecture, API, and Coding
RHEL5 XEN HandOnTraining_v0.4.pdf
Automated paravitualization of device drivers in xen
Cloud Computing Virtualization and containers
Linaro connect : Introduction to Xen on ARM
UDS 2012 Xen
Ad

More from Lingfei Kong (8)

PDF
Emacs presentation
PDF
It经典图书(附免费下载地址)
PDF
Shell实现的windows回收站功能的脚本
PDF
Python学习笔记
PDF
PDF
Congfigure python as_ide
PPT
Emacs tutorial
ODP
SR-IOV Introduce
Emacs presentation
It经典图书(附免费下载地址)
Shell实现的windows回收站功能的脚本
Python学习笔记
Congfigure python as_ide
Emacs tutorial
SR-IOV Introduce

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
A Presentation on Artificial Intelligence
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Big Data Technologies - Introduction.pptx
PDF
Modernizing your data center with Dell and AMD
PDF
Electronic commerce courselecture one. Pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
KodekX | Application Modernization Development
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
NewMind AI Monthly Chronicles - July 2025
Encapsulation_ Review paper, used for researhc scholars
A Presentation on Artificial Intelligence
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Dropbox Q2 2025 Financial Results & Investor Presentation
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25 Week I
Chapter 3 Spatial Domain Image Processing.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Network Security Unit 5.pdf for BCA BBA.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Big Data Technologies - Introduction.pptx
Modernizing your data center with Dell and AMD
Electronic commerce courselecture one. Pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KodekX | Application Modernization Development

Device virtualization and management in xen

  • 1. Device Virtualization and Management in Xen Lingfei Kong 2014-11-10 Contents 1 Device Virtualization and Management in Xen 2 1.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Agenda 3 3 Xen Virtualizaiton Architecture 4 3.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4 Device Virtualization 4 4.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 5 Paravirtualization of Devices 4 6 Backends and Frontends 6 7 Backends and Frontends 7 7.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 8 Backends and Frontends - Device Initialization 10 8.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 9 Backends and Frontends - Device Closedown 11 10 Backends and Frontends - Device Closedown 13 11 Full Virtualization of Devices 14 11.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 12 No Virtualization 15 1
  • 2. 13 No Virtualization 16 13.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 14 No Virtualization 17 14.1 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 15 Reference 18 16 Q & A 18 1 Device Virtualization and Management in Xen slide 2
  • 3. 1.1 Note notes • All test cases: 268, related to device: 100, The are important cases 2 Agenda slide • Xen Virtualization Architecture • Device Virtualization • Paravirtualization of Devices • Backends and Frontends • Backends and Frontends - Device Initialization • Backends and Frontends - Device Closedown • Full Virtualization of Devices • No Virtualization • Q & A • Reference 3
  • 4. 3 Xen Virtualizaiton Architecture slide 3.1 Note notes • 3 layers 4 Device Virtualization slide • Paravirtualization of Devices • Full Virtualization of Devices • No Virtualization 4.1 Note notes 5 Paravirtualization of Devices slide • General approach to device management 4
  • 5. • Dom0 manages the actual device driver and exports a generic class of device • Use Backend/Frontend model • PV on HVM – From rhel6 * xen_emul_unplug=never -> this will force guest to use em-ulated devices * xen_emul_unplug=unnecessary -> will use pv driver if there are xen pv drivers loaded • Advantage of Paravirtualization Devices: – Allows guest operating systems to implement only one device driver for each generic class of devices – Much easier to make a new operating system usable – Similar performance to physical machine > 90% • Each virtual device has three major components – A shared memory page containing the ring buffers – An event channel signaling activity in the ring – A XenStore entry containing configuration information 5
  • 6. 6 Backends and Frontends slide • Guest issues device request to frontend driver, frontend driver commu-nicates with backend driver. Backend queues up the request and eventually issues the request to the actual underlying hardware • Backend – Runs in privileged domain – Multiplexing the use of the device – Responsible for protecting the security and privacy of data • Frontend – Runs in unpriviledge guests – Need pv drivers installed on guest os 6
  • 7. 7 Backends and Frontends slide • XenBus and XenStore – XenBus provides a bus abstraction for paravirtualized drivers to communicate between backend/frontend drivers – Use XenStore to exchange the basic parameters needed to make the connection between frontend and backend drivers – Both user space and kernel code can write to the XenStore.The kernel code writes to the XenStore by using XenBus. * xenstore-ls, xenstore-list, xenstore-read, xenstore-write, xenstore-r – Glance of XenStore 7
  • 8. – Backend and Frontend connect(take block device driver for exam-ple) 7.1 Note notes • /vm/uuid/{image,device,shadow_memory,uuid,on_crash,on_reboot,start_time,on_poweroff,name,• /vm/uuid/image/{ostype,kernel,cmdline,ramdisk} • /vm/uuid/device/{frontend,frontend-id,backend-id,backend} • local/domain 8
  • 9. 9
  • 10. 8 Backends and Frontends - Device Initialization slide 10
  • 11. 8.1 Note notes • The details to be written are: The details to be written are: /local/domain/0/backend/vbd/U/<deviceID>/... frontend /local/domain/U/device/vbd/<deviceID> frontend-id U state XenbusStateInitialising ... <device-specific details> /local/domain/U/device/vbd/<deviceID>/... backend /local/domain/0/backend/vbd/U/<deviceID> backend-id 0 state XenbusStateInitialising ... <device-specific details> • netback_probe(), blkback_prob() • page map, page transfer 9 Backends and Frontends - Device Closedown slide • Device unplug request to Xend 11
  • 12. 12
  • 13. 10 Backends and Frontends - Device Closedown slide • Device driver encounter an error 13
  • 14. 11 Full Virtualization of Devices slide • Use actual device driver to communicate with the emulated device 14
  • 15. • No need pv/frontend drivers installed on guest os • Use qemu-dm to provide device emulation for HVM guests with virtu-alization extensions such as Intel-VT or AMD-V • Disadvantage of full virtualization devices – Less portable than the paravirtualized model – Less performance than the paravirtualized mode 11.1 Note notes • VT-x add 10 opcodes, such as: VMCALL, VMXON, VMXOFF, VM-RESUME, VMWRITE, VMREAD • AMD-V add 8 opcodes • VMD-V, IOMMU, VT-D • VMCS, VMCB • There is of course a performance cost for using QEMU, so there are chances that usage of QEMU will be replaced in the future with dif-ferent soulutions which have lower performance costs. • SVM stands for "Secure Virtual Machine". 12 No Virtualization slide • Grant physical devices directly to an unprivileged domain 15
  • 16. • The guest (domU) needs to have a driver for the actual PCI device, PV guests also need to have a generic Xen PCI frontend driver. • Xen PCI passthru to a PV (paravirtual) guest – If you want DMA * Add "swiotlb=force" to guest’s kernel command line – PCI quirks * No permission pciback 0000:08:00.0: Driver tried to write to a read-only configuration space field at offset 0xe0, size 2. This may be harmless, but if you have problems with your device: * lspci -nn * Add vendor id to /etc/xen/xend-pci-permissive.sxp 13 No Virtualization slide • Xen PCI passthru to an HVM (fully virtualized) guest – No special configuration for the guest kernel • Granting Control of a PCI Device – PCI pass-through * Enable VT-d in BIOS * Hide PCI Device from Dom0 16
  • 17. #lspci -D |grep USB 0000:00:0b.0 USB controller: NVIDIA Corporation MCP51 USB Controller (rev 0000:00:0b.1 USB controller: NVIDIA Corporation MCP51 USB Controller (rev # echo 0000:00:0b.1 > /sys/bus/pci/devices/0000:00:0b.1/driver/unbind 13.1 Note notes • NIC, disk controller, HBA, USB controller, firewire controller, sound-card, etc 14 No Virtualization slide • – * Binding the PCI Device to pciback driver # modprobe pciback # lsmod |grep pciback pciback 65617 0 # echo 0000:00:0b.1 > /sys/bus/pci/drivers/pciback/new_slot # echo 0000:00:0b.1 > /sys/bus/pci/drivers/pciback/bind * Check the hidden PCI Device # xm pci-list-assignable-devices 0000:00:0b.1 * Granting the PCI Device to Another Domain # xm pci-detach <guest> <pci device> 14.1 Note • <domain>:<bus>:<slot>.<function>: domain refers to a PCI do-main not xen domain • 17
  • 18. 15 Reference slide • Block device model • PCI pass-through • Xen PCI Passthrough • XenStore • Backend and Fontend • Virtualization Background • Driver Domain 16 Q & A slide 18