Skip to content

Nested Paging Virtualization for KVM v3

Joerg Roedel lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest27 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/27KVM: MMU: Check for root_level instead of long modearch/x86/kvm/paging_tmpl.h+2 -20 replies
2/27KVM: MMU: Make tdp_enabled a mmu-context parameterarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c+13 -80 replies
3/27KVM: MMU: Make set_cr3 a function pointer in kvm_mmuarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c+4 -10 replies
4/27KVM: X86: Introduce a tdp_set_cr3 functionarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c arch/x86/kvm/svm.c +1 more+19 -100 replies
5/27KVM: MMU: Introduce get_cr3 function pointerarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h+11 -30 replies
6/27KVM: MMU: Introduce inject_page_fault function pointerarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c+6 -10 replies
7/27KVM: MMU: Introduce kvm_init_shadow_mmu helper functionarch/x86/kvm/mmu.c arch/x86/kvm/mmu.h+36 -250 replies
8/27KVM: MMU: Let is_rsvd_bits_set take mmu context instead of vcpuarch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h+7 -60 replies
9/27KVM: MMU: Introduce generic walk_addr functionarch/x86/kvm/paging_tmpl.h+18 -80 replies
10/27KVM: MMU: Add infrastructure for two-level page walkerarch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c include/linux/kvm_host.h+12 -00 replies
11/27KVM: X86: Introduce pointer to mmu context used for gva_to_gpaarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c arch/x86/kvm/x86.c+29 -120 replies
12/27KVM: MMU: Implement nested gva_to_gpa functionsarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h +1 more+54 -00 replies
13/27KVM: X86: Add kvm_read_guest_page_tdp functionarch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c+27 -00 replies
14/27KVM: MMU: Make walk_addr_generic capable for two-level walkingarch/x86/kvm/paging_tmpl.h+20 -70 replies
15/27KVM: MMU: Introduce kvm_read_guest_page_x86()arch/x86/kvm/x86.c+18 -40 replies
16/27KVM: MMU: Introduce init_kvm_nested_mmu()arch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c arch/x86/kvm/mmu.h +1 more+55 -10 replies
17/27KVM: MMU: Track page fault data in struct vcpuarch/x86/include/asm/kvm_emulate.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/emulate.c +2 more+29 -180 replies
18/27KVM: MMU: Propagate the right fault back to the guest after gva_to_gpaarch/x86/include/asm/kvm_host.h arch/x86/kvm/x86.c+18 -20 replies
19/27KVM: X86: Propagate fetch faultsarch/x86/kvm/emulate.c arch/x86/kvm/x86.c+7 -00 replies
20/27KVM: MMU: Add kvm_mmu parameter to load_pdptrs functionarch/x86/include/asm/kvm_host.h arch/x86/kvm/kvm_cache_regs.h arch/x86/kvm/svm.c +2 more+27 -240 replies
21/27KVM: MMU: Introduce kvm_pdptr_read_mmuarch/x86/kvm/kvm_cache_regs.h arch/x86/kvm/mmu.c arch/x86/kvm/paging_tmpl.h+9 -20 replies
22/27KVM: MMU: Refactor mmu_alloc_roots functionarch/x86/kvm/mmu.c+60 -220 replies
23/27KVM: MMU: Allow long mode shadows for legacy page tablesarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu.c+53 -80 replies
24/27KVM: SVM: Implement MMU helper functions for Nested Nested Pagingarch/x86/kvm/svm.c+32 -00 replies
25/27KVM: SVM: Initialize Nested Nested MMU context on VMRUNarch/x86/kvm/mmu.c arch/x86/kvm/svm.c+42 -90 replies
26/27KVM: SVM: Expect two more candiates for exit_int_infoarch/x86/kvm/svm.c+2 -10 replies
27/27KVM: SVM: Report Nested Paging support to userspacearch/x86/kvm/svm.c+4 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/27] Nested Paging Virtualization for KVM v3

Hi Avi, Marcelo,

here is finally the third round of my NPT virtualization patches for KVM. It took a while to get everything running (including KVM itself) on 32 bit again to actually test it. But testing on 32 bit host and with a 32 bit hypervisor was a very good idea. I found some serious bugs and shortcomings in my code that are fixed now in v3.

The patchset was tested in a number of combinations:

	host(64|32e)
		->kvm(shadow|npt)
			->guest(64|32e|32)
				->test(boot|kbuild)

	host(64|32e)
		->kvm(npt)
			->guest(64|32e|32)
				->kvm(shadow|kvm)
					->guest(64|32e|32)
						->test(boot|kbuild)

Only the valid combinations where tested of course, so no 64 bit on 32 bit combinations were tested. Except for that I tested all of the above combinations and all worked without any regressions.

Other changes since v2 are:

* Addressed the review comments from v2:
- Rebased everything to latest upstream code
- renamed nested_mmu to walk_mmu to make its
meaning more clear
- the gva_to_gpa functions are not longer swapped between the two mmu states which makes it more consistent
- Moved struct vcpu page fault data into seperate sub-struct for better readability
- Other minor stuff (coding style, typos)
- Renamed the kvm_*_page_x86 functions to kvm_*_page_mmu so that they can be made more generic later.
* Made everything work on 32 bit
- Introduced mmu->lm_root pointer to let the softmmu shadow 32 bit page tables with a long-mode page table. The lm_root page-table root always just points to the mmu.pae_root, so this builds entirely on the pae-shadow code.
- Split mmu_alloc_roots into a shadow and direct_map version to simplify the code and to not break the direct_map paths anymore when changing something in that function.
* Probably other changes I forgot about

This patchset applies on todays avi/master + the three patches I sent end of last week. These patches are necessary for some of the tests above to run.

For the curious and impatient user I put everything in a branch on kernel.org. If you want to test it you can pull the tree from

	git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-kvm.git npt-virt-v3

Please review and/or apply these patches if considered good enough. Otherwise I appreciate your feedback.

Thanks,

Joerg