public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [PATCH] kvm test: Add 32-bit task switch micro-test
Date: Wed, 14 Apr 2010 20:22:41 +0300	[thread overview]
Message-ID: <20100414172241.GE18132@redhat.com> (raw)
In-Reply-To: <4BC5CD5E.6000608@siemens.com>

On Wed, Apr 14, 2010 at 04:12:46PM +0200, Jan Kiszka wrote:
> Gleb, you might want to have a look at this test. When using it with my
> 2.6.34 queue (or below or with QEMU), I get the following, expected
> output:
> 
> fault at 8:4002ef, prev task 18, error code 1234
> post fault
> 
> When using it with master + my error-code patch, I get this:
> 
> fault at 8:4002ef, prev task 18, error code 1234
> 
> post fault
> 
> I.e. there is blank line, a repeated 0x0a character after returning from
> the fault handler. I'm suspecting that IO string rework triggers this.
> Instrumentation of the testdev showed that the spurious puts() was
> emitted over the instruction that the fault handler returns to. Any
> ideas?
> 
Yes, handle_task_switch() needlessly exits to userspace without setting
exit reason, so last exit reason is reused (in your test case this is io write).
This patch should fix the problem:


diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bffd049..d080840 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4740,7 +4740,7 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason)
 	if (ret == X86EMUL_CONTINUE)
 		kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
 
-	return (ret != X86EMUL_CONTINUE);
+	return (ret == X86EMUL_CONTINUE);
 }
 EXPORT_SYMBOL_GPL(kvm_task_switch);
 
--
			Gleb.

  parent reply	other threads:[~2010-04-14 17:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-14 14:12 [PATCH] kvm test: Add 32-bit task switch micro-test Jan Kiszka
2010-04-14 14:37 ` Gleb Natapov
2010-04-14 14:41   ` Jan Kiszka
2010-04-14 14:46     ` Gleb Natapov
2010-04-14 17:22 ` Gleb Natapov [this message]
2010-04-14 19:55   ` Jan Kiszka
2010-04-15 16:45 ` Marcelo Tosatti

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=20100414172241.GE18132@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox