SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
Linux as a guest
on Hyper-V
Vitaly Kuznetsov
Red Hat
DevConf 2016
2 Linux on Hyper-V
Virtualization at Red Hat
● OS-level virtualization at Red Hat:
● Xen-based solutions in the past
● KVM-based solutions now:
● RHEV, OpenStack
● RHEL-as-a-guest efforts:
● On KVM: RHEV and OpenStack, standalone
● On Xen: Amazon Web Services
● On VMware: standalone
● On Hyper-V: Azure and standalone
3 Linux on Hyper-V
Microsoft Hyper-V
● Present since Windows Server 2008
● The core of Microsoft Azure cloud
● Hyper-V is a Type 1 hypervisor for the x86 architecture
● Requires hardware support (Intel VT-x, AMD-V)
● Emulates standard x86 platforms:
● Generation 1 VM: “legacy” BIOS platform with emulated
devices
● Generation 2 VM: UEFI platform without emulated
devices
4 Linux on Hyper-V
Hyper-V architecture
● Full virtualization with selective enlightments:
● Enlightened I/O paths
● Optional for Generation 1
● Mandatory for Generation 2
● Heartbeat
● Utility drivers
● Time keeping and synchronization
● Crash reporting
● ...
5 Linux on Hyper-V
Hyper-V and Linux
● Kernel drivers:
● Added to staging in 2009
● Out of staging in 2011
● Included in all major Linux distributions: RHEL, Fedora,
OpenSUSE/SLES, Debian, Ubuntu,...
● Actively used on Azure: 25% of all VMs are Linux!
(Microsoft)
6 Linux on Hyper-V
Hyper-V drivers development
● Commits since 2011 (leaving staging):
2011 2012 2013 2014 2015
0
50
100
150
200
250
300
Commits from @microsoft.com
Commits from @redhat.com
Commits from other community members
7 Linux on Hyper-V
Hyper-V drivers in Linux kernel
● Currently present drivers:
● hv_storvsc (IDE/SCSI/FC storages)
● hv_netvsc (network adapter)
● hyperv_fb (framebuffer device)
● hyperv-keyboard (keyboard)
● hid-hyperv (mouse)
● hv_balloon (memory ballooning and hotplug)
● hv_util (utility drivers)
8 Linux on Hyper-V
Hyper-V storvsc driver
● High performace storage driver
● Devices support:
● SCSI
● IDE (Gen1 VMs)
● Fibre Channel
● Partial SPC-3 compliance since Win8/WS2012
● Full SPC-3 compliance Win10/WS2016
● Multiqueue support
9 Linux on Hyper-V
Hyper-V netvsc driver
● High performace network driver
● Multiqueue
● Supports scaling for RX with vRSS
● Dynamic and Static VMQ for TX
● Supports batching for TX
● Decorates each outgoing packet with RNDIS header
● No NAPI support (yet)
10 Linux on Hyper-V
Hyper-V netvsc performance (Microsoft data)
1 8 64 256 1024 6000
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
4.1
25.0
28.3 26.9
23.4
15.5
5.6
20.7
30.6 31.3
25.2
10.0
On Local HyperV
WS2012R2 Linux
Number Of Connections
Throughput(Gbps)
Note:
Server VM CPU: 8 vCPUs of E5-2690 @2.90GHz, on one NUMA node
11 Linux on Hyper-V
Hyper-V netvsc performance (Microsoft data)
1 8 64 256 1024 6000
0.0
5.0
10.0
15.0
20.0
25.0
30.0
2.3
20.6
24.2 23.3
15.8
9.9
4.1
15.3
21.3
17.1
14.0 12.7
On Azure G5
WS2012R2 Linux
Number Of Connections
Throughput(Gbps)
Note:
VM CPU: 32 vCPUs of E5-2698B v3 @ 2.00GHz, on two NUMA nodes
12 Linux on Hyper-V
Hyper-V utility drivers and daemons
● 'Internal' drivers
● Clocksources, clockevents
● Time synchronization
● Heartbeat
● Paired: kernel driver + userspace daemon
● hv_kvp – key/value pair exchange (network settings)
● hv_vss – freeze/thaw file systems for backup
● hv_fcopy – copy an arbitrary file from the host to the
guest
13 Linux on Hyper-V
Memory ballooning and hotplug
● Post memory pressure reports to the host every
second.
● “balloon up” request from the host:
● Allocate pages and send their PFNs to the host so
actual pages behind these frames can be reused.
● “balloon down” request from the host:
● Get PFNs from the host, de-allocate pages.
● Memory hotplug:
● Initiated by the host, 2M granularity (128M in Linux)
● Possible with 'Dynamic memory' disabled in WS2016
14 Linux on Hyper-V
Timekeeping
● TSC exists but not very reliable
● hv_clocksource:
● MSR-based
● Stable but slow
● TSC PAGE clocksource
● Reading from a shared memory page
● Fast as there is no exit to the hypervisor
15 Linux on Hyper-V
Hyper-V drivers in development
● Hvsock
● Userspace-to-userspace communications through
VMBUS
● Similar to VSOCK
● PCI passthrough
● RDMA
● Open-source but not upstream yet
16 Linux on Hyper-V
Linux on Hyper-V internals
● Why do we need Hyper-V-specific drivers?
● Emulating real hardware is SLOW, other hypervisors
have their drivers in kernel too:
● KVM: virtio
● Xen: blkfront, netfront, balloon, …
● Vmware: pvscsi, vmxnet3, ..
● Some devices don't have hardware counterparts:
● Utility drivers
● Memory ballooning
17 Linux on Hyper-V
“Enlightened drivers”
● The core is VMBUS
● Protocol for guest ↔ host communication
● Based on a concept of “channels”
● Primary/secondary channels for devices
● Each channel is bound to a VCPU
● Channels don't block each other
● Guest → Host signalling by hypercalls
● Host → Guest signalling by interrupts for “events” or
“messages”
● Ring buffers for data exchange
18 Linux on Hyper-V
Hypercalls
● The mechanism to signal something to the host
● A single 4k page per guest
● Setup:
● virtual mapping within the guest
● Physical address → HV_X64_MSR_HYPERCALL
● Usage:
● Do function-like call to the page (call id, input addr,
output addr)
19 Linux on Hyper-V
Host→Guest signalling: “Messages”
● A magical page per-VCPU
● … which contains actual data
● One message at a time
● Message's payload is <= 30 QWORDS
● Used mainly for setup/teardown pathes (channels
offers, open/close, unload,…)
● Clockevents also use messages.
20 Linux on Hyper-V
Host→Guest signalling: “Events”
● A (different) magic page per-VCPU
● … with an indication that there's pending data on a
particular channel.
● Each channel has its own bit so all channels assigned
to the same vCPU which need processing are
signalled with a single interrupt.
● An event means “go check the ring buffer” and that's
where the actual data is.
21 Linux on Hyper-V
Ring buffers
● Data transfer mechanism based on shared memory
for performance-critical devices
22 Linux on Hyper-V
Ring buffers for channels
● Two separate rings for each channel for guest → host
and host → guest communication.
● Different ring sizes for different drivers:
● Netvsc – 128 pages
● Storvsc – 256 pages
● ...
● Need for signalling both ways.
23 Linux on Hyper-V
Receive ring signalling
● We receive an interrupt indicating there are events
pending.
● We scan the event page to see which channels have
new data.
● For a particular channel with a pending event we read
and process all the data on the ring buffer.
● We advance read pointer freeing space on the buffer.
● If the host was blocked by the absence of space on the
ring we signal it when we're done reading.
24 Linux on Hyper-V
Transmit ring signalling
● Host guarantees to drain the buffer on each read
operation.
● Host sets interrupt mask to signal an ongoing read.
● We signal the host when the ring transfers from empty
to non-empty state and the host is not currently
reading.
● … but we can also delay signalling if more data is on
the way.
Thank you!
Questions?
Vitaly Kuznetsov
vkuznets@redhat.com

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Linux Virtualization
Linux VirtualizationLinux Virtualization
Linux Virtualization
 
