KVM irqfd and ioeventfd
In previous article vhost architecture we mentioned that vhost and the guest signal each other by irqfd and ioeventfd mechanism.
So let us see how irqfd and ioeventfd mechanism can take this role. We can find the patches in linus tree which implement them:
KVM irqfd support patch: http://git.kernel.org/linus/721eecbf4fe995ca94a9edec0c9843b1cc0eaaf3
KVM ioeventfd support patch: http://git.kernel.org/linus/d34e6b175e61821026893ec5298cc8e7558df43a
irqfd
irqfd is a mechanism to inject a specific interrupt to a guest using a decoupled eventfd mechanism: Any legal signal on the irqfd (using eventfd semantics from either userspace or kernel) will translate into an injected interrupt in the guest at the next interrupt window.
One line description is:
irqfd: Allows an fd to be used to inject an interrupt to the guest
Go into the patch, we can see details:
Hook the irq inject wakeup function to a wait queue, and the wait queue will be added by the eventfd polling callback.
ioeventfd
While ioeventfd is a mechanism to register PIO/MMIO regions to trigger an eventfd signal when written to by a guest. The purpose of this mechanism is to make guest notify host in a lightweight way. This is lightweight because it will not cause a VMX/SVM exit back to userspace, serviced by qemu then returning control back to the vcpu. Why we need this mechanism because this kind of heavy-weight IO sync mechanism is not necessary for the triggers, these triggers only want to transmit a notify asynchronously and return as quickly as possible. It is expansive for them to use the normal IO.
Look into the implementation, it accepts the eventfd and io address from args, then register a kvm_io_device with them. And the write operation of the registered kvm_io_device is sending an eventfd signal. The signal function is eventfd_siganl().
So, this mechanism is:
ioeventfd: Allow an fd to be used to receive a signal from the guest
conclusion
A very simple conclusion of these two mechanism can be the following picture:
+-----------------------------------------+
| Host |
| +--------------------------+ |
| | QEMU | |
| | | |
| | +---------------+ | |
| | | Guest | | |
| | | | | |
| | | +-------- ioeventfd------> |
| | | | | |
| | | | | |
| | | | | |
| | | <-----------irqfd--------+ |
| | | | | |
| | +---------------+ | |
| | | |
| | | |
| +--------------------------+ |
| |
+-----------------------------------------+
KVM irqfd and ioeventfd的更多相关文章
- KVM VHOST中irqfd的使用
2018-01-18 其实在之前的文章中已经简要介绍了VHOST中通过irqfd通知guest,但是并没有对irqfd的具体工作机制做深入分析,本节简要对irqfd的工作机制分析下.这里暂且不讨论具体 ...
- [转] KVM Internals, code and more
KVM Kernel-based Virtual Machine Internals, code and more http://slides.com/braoru/kvm#/ What behind ...
- kvm qemu内幕介绍
转自:http://blog.csdn.net/wj_j2ee/article/details/7978259目录 1 硬件虚拟化技术背景 2 KVM的内部实现概述 2.1 KVM的抽象对象 2.2 ...
- DPDK support for vhost-user
转载:http://blog.csdn.net/quqi99/article/details/47321023 X86体系早期没有在硬件设计上对虚拟化提供支持,因此虚拟化完全通过软件实现.一个典型的做 ...
- Linux Kernel Vhost 架构
Vhost 回顾 Linux中的vhost驱动程序提供了内核virtio设备仿真. 通常,QEMU用户空间进程模拟guest的I / O访问. Vhost将virtio仿真代码放到内核中,使QEMU用 ...
- vhost:一种 virtio 高性能的后端驱动实现
什么是 vhost vhost 是 virtio 的一种后端实现方案,在 virtio 简介中,我们已经提到 virtio 是一种半虚拟化的实现方案,需要虚拟机端和主机端都提供驱动才能完成通信,通常, ...
- virtIO之VHOST工作原理简析
2017-07-19 一.前言 之前有分析过虚拟化环境下virtIO的实现,virtIO相关于传统的虚拟IO在性能方面的确提高了不少,但是按照virtIO虚拟网卡为例,每次虚拟机接收数据包的时候,数据 ...
- QEMU KVM Libvirt手册(7): 硬件虚拟化
在openstack中,如果我们启动一个虚拟机,我们会看到非常复杂的参数 qemu-system-x86_64 -enable-kvm -name instance-00000024 -S -mach ...
- KVM源代码解读:linux-3.17.4\include\uapi\linux\kvm.h
#ifndef __LINUX_KVM_H #define __LINUX_KVM_H /* * Userspace interface for /dev/kvm - kernel based vir ...
随机推荐
- Linux ls命令
ls:即列表List的意思,用来列出目录下的文件用来列出给定目录下的文件,参数为空默认列出当前目录下的文件. 用法是:ls [选项] [目录] 常用的选项有 -a, –all 列出目录下的所有文件,包 ...
- 移动端打印输出内容以及网络请求-vconsole.js
今天,无意间从别人那里得知一个很好的js插件--vconsole.min.js,可以实现在移动端打印输出内容以及查看网络请求.下面记录使用方式. 1.下载vconsole.min.js插件 以下复制了 ...
- SVN无法Cleanup
错误如下: 原因:svn提交遇到恶心的问题,可能是因为上次cleanup中断后,进入死循环了 解决方法:清空svn的队列 1.下载Sqlite3.exe 2.找到你项目的.svn文件,查看是否存在wc ...
- smart基础原理
1html模板页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w ...
- 利用maven-dependency-plugin插件使用及场景
背景: 1.需要某个特殊的 jar包,但是有不能直接通过maven依赖获取,或者说在其他环境的maven仓库内不存在,那么如何将我们所需要的jar包打入我们的生产jar包中. 2.某个jar包内部包含 ...
- Java设计模式—单例模式
Singleton是一种创建型模式,指某个类采用Singleton模式,则在这个类被创建后,只可能产生一个实例供外部访问,并且提供一个全局的访问点. 核心知识点如下: (1) 将采用单例设计模式的类的 ...
- [转]Earth Mover's Distance (EMD)
转自:http://www.sigvc.org/bbs/forum.php?mod=viewthread&tid=981 Earth Mover's Distance (EMD)原文: htt ...
- Java线程常用方法汇总
1.sleep() 使当前线程(即调用该方法的线程)暂停执行一段时间,让其他线程有机会继续执行,但它并不释放对象锁.也就是说如果有synchronized同步快,其他线程仍然不能访问共享数据.注意该方 ...
- 在vue项目中使用codemirror插件实现代码编辑器功能(代码高亮显示及自动提示
在vue项目中使用codemirror插件实现代码编辑器功能(代码高亮显示及自动提示) 1.使用npm安装依赖 npm install --save codemirror; 2.在页面中放入如下代码 ...
- Django学习笔记之Django Form表单详解
知识预览 构建一个表单 在Django 中构建一个表单 Django Form 类详解 使用表单模板 回到顶部 构建一个表单 假设你想在你的网站上创建一个简单的表单,以获得用户的名字.你需要类似这样的 ...