wiki/virt/host/modules.md

136 lines
3.3 KiB
Markdown
Raw Normal View History

2021-11-13 11:58:05 +00:00
---
title: Kernel modules
description:
published: true
2023-02-08 18:42:58 +00:00
date: 2023-02-08T18:42:56.268Z
2021-11-13 11:58:05 +00:00
tags:
editor: markdown
dateCreated: 2021-11-13T11:58:03.276Z
---
2023-02-05 17:31:30 +00:00
# Host configuration and information
2023-02-05 10:36:26 +00:00
> Section under construction
{.is-warning}
2023-02-05 17:42:57 +00:00
## IOMMU-enablement
2023-02-05 17:31:30 +00:00
2023-02-05 17:42:43 +00:00
By default, Linux distributions do not generally enable IOMMU groups, a prerequisite to share real hardware to virtual machines using modern virtualization techniques.
2023-02-05 17:31:30 +00:00
### With GRUB as a bootloader
* For Intel CPUs, the following command adds the necessary bits:
```
# sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci/i' /etc/default/grub # Load kernel modules in GRUB.
```
> `iommu=pt` makes sure that only devices that can be pass to a virtual machine will be flagged as such. `rd.driver.pre=vfio-pci` makes sure that the `vfio-pci` driver is loaded early in the boot process.
{.is-info}
* For AMD CPUs, IOMMU groups are created by default, so the command is a bit different:
```
# sed -i 's/\(quiet\)/\1 iommu=pt rd.driver.pre=vfio-pci/i' /etc/default/grub # Load kernel modules in GRUB.
```
* It should then look like this:
```
2023-02-08 18:42:58 +00:00
$ cat /etc/default/grub
2023-02-05 17:31:30 +00:00
```
2023-02-05 17:42:43 +00:00
2023-02-05 17:31:30 +00:00
Then, one needs to regenerate GRUB.
* On Debian-based distributions:
```
# update-grub
```
### With systemd-boot as a bootloader
2023-02-05 10:36:26 +00:00
> Section under construction
{.is-warning}
## Nested virtualization
2023-02-05 17:33:08 +00:00
Nested virtualization is rarely enabled on Linux distributions.
2023-02-05 17:31:30 +00:00
* For Intel-based CPUs:
```
2023-02-05 17:33:08 +00:00
echo "options kvm_intel nested=1" >> /etc/modprobe.d/kvm.conf
2023-02-05 17:31:30 +00:00
```
* For AMD-based CPUs:
2023-02-05 17:31:30 +00:00
```
2023-02-05 17:33:08 +00:00
echo "options kvm_amd nested=1" >> /etc/modprobe.d/kvm.conf
2023-02-05 17:31:30 +00:00
```
2023-02-05 11:36:51 +00:00
2023-02-08 18:42:58 +00:00
### VMCS Shadowing (Intel-only)
* Enabling VMCS shadowing may give [a performance boost](https://storpool.com/blog/nested-virtualization-with-kvm-and-opennebula) on Haswell CPUs and later. Append that `enable_shadow_vmcs=1` to *kvm.conf*. It should look like that:
2023-02-05 17:42:43 +00:00
```
cat /etc/modprobe.d/kvm.conf
options kvm_intel nested=1 enable_shadow_vmcs=1
```
2023-02-05 17:31:30 +00:00
## Virtualization-related kernel modules
2021-11-13 18:47:58 +00:00
2023-02-05 10:36:26 +00:00
This list is only concerned about kernel modules that relates to virtualization. Their description can be found using the `modinfo` command.
2021-11-13 18:47:58 +00:00
```
kvm_intel # ""
kvm_amd # ""
kvm # Kernel virtual machine module for Linux
```
```
vfio_pci # "VFIO PCI - User Level meta-driver"
vfio_virqfd # "IRQFD support for VFIO bus drivers"
vfio_iommu_type1 # "Type1 IOMMU driver for VFIO"
vfio # "VFIO - User Level meta-driver"
vfio_mdev # "VFIO based driver for Mediated device"
```
```
mdev # "Mediated device Core Driver"
```
```
vhost_net # "Host kernel accelerator for virtio net"
vhost # "Host kernel accelerator for virtio"
vhost_iotlb # "VHOST IOTLB"
```
```
tap # ""
tun # "Universal TUN/TAP device driver"
```
```
virtio_net # "Virtio network driver"
virtio_balloon # "Virtio balloon driver"
virtio_blk # "Virtio block driver"
virtio_console # "Virtio console driver"
virtio_scsi # "Virtio SCSI HBA driver"
virtio_gpu # "Virtio GPU driver"
virtio_dma_buf #
```
```
qemu_fw_cfg # "QEMU fw_cfg sysfs support"
irqbypass # "IRQ bypass manager utility module"
net_failover # "Failover driver for Paravirtual drivers"
failover # "Generic failover infrastructure/interface"
```
2023-02-05 17:42:43 +00:00
## Ressources
* https://storpool.com/blog/nested-virtualization-with-kvm-and-opennebula/
---
*[**Go to parent page**](https://wiki.phyllo.me/)*