Managing ceph through_oVirt_using_Cinder
Managing ceph through_oVirt_using_CinderManaging ceph through_oVirt_using_Cinder
Managing ceph through_oVirt_using_Cinder
 
Benefits of Multi-rail Cluster Architectures for GPU-based Nodes
Benefits of Multi-rail Cluster Architectures for GPU-based NodesBenefits of Multi-rail Cluster Architectures for GPU-based Nodes
Benefits of Multi-rail Cluster Architectures for GPU-based Nodes
 
BKK16-315 Graphics Stack Update
BKK16-315 Graphics Stack UpdateBKK16-315 Graphics Stack Update
BKK16-315 Graphics Stack Update
 
Kubernetes from scratch at veepee sysadmins days 2019
Kubernetes from scratch at veepee   sysadmins days 2019Kubernetes from scratch at veepee   sysadmins days 2019
Kubernetes from scratch at veepee sysadmins days 2019
 
OVN DBs HA with scale test
OVN DBs HA with scale testOVN DBs HA with scale test
OVN DBs HA with scale test
 
Deploying and managing gluster using ovirt - fudcon2015
Deploying and managing gluster using ovirt - fudcon2015Deploying and managing gluster using ovirt - fudcon2015
Deploying and managing gluster using ovirt - fudcon2015
 
