Skip to main content

The KVM Hypervisor

Introduction

This guide explains how to use the KVM hypervisor through its API directly without using any third party library or software such as libvirt, qemu etc.

A brief explanation of how the KVM system exposes itself is presented below. KVM hypervisor provides 4 types of ioctl or input/output controls. They are a logical hierarchy of what you would expect a hypervisor system to do. First you have system calls, which you can use to create a virtual machine. Once created you will receive a path or file descriptor to that VM which can be used to issue Virtual Machine Calls. After the VM is created, you will similarly receive a file descriptor. You can use this file descriptor as an address to issue both Virtual CPU calls and device calls.

System Calls

These query and set global attributes which affect the whole kvm subsystem. In addition a system ioctl is used to create virtual machines.

Virtual Machine Calls

These query and set attributes that affect an entire virtual machine, for example memory layout. In addition a VM ioctl is used to create virtual cpus (vcpus) and devices.

Virtual CPU Calls

These query and set attributes that control the operation of a single virtual cpu.

Device Calls

These query and set attributes that control the operation of a single device.

 

Comments

Popular posts from this blog

Beware: Those who use chatGPT for their exams or work!

ChatGPT struggles with prime numbers! While trying to understand how the public private key cryptographic architecture works using chatGPT, I asked what is a coprime number after chatgpt explained its use in the said architecture. Here is the response in all its glory: Two numbers are said to be coprime (or relatively prime) if they have no common prime factors other than 1. In other words, their greatest common divisor (GCD) is 1. For example: 8 and 15 are coprime because their only common factor is 1. 14 and 15 are coprime because they share no common factors other than 1. 10 and 21 are not coprime because they both have 1 as a common factor. Looking at the first and then the last example which is supposed to be a counter-example as to what is not a coprime number, we can clearly see that chatgpt gives the same reason for each case i.e they only have 1 as a common factor. After further investigation, chatgpt replies: Apologies for the confusion. You're correct. 10 and 21 do not h...

Good Game: Dice City

Another GTA Clone Back in early 2004, when the internet was new and download speeds were hitting 30 KB/s there was the thriving of world of flash games and a little programming language some of you might have known as ActionScript. Among the many games was a title called Ray part 2.  I was pretty young at the time and I had a computer with very weak specs, a Celeron processor. I could not play many of the AAA games. I would download their demos and wait at least a day for the download to finish, make sure the computer was switched on, sometimes the downloaded file would be corrupt so had to restart until download managers came around and saved me quite a few times. Ray part 2 for me was no different than actually playing GTA vice city but I could at least play it. The good thing about it were the different choices available in the game. Along the years, I would check from time to time if Ray Part 3 was released and eventually I found out that the original author had abandoned the g...

Quantum computers are stupid!

Can you add two numbers with a quantum computer? In the scientific method, your observation/measurement technique should not affect the outcome. If your hypothesis deals with effect of light on bugs and every time you check on the bugs with a torch, are you not causing the experimental result you will soon observe? In other words, if you did not check with a torch, would the outcome be the same? This whole idea that a qubit could be 50% 0 or 50% 1 upon measuring and usually conveniently represented as an arrow in a sphere with the two hemispheres representing 0 and 1, what is the benefit? what is the point? Imagine this scenario: I want to add two numbers made of 2 qubits and get the result in a third qubit. Number 1 is 49% 0 and  51% 1. Number 2 is 51% 0 and 49% 1. What is the value of the third qubit? is it 50% 0 and 50% 1? is it 100% 0? is it 100% 1?  If the answer is the first case, what does it mean anyway? is the output of the two numbers I added 0 or 1? is it neither or...