From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jes Sorensen Date: Thu, 09 Apr 2009 14:38:14 +0000 Subject: Re: switching from KVM guest to the host .... TLBs not present? Message-Id: <49DE0856.8010700@sgi.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------050101000609030109000902" List-Id: To: kvm-ia64@vger.kernel.org This is a multi-part message in MIME format. --------------050101000609030109000902 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Zhang, Xiantao wrote: > Yeah, that is very strange! I will check it tomorrow, and have to sleep now :-) > Xiantao Hi Xiantao, I think I got it! We were calling local_irqs_disable() before calling down_read(), but down_read() can sleep and so may return with local interrupts re-enabled..... I have reordered things so now we should be safe. How does this patch look to you? Cheers, Jes --------------050101000609030109000902 Content-Type: text/x-patch; name="0001-kvm-ia64-vti-local-irq-disable.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0001-kvm-ia64-vti-local-irq-disable.patch" Reorder locking as down_read() may return with local interrupts enabled, which means we could go into vti_vcpu_run() with interrupts enabled. This caused random crashes on the Altix as the timer interrupt tried to read a memory mapped clock source, for which the TLB had not yet been reinstated in the exit, before ipsr was retored. Signed-off-by: Jes Sorensen --- arch/ia64/kvm/kvm-ia64.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) Index: linux-2.6.git/arch/ia64/kvm/kvm-ia64.c =================================================================== --- linux-2.6.git.orig/arch/ia64/kvm/kvm-ia64.c +++ linux-2.6.git/arch/ia64/kvm/kvm-ia64.c @@ -610,20 +610,22 @@ int r; again: - preempt_disable(); - local_irq_disable(); - if (signal_pending(current)) { - local_irq_enable(); - preempt_enable(); r = -EINTR; kvm_run->exit_reason = KVM_EXIT_INTR; goto out; } + /* + * down_read() may sleep and return with interrupts enabled + */ + down_read(&vcpu->kvm->slots_lock); + + preempt_disable(); + local_irq_disable(); + vcpu->guest_mode = 1; kvm_guest_enter(); - down_read(&vcpu->kvm->slots_lock); r = vti_vcpu_run(vcpu, kvm_run); if (r < 0) { local_irq_enable(); --------------050101000609030109000902--