RouterOS v6
RouterOS v6RouterOS v6
RouterOS v6
 
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
 
pkgsrc 2013 - the record of the past year
pkgsrc 2013 - the record of the past yearpkgsrc 2013 - the record of the past year
pkgsrc 2013 - the record of the past year
 
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containers
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containersKuryr & Fuxi: OpenStack networking and storage for Docker Swarm containers
Kuryr & Fuxi: OpenStack networking and storage for Docker Swarm containers
 
Step by Step - Reusing old features to build new ones
Step by Step - Reusing old features to build new onesStep by Step - Reusing old features to build new ones
Step by Step - Reusing old features to build new ones
 
Practical CNI
Practical CNIPractical CNI
Practical CNI
 
Linux based Stubdomains
Linux based StubdomainsLinux based Stubdomains
Linux based Stubdomains
 
VM - Talk
VM - TalkVM - Talk
VM - Talk
 
OVN - Basics and deep dive
OVN - Basics and deep diveOVN - Basics and deep dive
OVN - Basics and deep dive
 
Large scale overlay networks with ovn: problems and solutions
Large scale overlay networks with ovn: problems and solutionsLarge scale overlay networks with ovn: problems and solutions
Large scale overlay networks with ovn: problems and solutions
 
Open vSwitch Implementation Options
Open vSwitch Implementation Options Open vSwitch Implementation Options
Open vSwitch Implementation Options
 
The kvm virtualization way
The kvm virtualization wayThe kvm virtualization way
The kvm virtualization way
 
Bsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessionsBsdtw17: lightning talks/wip sessions
Bsdtw17: lightning talks/wip sessions
 

Ähnlich wie Devconf.cz 2016 Linux as a guest on Hyper-V

Ähnlich wie Devconf.cz 2016 Linux as a guest on Hyper-V (20)

OpenVZ Linux Containers
OpenVZ Linux ContainersOpenVZ Linux Containers
OpenVZ Linux Containers
 
Implementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migrationImplementing SR-IOv failover for Windows guests during live migration
Implementing SR-IOv failover for Windows guests during live migration
 
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and WindowsOpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
OpenStack in action 4! Alessandro Pilotti - OpenStack, Hyper-V and Windows
 
