Skip to content

Commit 11e781a

Browse files
committed
2 parents 5adeada + eaa4b10 commit 11e781a

File tree

2 files changed

+79
-1
lines changed

2 files changed

+79
-1
lines changed

.vscode/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,25 @@
2828
"HKEY",
2929
"HKLM",
3030
"Höglinger",
31+
"hugepages",
32+
"Hugepagesize",
33+
"hugetlb",
3134
"Identinator",
3235
"igfilter",
3336
"inival",
3437
"inja",
3538
"Inno",
3639
"IOMMU",
3740
"javascripts",
41+
"kbytes",
3842
"Legacinator",
3943
"LOCALAPPDATA",
4044
"magiclink",
4145
"Mainboard",
4246
"materialx",
4347
"mkdocs",
4448
"msrs",
49+
"Nefarius",
4550
"nmake",
4651
"noopener",
4752
"nŏvīcĭus",
@@ -58,6 +63,7 @@
5863
"Ryochan",
5964
"Ryzen",
6065
"Shibari",
66+
"shmmax",
6167
"simplewall",
6268
"SIXAXIS",
6369
"Stelzer",
@@ -75,6 +81,7 @@
7581
"vfio",
7682
"Vīcĭus",
7783
"vigem",
84+
"Virtiofs",
7885
"Virtua",
7986
"vmci",
8087
"vmusb",

docs/research/VFIO/Windows-11-Gaming-VM.md

+72-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
205205
Set fixed amount of cores, topology and pin cores to best die layout; for `AMD Ryzen 7 3700X 8-Core Processor` it is
206206

207207
```xml
208-
<vcpu placement="static">8</vcpu>
208+
<vcpu placement="static" cpuset="8-15">8</vcpu>
209209
<iothreads>2</iothreads>
210210
<cputune>
211211
<vcpupin vcpu="0" cpuset="8"/>
@@ -234,10 +234,81 @@ and
234234

235235
This config maps the last 8 cores to the Windows guest.
236236

237+
For hugepages support add or adjust:
238+
239+
```xml
240+
<memoryBacking>
241+
<hugepages>
242+
<page size="2048" unit="KiB"/>
243+
</hugepages>
244+
<access mode="shared"/>
245+
</memoryBacking>
246+
```
247+
237248
### Host configuration
238249

250+
#### Hugepages
251+
252+
```bash
253+
grep Hugepagesize /proc/meminfo
254+
Hugepagesize: 2048 kB
255+
```
256+
257+
So a value of `8192` pages at a page size of 2MB equals **16GB of RAM reserved** for hugepages.
258+
259+
```ini
260+
GRUB_CMDLINE_LINUX_DEFAULT="... hugepages=8192"
261+
```
262+
263+
`/etc/sysctl.conf`
264+
265+
```ini
266+
kernel.shmmax = 17179869184
267+
vm.nr_hugepages = 8192
268+
vm.min_free_kbytes = 112640
269+
vm.hugetlb_shm_group = 1000
270+
```
271+
272+
#### CPU Governor on performance mode
273+
239274
```bash
240275
echo 'KERNEL=="cpu8|cpu9|cpu10|cpu11|cpu12|cpu13|cpu14|cpu15", SUBSYSTEM=="cpu", ACTION=="add", ATTR{cpufreq/scaling_governor}="performance"' | sudo tee /etc/udev/rules.d/90-scaling-governor-performance.rules
241276
# reboot, then confirm changes with
242277
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
243278
```
279+
280+
#### Isolate CPU cores from scheduler
281+
282+
> Do more testing if this is beneficial or worse for both host and VM performance
283+
284+
```bash
285+
sudo vim /etc/default/grub
286+
```
287+
288+
```bash
289+
GRUB_CMDLINE_LINUX_DEFAULT="... isolcpus=8-15"
290+
```
291+
292+
```bash
293+
sudo update-grub
294+
```
295+
296+
Reboot to activate.
297+
298+
#### IRQL re-balance
299+
300+
`/etc/default/irqbalance`
301+
302+
```ini
303+
IRQBALANCE_BANNED_CPULIST=8-15
304+
```
305+
306+
```bash
307+
sudo systemctl restart irqbalance
308+
```
309+
310+
## Resources
311+
312+
- [Sharing files with Virtiofs](https://libvirt.org/kbase/virtiofs.html)
313+
- [How to install virtiofs drivers on Windows](https://virtio-fs.gitlab.io/howto-windows.html)
314+
- [WinFsp](https://winfsp.dev/rel/)

0 commit comments

Comments
 (0)