Re: [PATCH] kvm test: Add 32-bit task switch micro-test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gleb Natapov wrote:
> 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);
>  

Yep, makes sense and works for me as well.

Jan

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux