On Fri, Sep 25, 2020 at 02:22:43PM -0700, Ben Gardon wrote: > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c > new file mode 100644 > index 0000000000000..8241e18c111e6 > --- /dev/null > +++ b/arch/x86/kvm/mmu/tdp_mmu.c > @@ -0,0 +1,34 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > + > +#include "tdp_mmu.h" > + > +static bool __read_mostly tdp_mmu_enabled = true; > +module_param_named(tdp_mmu, tdp_mmu_enabled, bool, 0644); This param should not exist until the TDP MMU is fully functional, e.g. running KVM against "kvm: mmu: Support zapping SPTEs in the TDP MMU" immediately hits a BUG() in the rmap code. I haven't wrapped my head around the entire series to grok whether it make sense to incrementally enable the TDP MMU, but my gut says that's probably non-sensical. The local variable can exist (default to false) so that you can flip a single switch to enable the code instead of having to plumb in the variable to its consumers. kernel BUG at arch/x86/kvm/mmu/mmu.c:1427! invalid opcode: 0000 [#1] SMP CPU: 4 PID: 1218 Comm: stable Not tainted 5.9.0-rc4+ #44 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:rmap_get_first.isra.0+0x51/0x60 [kvm] Code: <0f> 0b 45 31 c0 4c 89 c0 c3 66 0f 1f 44 00 00 0f 1f 44 00 00 49 b9 RSP: 0018:ffffc9000099fb50 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000001000 RCX: 0000000000000000 RDX: ffffc9000099fb60 RSI: ffffc9000099fb58 RDI: ffff88816b1a7ec8 RBP: ffff88816b1a7e70 R08: ffff888173c95000 R09: ffff88816b1a7448 R10: 00000000000000f8 R11: ffff88817bd29c70 R12: ffffc90000981000 R13: ffffc9000099fbac R14: ffffc90000989a88 R15: ffff88816b1a7ec8 FS: 00007f7a755fd700(0000) GS:ffff88817bd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f7a60141000 CR3: 000000016b031004 CR4: 0000000000172ea0 Call Trace: __kvm_mmu_prepare_zap_page+0x98/0x330 [kvm] kvm_mmu_zap_all_fast+0x100/0x190 [kvm] kvm_page_track_flush_slot+0x54/0x80 [kvm] kvm_set_memslot+0x198/0x640 [kvm] kvm_delete_memslot+0x59/0xc0 [kvm] __kvm_set_memory_region+0x494/0x560 [kvm] ? khugepaged+0x470/0x2230 ? mem_cgroup_charge_statistics.isra.0+0x1c/0x40 kvm_set_memory_region+0x27/0x40 [kvm] kvm_vm_ioctl+0x379/0xca0 [kvm] ? do_user_addr_fault+0x1ad/0x3a7 __x64_sys_ioctl+0x83/0xb0 do_syscall_64+0x33/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xa9