[Bug,206579] KVM with passthrough generates "BUG: kernel NULL pointer dereference" and crashes
diff mbox series

Message ID bug-206579-28872-pjq6BvjJrG@https.bugzilla.kernel.org/
State New
Headers show
  • [Bug,206579] KVM with passthrough generates "BUG: kernel NULL pointer dereference" and crashes
Related show

Commit Message

bugzilla-daemon@bugzilla.kernel.org Feb. 27, 2020, 2:49 p.m. UTC

--- Comment #26 from Suravee Suthikulpanit (suravee.suthikulpanit@amd.com) ---
There are several reason that could inhibit the AVIC from being activated even
though it is enabled during module load (i.e. modprobe kvm_amd avic=1).

Could you please try the following patch:

---- BEGIN PATCH ----

@@ -8051,6 +8052,7 @@ void kvm_request_apicv_update(struct kvm *kvm, bool
activate, ulong bit)

+       kvm->stat.apicv_inhibit_reasons = kvm->arch.apicv_inhibit_reasons;
        trace_kvm_apicv_update_request(activate, bit);
        if (kvm_x86_ops->pre_update_apicv_exec_ctrl)
                kvm_x86_ops->pre_update_apicv_exec_ctrl(kvm, activate);
---- END PATCH ----

Then, while running the VM, please run "cat
/sys/kernel/debug/kvm/*/apicv_inhibit_reasons". This should allow us to see why
KVM deactivate AVIC.

Trying your XML file in the description, I also noticed that AVIC is
deactivated for the VM. However, when I tries specifying EPYC-IBPB model in the
XML, then it creates the VM w/ AVIC activated. Could you please give it a try?


diff mbox series

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 40a0c0f..fb7e5a6 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -995,6 +995,7 @@  struct kvm_vm_stat {
        ulong lpages;
        ulong nx_lpage_splits;
        ulong max_mmu_page_hash_collisions;
+       ulong apicv_inhibit_reasons;

 struct kvm_vcpu_stat {
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index fb5d64e..2c968a7 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -222,6 +222,7 @@  struct kvm_stats_debugfs_item debugfs_entries[] = {
        { "nx_largepages_splitted", VM_STAT(nx_lpage_splits, .mode = 0444) },
        { "max_mmu_page_hash_collisions",
                VM_STAT(max_mmu_page_hash_collisions) },
+       { "apicv_inhibit_reasons", VM_STAT(apicv_inhibit_reasons, .mode = 0444)
        { NULL }