Module Name: src Committed By: riastradh Date: Tue Sep 13 20:10:04 UTC 2022
Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_internal.h src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: nvmm(4): Add suspend/resume support. New MD nvmm_impl callbacks: - .suspend_interrupt forces all VMs on all physical CPUs to exit. - .vcpu_suspend suspends an individual vCPU on a machine. - .machine_suspend suspends an individual machine. - .suspend suspends the whole system. - .resume resumes the whole system. - .machine_resume resumes an individual machine. - .vcpu_resume resumes an indidivudal vCPU on a machine. Suspending nvmm: 1. causes new VM operations (ioctl and close) to block until resumed, 2. uses .suspend_interrupt to interrupt any concurrent and force them to return early, and then 3. uses the various suspend callbacks to suspend all vCPUs, machines, and the whole system -- all vCPUs before the machine they're on, and all machines before the system. Resuming nvmm does the reverse of (3) -- resume system, resume each machine and then the vCPUs on that machine -- and then unblocks operations. Implemented only for x86-vmx for now: - suspend_interrupt triggers a TLB IPI to cause VM exits; - vcpu_suspend issues VMCLEAR to force any in-CPU state to be written to memory; - machine_suspend does nothing; - suspend does VMXOFF on all CPUs; - resume does VMXON on all CPUs; - machine_resume does nothing; and - vcpu_resume just marks each vCPU as valid but inactive so subsequent use will clear it and load it with vmptrld. x86-svm left as an exercise for the reader. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/dev/nvmm/nvmm.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/nvmm/nvmm_internal.h cvs rdiff -u -r1.84 -r1.85 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.