From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH] kvm test: Add 32-bit task switch micro-test Date: Wed, 14 Apr 2010 20:22:41 +0300 Message-ID: <20100414172241.GE18132@redhat.com> References: <4BC5CD5E.6000608@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , Marcelo Tosatti , kvm To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:16990 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756459Ab0DNRWo (ORCPT ); Wed, 14 Apr 2010 13:22:44 -0400 Content-Disposition: inline In-Reply-To: <4BC5CD5E.6000608@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: 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.