Proxmox Talk - Linux Fest Northwest 2018
Proxmox Talk - Linux Fest Northwest 2018Proxmox Talk - Linux Fest Northwest 2018
Proxmox Talk - Linux Fest Northwest 2018
 
WUG #009 - OpenVNet 0.7 presentation
WUG #009 - OpenVNet 0.7 presentationWUG #009 - OpenVNet 0.7 presentation
WUG #009 - OpenVNet 0.7 presentation
 
KVM Enhancements for OPNFV
KVM Enhancements for OPNFVKVM Enhancements for OPNFV
KVM Enhancements for OPNFV
 
Openstack Networking Internals - first part
Openstack Networking Internals - first partOpenstack Networking Internals - first part
Openstack Networking Internals - first part
 
Libvirt/KVM Driver Update (Kilo)
Libvirt/KVM Driver Update (Kilo)Libvirt/KVM Driver Update (Kilo)
Libvirt/KVM Driver Update (Kilo)
 
Ovirt and gluster_hyperconvergence_devconf-2016
Ovirt and gluster_hyperconvergence_devconf-2016Ovirt and gluster_hyperconvergence_devconf-2016
Ovirt and gluster_hyperconvergence_devconf-2016
 
Windows server 8 and hyper v
Windows server 8 and hyper vWindows server 8 and hyper v
Windows server 8 and hyper v
 
Breaking Down the Barriers through Virtualization - Frank Feldman, Red Hat
Breaking Down the Barriers through Virtualization - Frank Feldman, Red HatBreaking Down the Barriers through Virtualization - Frank Feldman, Red Hat
Breaking Down the Barriers through Virtualization - Frank Feldman, Red Hat
 
DPDK Summit - 08 Sept 2014 - Futurewei - Jun Xu - Revisit the IP Stack in Lin...
DPDK Summit - 08 Sept 2014 - Futurewei - Jun Xu - Revisit the IP Stack in Lin...DPDK Summit - 08 Sept 2014 - Futurewei - Jun Xu - Revisit the IP Stack in Lin...
DPDK Summit - 08 Sept 2014 - Futurewei - Jun Xu - Revisit the IP Stack in Lin...
 
OpenVZ Linux containers
OpenVZ Linux containersOpenVZ Linux containers
OpenVZ Linux containers
 
Devconf2017 - Can VMs networking benefit from DPDK
Devconf2017 - Can VMs networking benefit from DPDKDevconf2017 - Can VMs networking benefit from DPDK
Devconf2017 - Can VMs networking benefit from DPDK
 
OpenStack Networking
OpenStack NetworkingOpenStack Networking
OpenStack Networking
 
20150531 virtualizatino station 2.0 partner's day
20150531 virtualizatino station 2.0 partner's day20150531 virtualizatino station 2.0 partner's day
20150531 virtualizatino station 2.0 partner's day
 
OpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdfOpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdf
 
Achieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVMAchieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVM
 
Network and Service Virtualization tutorial at ONUG Spring 2015
Network and Service Virtualization tutorial at ONUG Spring 2015Network and Service Virtualization tutorial at ONUG Spring 2015
Network and Service Virtualization tutorial at ONUG Spring 2015
 
Achieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVMAchieving the Ultimate Performance with KVM
Achieving the Ultimate Performance with KVM
 

Kürzlich hochgeladen

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 

