linux/arch
Paolo Bonzini 79a8059d24 KVM: svm: do not call kvm_set_cr0 from init_vmcb
kvm_set_cr0 may want to call kvm_zap_gfn_range and thus access the
memslots array (SRCU protected).  Using a mini SRCU critical section
is ugly, and adding it to kvm_arch_vcpu_create doesn't work because
the VMX vcpu_create callback calls synchronize_srcu.

Fixes this lockdep splat:

===============================
[ INFO: suspicious RCU usage. ]
4.3.0-rc1+ #1 Not tainted
-------------------------------
include/linux/kvm_host.h:488 suspicious rcu_dereference_check() usage!

other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
1 lock held by qemu-system-i38/17000:
 #0:  (&(&kvm->mmu_lock)->rlock){+.+...}, at: kvm_zap_gfn_range+0x24/0x1a0 [kvm]

[...]
Call Trace:
 dump_stack+0x4e/0x84
 lockdep_rcu_suspicious+0xfd/0x130
 kvm_zap_gfn_range+0x188/0x1a0 [kvm]
 kvm_set_cr0+0xde/0x1e0 [kvm]
 init_vmcb+0x760/0xad0 [kvm_amd]
 svm_create_vcpu+0x197/0x250 [kvm_amd]
 kvm_arch_vcpu_create+0x47/0x70 [kvm]
 kvm_vm_ioctl+0x302/0x7e0 [kvm]
 ? __lock_is_held+0x51/0x70
 ? __fget+0x101/0x210
 do_vfs_ioctl+0x2f4/0x560
 ? __fget_light+0x29/0x90
 SyS_ioctl+0x4c/0x90
 entry_SYSCALL_64_fastpath+0x16/0x73

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2015-09-25 10:31:22 +02:00
..
alpha dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
arc ARCv2: [axs103_smp] Reduce clk for SMP FPGA configs 2015-09-11 19:34:01 -07:00
arm Second set of KVM/ARM changes for 4.3-rc2 2015-09-17 16:51:59 +02:00
arm64 Second set of KVM/ARM changes for 4.3-rc2 2015-09-17 16:51:59 +02:00
avr32 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-03 15:46:07 -07:00
blackfin Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-03 15:46:07 -07:00
c6x Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 14:33:35 -07:00
cris CRISv10: delete unused lib/dmacopy.c 2015-09-05 00:56:51 +02:00
frv Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-03 15:46:07 -07:00
h8300 dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
hexagon Merge branch 'akpm' (patches from Andrew) 2015-09-10 18:19:42 -07:00
ia64 dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
m32r lib/decompressors: use real out buf size for gunzip with kernel 2015-09-10 13:29:01 -07:00
m68k kexec: split kexec_load syscall from kexec core code 2015-09-10 13:29:01 -07:00
metag Metag architecture changes for v4.3 2015-09-09 10:27:59 -07:00
microblaze Merge branch 'akpm' (patches from Andrew) 2015-09-10 18:19:42 -07:00
mips KVM: add halt_attempted_poll to VCPU stats 2015-09-16 12:17:00 +02:00
mn10300 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-03 15:46:07 -07:00
nios2 nios2: add Max10 defconfig 2015-09-08 18:16:02 +08:00
openrisc dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
parisc parisc: Use platform_device_register_simple("rtc-generic") 2015-09-08 17:53:48 +02:00
powerpc KVM: PPC: Book3S: Take the kvm->srcu lock in kvmppc_h_logical_ci_load/store() 2015-09-21 09:05:15 +10:00
s390 KVM: s390: Replace incorrect atomic_or with atomic_andnot 2015-09-16 17:01:06 +02:00
score Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 14:04:50 -07:00
sh dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
sparc dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
tile dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
um Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-01 14:04:50 -07:00
unicore32 dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
x86 KVM: svm: do not call kvm_set_cr0 from init_vmcb 2015-09-25 10:31:22 +02:00
xtensa dma-mapping: consolidate dma_set_mask 2015-09-10 13:29:01 -07:00
.gitignore
Kconfig kexec: split kexec_load syscall from kexec core code 2015-09-10 13:29:01 -07:00