Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9874eb7

Browse files
committedNov 28, 2024··
chore(pci): add information about PCI PoC in README
Adding some information on how to run the PoC, known issues, etc. Signed-off-by: Riccardo Mancini <[email protected]>
1 parent c4e3a97 commit 9874eb7

File tree

1 file changed

+81
-8
lines changed

1 file changed

+81
-8
lines changed
 

‎README.md

+81-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,83 @@ container and function workloads.
99

1010
Read more about the Firecracker Charter [here](CHARTER.md).
1111

12+
## PCI Proof-of-Concept
13+
14+
### How to passthrough a PCI device
15+
16+
In order to be able to use the device, you first need to attach it to the vfio
17+
driver:
18+
19+
```
20+
# All commands below require root privileged
21+
# Load the vfio driver
22+
$ modprobe vfio-pci
23+
24+
# Find the device vendor and id
25+
$ lspci -n -s 0000:18:00.0
26+
18:00.0 0302: 10de:1eb8 (rev a1)
27+
28+
# Unbind from current driver (if no driver is attached, this will fail but it's ok)
29+
$ echo 0000:18:00.0 > /sys/bus/pci/devices/0000:18:00.0/driver/unbind
30+
31+
# Bind to vfio driver
32+
echo 10de 1eb8 > /sys/bus/pci/drivers/vfio-pci/new_id
33+
```
34+
35+
After that, you can start firecracker without jailer or seccomp using vmconfig
36+
json (no HTTP API is supported atm) as follows:
37+
38+
```json
39+
{
40+
"pci": {
41+
"enabled": true,
42+
"vfio_devices": [
43+
{ "path": "/sys/bus/pci/devices/0000:18:00.0/" }
44+
]
45+
},
46+
// [...]
47+
}
48+
```
49+
50+
### How to use a NVIDIA GPU inside the Guest
51+
52+
- build a kernel with loadable module support
53+
- copy kernel source and headers inside the rootfs
54+
- install nvidia dkms open source drivers inside the rootfs from
55+
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_network
56+
- run dkms pointing it to the kernel source code inside the rootfs
57+
- load the nvidia driver with modprobe
58+
- test it with cuda samples
59+
60+
### What works
61+
62+
- multiple vfio devices (PF) can be passed through (no P2P)
63+
- virtio-pci devices are supported (only block and net have been tested)
64+
65+
### Known issues
66+
67+
- BARs get relocated if the VM memory is less than 4GB due to a (unknown)
68+
conflict
69+
- no support for ARM. It should be pretty easy to add it with a new FDT entry.
70+
- no support for snapshot/resume (not even for virtio-pci devices).
71+
- no support for vhost-user-blk.
72+
- a legacy PCI bus is used instead of a PCIe root port. We should really go
73+
straight for a PCIe layout in the production implementation as it will
74+
simplify the passthrough of PCIe devices and device hotplugging.
75+
- the entire guest physical memory is pre-allocated on boot if a vfio device is
76+
present (no plans to fix in PoC).
77+
- it's not possible to toggle PCI support through HTTP API (only vmconfig json
78+
is supported at the moment).
79+
- unit tests are not working.
80+
- integration tests are not working, except
81+
`performance/test_{block,network}_ab.py`.
82+
83+
### Out of scope
84+
85+
- virtual iommu to avoid allocating the entire guest physical memory on boot
86+
- PCI P2P between vfio devices
87+
- passthrough of virtual functions
88+
1289
## What is Firecracker?
1390

1491
Firecracker is an open source virtualization technology that is purpose-built
@@ -130,14 +207,10 @@ The **API endpoint** can be used to:
130207

131208
We test all combinations of:
132209

133-
| Instance | Host OS & Kernel | Guest Rootfs | Guest Kernel |
134-
| :-------- | :---------------- | :----------- | :----------- |
135-
| c5n.metal | al2 linux_5.10 | ubuntu 24.04 | linux_5.10 |
136-
| m5n.metal | al2023 linux_6.1 | | linux_6.1 |
137-
| m6i.metal | | | |
138-
| m6a.metal | | | |
139-
| m6g.metal | | | |
140-
| m7g.metal | | | |
210+
| Instance | Host OS & Kernel | Guest Rootfs | Guest Kernel | | :-------- |
211+
:---------------- | :----------- | :----------- | | c5n.metal | al2 linux_5.10 |
212+
ubuntu 24.04 | linux_5.10 | | m5n.metal | al2023 linux_6.1 | | linux_6.1 | |
213+
m6i.metal | | | | | m6a.metal | | | | | m6g.metal | | | | | m7g.metal | | | |
141214

142215
## Known issues and Limitations
143216

0 commit comments

Comments
 (0)
Please sign in to comment.