JustKernel

Ray Of Hope

virtualization

Broadwell + Xen + Classic guest kernel + WRITE_FAULT + SMAP Violation.

Recently faced an issue where classic guest kernel (2.6.*) were faulting on Broadwell hardware. From the day 1 doubt was on SMAP feature that is exclusive to Broadwell but had to prove it. Approach: Compiled the guest kernel with instrumentation but can’t use it as the guest on Broadwell hangs just during reboot. (I compiled […]

Tags: , ,

Posted in virtualization, Xen | No Comments »

QEMU Networking Vhost-user & Transport Infiniband – series 1, general architecture

Objective: Get the maximum performance for VM to VM communication using Infiniband backend utilizing RDMA. Design: server1 running VM1—>Usermode app running on server1—–RDMA TRANSPORT—->App2 running on server2—>vm2 running on server 2. brief description: vm1 is executed on server1 using emulated virtio-net(frontend) adapter and vhost-user backend. PACKETH runs on vm1 and generates the broadcast packet. App1 […]

Tags: , , , ,

Posted in qemu, vhost-user, virtio-net, virtualization | 2 Comments »

QEMU + Simple Network rate limiter from Linux Host side.

Simple Network rate limiter from Linux Host side : Controlling the flow using ring buffer. diff –git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 613f144..df620f7 100644 — a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -218,6 +218,7 @@ static void rxfilter_notify(NetClientState *nc) static char *mac_strdup_printf(const uint8_t *mac) { + printf(“Hello world \n”); return g_strdup_printf(“%.2x:%.2x:%.2x:%.2x:%.2x:%.2x”, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); } @@ -1050,13 […]

Tags:

Posted in qemu, virtualization | No Comments »

QEMU + crude and simple rate limiter

For Windows paravirtualized guest NDIS driver. Manage the flow in ring buffer. iff –git a/NetKVM/NDIS5/Common/ParaNdis-Common.c b/NetKVM/NDIS5/Common/ParaNdis-Common.c index fe84133..c2cbf00 100644 — a/NetKVM/NDIS5/Common/ParaNdis-Common.c +++ b/NetKVM/NDIS5/Common/ParaNdis-Common.c @@ -805,7 +805,7 @@ NDIS_STATUS ParaNdis_InitializeContext( pContext->ReuseBufferProc = ReuseReceiveBufferRegular; – + NdisInitializeEvent(&pContext->ResetEvent); DEBUG_EXIT_STATUS(0, status); return status; @@ -1433,7 +1433,7 @@ void ReuseReceiveBufferRegular(PARANDIS_ADAPTER *pContext, pIONetDescriptor pBuf /********************************************************** It is called from Rx processing […]

Tags:

Posted in qemu, virtualization | No Comments »

QEMU + CPU Hotunplug design

The basic design decision that we have taken while designing cpu hotunplug functionality for qemu is that the kernel mode fd (in KVM) associated with the usermode vcpu will not be deleted. It will remain there. Only the mmapped memory associated the usermode thread (vcpu) will be deleted from the kernel. If we get a […]

Tags: ,

Posted in qemu | No Comments »

QEMU + VCPU architecture.

Whenever a new CPU is added to the QEMU, call flow goes like this. Realize the x86 Device : target-i386/cpu.c:x86_cpu_realizefn -> cpus.c:qemu_init_vcpu() and target-i386/cpu.c:x86_cpu_realizefn -> xcc->parent_Realizefn(). qemu_init_vcpu checks if the kvm is enabled and it calls cpus.c: qemu_kvm_start_vcpu() . qemu_kvm_start_vcpu allocates the memory for the thread, specify its halting condition and calls qemu_thread_create with the […]

Tags: ,

Posted in qemu | No Comments »

Virtualbox- Audio Architecture 3

some code snippets to explain the audio implementation in Virtualbox and how the code changed from earlier QEMU based monolithic blob. Taking an example of AC97 Device: DevIchAc97.cpp PPDMGSTVOICEIN voice_pi[2]; // corresponds to 2 LUNS in audio in direction (recording) + /** PCM out */ + PPDMGSTVOICEOUT voice_po[2]; //corresponds to 2 LUNs in audio out […]

Tags:

Posted in Virtualbox, virtualization | No Comments »

Virtualbox – Audio architecture – 2

In addition the architectural changes discussed in the previous post, i also implemented multiple LUNs so that audio samples can be send to multiple audio backends simultaneously for eg. a guest VM is opened in the desktop, also through VRDP. So audio song being played on the guest should be audible on the host desktop […]

Tags:

Posted in Virtualbox, virtualization | No Comments »

Virtualbox – Audio architecture

Currently Virtualbox uses QEMU audio code. QEMU audio code is a big monolithic blog with single file auido.c implementing most of the audio functionality and 100s of preprocessor directives  (glue etc) in audio_template.h providing most of the helper functionalities for different platform. My task here was to modify the audio code to and implement it […]

Tags:

Posted in Virtualbox, virtualization | No Comments »

qemu-kvm and virtio

QEMU uses software virtualization approach and  emulates lot of host instructions . This approach has its negative impact on the speed . But now days latest processors provide hardware virtualization support and QEMU utilizes this hardware support by use of KVM modules. KVM is  a group of  kernel modules(kvm.ko, kvm_amd.ko/kvm_intel.ko) that allows guest code to […]

Tags:

Posted in virtualization | No Comments »