From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Wanpeng Li <wanpeng.li@hotmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Yunhong Jiang <yunhong.jiang@intel.com>
Subject: Re: [PATCH] KVM: nVMX: Fix reload apic access page warning
Date: Fri, 23 Sep 2016 01:10:15 +0200 [thread overview]
Message-ID: <20160922231014.GA25134@potion> (raw)
In-Reply-To: <1473153633-4725-1-git-send-email-wanpeng.li@hotmail.com>
2016-09-06 17:20+0800, Wanpeng Li:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
> WARNING: CPU: 1 PID: 4230 at kernel/sched/core.c:7564 __might_sleep+0x7e/0x80
> do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffff8d0de7f9>] prepare_to_swait+0x39/0xa0
> CPU: 1 PID: 4230 Comm: qemu-system-x86 Not tainted 4.8.0-rc5+ #47
> Call Trace:
> dump_stack+0x99/0xd0
> __warn+0xd1/0xf0
> warn_slowpath_fmt+0x4f/0x60
> ? prepare_to_swait+0x39/0xa0
> ? prepare_to_swait+0x39/0xa0
> __might_sleep+0x7e/0x80
> __gfn_to_pfn_memslot+0x156/0x480 [kvm]
> gfn_to_pfn+0x2a/0x30 [kvm]
> gfn_to_page+0xe/0x20 [kvm]
> kvm_vcpu_reload_apic_access_page+0x32/0xa0 [kvm]
> nested_vmx_vmexit+0x765/0xca0 [kvm_intel]
> ? _raw_spin_unlock_irqrestore+0x36/0x80
> vmx_check_nested_events+0x49/0x1f0 [kvm_intel]
> kvm_arch_vcpu_runnable+0x2d/0xe0 [kvm]
> kvm_vcpu_check_block+0x12/0x60 [kvm]
> kvm_vcpu_block+0x94/0x4c0 [kvm]
> kvm_arch_vcpu_ioctl_run+0x619/0x1aa0 [kvm]
> ? kvm_arch_vcpu_ioctl_run+0xdf1/0x1aa0 [kvm]
> kvm_vcpu_ioctl+0x2d3/0x7c0 [kvm]
>
> ===============================
> [ INFO: suspicious RCU usage. ]
> 4.8.0-rc5+ #47 Not tainted
> -------------------------------
> ./include/linux/kvm_host.h:535 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-x86/4230:
> #0: (&vcpu->mutex){+.+.+.}, at: [<ffffffffc062975c>] vcpu_load+0x1c/0x60 [kvm]
>
> stack backtrace:
> CPU: 1 PID: 4230 Comm: qemu-system-x86 Not tainted 4.8.0-rc5+ #47
> Call Trace:
> dump_stack+0x99/0xd0
> lockdep_rcu_suspicious+0xe7/0x120
> gfn_to_memslot+0x12a/0x140 [kvm]
> gfn_to_pfn+0x12/0x30 [kvm]
> gfn_to_page+0xe/0x20 [kvm]
> kvm_vcpu_reload_apic_access_page+0x32/0xa0 [kvm]
> nested_vmx_vmexit+0x765/0xca0 [kvm_intel]
> ? _raw_spin_unlock_irqrestore+0x36/0x80
> vmx_check_nested_events+0x49/0x1f0 [kvm_intel]
> kvm_arch_vcpu_runnable+0x2d/0xe0 [kvm]
> kvm_vcpu_check_block+0x12/0x60 [kvm]
> kvm_vcpu_block+0x94/0x4c0 [kvm]
> kvm_arch_vcpu_ioctl_run+0x619/0x1aa0 [kvm]
> ? kvm_arch_vcpu_ioctl_run+0xdf1/0x1aa0 [kvm]
> kvm_vcpu_ioctl+0x2d3/0x7c0 [kvm]
> ? __fget+0xfd/0x210
> ? __lock_is_held+0x54/0x70
> do_vfs_ioctl+0x96/0x6a0
> ? __fget+0x11c/0x210
> ? __fget+0x5/0x210
> SyS_ioctl+0x79/0x90
> do_syscall_64+0x81/0x220
> entry_SYSCALL64_slow_path+0x25/0x25
>
> These can be triggered by running kvm-unit-test: ./x86-run x86/vmx.flat
>
> The nested preemption timer is based on hrtimer which is started on L2
> entry, stopped on L2 exit and evaluated via the new check_nested_events
> hook. The current logic adds vCPU to a simple waitqueue (TASK_INTERRUPTIBLE)
> if need to yield pCPU and w/o holding srcu read lock when accesses memslots,
> both can be in nested preemption timer evaluation path which results in
> the warning above.
>
> This patch fix it by leveraging request bit to async reload APIC access
> page before vmentry in order to avoid to reload directly during the nested
> preemption timer evaluation, it is safe since the vmcs01 is loaded and
> current is nested vmexit.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: Yunhong Jiang <yunhong.jiang@intel.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
Applied to kvm/queue, thanks.
prev parent reply other threads:[~2016-09-22 23:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 9:20 [PATCH] KVM: nVMX: Fix reload apic access page warning Wanpeng Li
2016-09-16 1:07 ` Wanpeng Li
2016-09-20 13:24 ` Radim Krčmář
2016-09-21 2:33 ` Wanpeng Li
2016-09-22 23:10 ` Radim Krčmář [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160922231014.GA25134@potion \
--to=rkrcmar@redhat.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=wanpeng.li@hotmail.com \
--cc=yunhong.jiang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.