Devconf.cz 2016 Linux as a guest on Hyper-V

  • 1. Linux as a guest on Hyper-V Vitaly Kuznetsov Red Hat DevConf 2016
  • 2. 2 Linux on Hyper-V Virtualization at Red Hat ● OS-level virtualization at Red Hat: ● Xen-based solutions in the past ● KVM-based solutions now: ● RHEV, OpenStack ● RHEL-as-a-guest efforts: ● On KVM: RHEV and OpenStack, standalone ● On Xen: Amazon Web Services ● On VMware: standalone ● On Hyper-V: Azure and standalone
  • 3. 3 Linux on Hyper-V Microsoft Hyper-V ● Present since Windows Server 2008 ● The core of Microsoft Azure cloud ● Hyper-V is a Type 1 hypervisor for the x86 architecture ● Requires hardware support (Intel VT-x, AMD-V) ● Emulates standard x86 platforms: ● Generation 1 VM: “legacy” BIOS platform with emulated devices ● Generation 2 VM: UEFI platform without emulated devices
  • 4. 4 Linux on Hyper-V Hyper-V architecture ● Full virtualization with selective enlightments: ● Enlightened I/O paths ● Optional for Generation 1 ● Mandatory for Generation 2 ● Heartbeat ● Utility drivers ● Time keeping and synchronization ● Crash reporting ● ...
  • 5. 5 Linux on Hyper-V Hyper-V and Linux ● Kernel drivers: ● Added to staging in 2009 ● Out of staging in 2011 ● Included in all major Linux distributions: RHEL, Fedora, OpenSUSE/SLES, Debian, Ubuntu,... ● Actively used on Azure: 25% of all VMs are Linux! (Microsoft)
  • 6. 6 Linux on Hyper-V Hyper-V drivers development ● Commits since 2011 (leaving staging): 2011 2012 2013 2014 2015 0 50 100 150 200 250 300 Commits from @microsoft.com Commits from @redhat.com Commits from other community members
  • 7. 7 Linux on Hyper-V Hyper-V drivers in Linux kernel ● Currently present drivers: ● hv_storvsc (IDE/SCSI/FC storages) ● hv_netvsc (network adapter) ● hyperv_fb (framebuffer device) ● hyperv-keyboard (keyboard) ● hid-hyperv (mouse) ● hv_balloon (memory ballooning and hotplug) ● hv_util (utility drivers)
  • 8. 8 Linux on Hyper-V Hyper-V storvsc driver ● High performace storage driver ● Devices support: ● SCSI ● IDE (Gen1 VMs) ● Fibre Channel ● Partial SPC-3 compliance since Win8/WS2012 ● Full SPC-3 compliance Win10/WS2016 ● Multiqueue support
  • 9. 9 Linux on Hyper-V Hyper-V netvsc driver ● High performace network driver ● Multiqueue ● Supports scaling for RX with vRSS ● Dynamic and Static VMQ for TX ● Supports batching for TX ● Decorates each outgoing packet with RNDIS header ● No NAPI support (yet)
  • 10. 10 Linux on Hyper-V Hyper-V netvsc performance (Microsoft data) 1 8 64 256 1024 6000 0.0 5.0 10.0 15.0 20.0 25.0 30.0 35.0 4.1 25.0 28.3 26.9 23.4 15.5 5.6 20.7 30.6 31.3 25.2 10.0 On Local HyperV WS2012R2 Linux Number Of Connections Throughput(Gbps) Note: Server VM CPU: 8 vCPUs of E5-2690 @2.90GHz, on one NUMA node
  • 11. 11 Linux on Hyper-V Hyper-V netvsc performance (Microsoft data) 1 8 64 256 1024 6000 0.0 5.0 10.0 15.0 20.0 25.0 30.0 2.3 20.6 24.2 23.3 15.8 9.9 4.1 15.3 21.3 17.1 14.0 12.7 On Azure G5 WS2012R2 Linux Number Of Connections Throughput(Gbps) Note: VM CPU: 32 vCPUs of E5-2698B v3 @ 2.00GHz, on two NUMA nodes
  • 12. 12 Linux on Hyper-V Hyper-V utility drivers and daemons ● 'Internal' drivers ● Clocksources, clockevents ● Time synchronization ● Heartbeat ● Paired: kernel driver + userspace daemon ● hv_kvp – key/value pair exchange (network settings) ● hv_vss – freeze/thaw file systems for backup ● hv_fcopy – copy an arbitrary file from the host to the guest
  • 13. 13 Linux on Hyper-V Memory ballooning and hotplug ● Post memory pressure reports to the host every second. ● “balloon up” request from the host: ● Allocate pages and send their PFNs to the host so actual pages behind these frames can be reused. ● “balloon down” request from the host: ● Get PFNs from the host, de-allocate pages. ● Memory hotplug: ● Initiated by the host, 2M granularity (128M in Linux) ● Possible with 'Dynamic memory' disabled in WS2016
  • 14. 14 Linux on Hyper-V Timekeeping ● TSC exists but not very reliable ● hv_clocksource: ● MSR-based ● Stable but slow ● TSC PAGE clocksource ● Reading from a shared memory page ● Fast as there is no exit to the hypervisor
  • 15. 15 Linux on Hyper-V Hyper-V drivers in development ● Hvsock ● Userspace-to-userspace communications through VMBUS ● Similar to VSOCK ● PCI passthrough ● RDMA ● Open-source but not upstream yet
  • 16. 16 Linux on Hyper-V Linux on Hyper-V internals ● Why do we need Hyper-V-specific drivers? ● Emulating real hardware is SLOW, other hypervisors have their drivers in kernel too: ● KVM: virtio ● Xen: blkfront, netfront, balloon, … ● Vmware: pvscsi, vmxnet3, .. ● Some devices don't have hardware counterparts: ● Utility drivers ● Memory ballooning
  • 17. 17 Linux on Hyper-V “Enlightened drivers” ● The core is VMBUS ● Protocol for guest ↔ host communication ● Based on a concept of “channels” ● Primary/secondary channels for devices ● Each channel is bound to a VCPU ● Channels don't block each other ● Guest → Host signalling by hypercalls ● Host → Guest signalling by interrupts for “events” or “messages” ● Ring buffers for data exchange
  • 18. 18 Linux on Hyper-V Hypercalls ● The mechanism to signal something to the host ● A single 4k page per guest ● Setup: ● virtual mapping within the guest ● Physical address → HV_X64_MSR_HYPERCALL ● Usage: ● Do function-like call to the page (call id, input addr, output addr)
  • 19. 19 Linux on Hyper-V Host→Guest signalling: “Messages” ● A magical page per-VCPU ● … which contains actual data ● One message at a time ● Message's payload is <= 30 QWORDS ● Used mainly for setup/teardown pathes (channels offers, open/close, unload,…) ● Clockevents also use messages.
  • 20. 20 Linux on Hyper-V Host→Guest signalling: “Events” ● A (different) magic page per-VCPU ● … with an indication that there's pending data on a particular channel. ● Each channel has its own bit so all channels assigned to the same vCPU which need processing are signalled with a single interrupt. ● An event means “go check the ring buffer” and that's where the actual data is.
  • 21. 21 Linux on Hyper-V Ring buffers ● Data transfer mechanism based on shared memory for performance-critical devices
  • 22. 22 Linux on Hyper-V Ring buffers for channels ● Two separate rings for each channel for guest → host and host → guest communication. ● Different ring sizes for different drivers: ● Netvsc – 128 pages ● Storvsc – 256 pages ● ... ● Need for signalling both ways.
  • 23. 23 Linux on Hyper-V Receive ring signalling ● We receive an interrupt indicating there are events pending. ● We scan the event page to see which channels have new data. ● For a particular channel with a pending event we read and process all the data on the ring buffer. ● We advance read pointer freeing space on the buffer. ● If the host was blocked by the absence of space on the ring we signal it when we're done reading.
  • 24. 24 Linux on Hyper-V Transmit ring signalling ● Host guarantees to drain the buffer on each read operation. ● Host sets interrupt mask to signal an ongoing read. ● We signal the host when the ring transfers from empty to non-empty state and the host is not currently reading. ● … but we can also delay signalling if more data is on the way.