public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm@vger.kernel.org, Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 1/2] KVM: x86: set debug registers after "schedulable" section
Date: Fri, 01 Aug 2008 20:09:13 -0300	[thread overview]
Message-ID: <20080801231343.687131356@localhost.localdomain> (raw)
In-Reply-To: 20080801230912.013317832@localhost.localdomain

[-- Attachment #1: kvm-x86-debug --]
[-- Type: text/plain, Size: 1082 bytes --]

The vcpu thread can be preempted after the guest_debug_pre() callback,
resulting in invalid debug registers on the new vcpu.

Move it inside the non-preemptable section.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: kvm/arch/x86/kvm/x86.c
===================================================================
--- kvm.orig/arch/x86/kvm/x86.c
+++ kvm/arch/x86/kvm/x86.c
@@ -3088,10 +3088,6 @@ static int __vcpu_run(struct kvm_vcpu *v
 	down_read(&vcpu->kvm->slots_lock);
 	vapic_enter(vcpu);
 
-preempted:
-	if (vcpu->guest_debug.enabled)
-		kvm_x86_ops->guest_debug_pre(vcpu);
-
 again:
 	if (vcpu->requests)
 		if (test_and_clear_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests))
@@ -3145,6 +3141,9 @@ again:
 		goto out;
 	}
 
+	if (vcpu->guest_debug.enabled)
+		kvm_x86_ops->guest_debug_pre(vcpu);
+
 	vcpu->guest_mode = 1;
 	/*
 	 * Make sure that guest_mode assignment won't happen after
@@ -3219,7 +3218,7 @@ out:
 	if (r > 0) {
 		kvm_resched(vcpu);
 		down_read(&vcpu->kvm->slots_lock);
-		goto preempted;
+		goto again;
 	}
 
 	post_kvm_run_save(vcpu, kvm_run);

-- 


  reply	other threads:[~2008-08-01 23:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-01 23:09 [patch 0/2] do not run halted vcpu's Marcelo Tosatti
2008-08-01 23:09 ` Marcelo Tosatti [this message]
2008-08-13 10:46   ` [patch 1/2] KVM: x86: set debug registers after "schedulable" section Avi Kivity
2008-08-01 23:09 ` [patch 2/2] KVM: x86: do not execute halted vcpus (v2) Marcelo Tosatti
2008-08-13 10:51   ` Avi Kivity
2008-08-13 10:53     ` Avi Kivity
2008-08-13 10:44 ` [patch 0/2] do not run halted vcpu's Avi Kivity
2008-08-15  0:19   ` Marcelo Tosatti
2008-08-17  6:31     ` Avi Kivity
2008-08-17  7:41       ` Avi Kivity
2008-08-19 23:07         ` Marcelo Tosatti
2008-08-20  4:04           ` Avi Kivity

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=20080801231343.687131356@localhost.localdomain \
    --to=mtosatti@redhat.com \
    --cc=avi@qumranet.com \
    --cc=kvm@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox