Re: [PATCH] KVM: SVM: handle singlestep exception when skipping emulated instructions

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

 



2017-06-21 15:37+0200, Ladi Prosek:
> kvm_skip_emulated_instruction handles the singlestep debug exception
> which is something we almost always want. This commit (specifically
> the change in rdmsr_interception) makes the debug.flat KVM unit test
> pass on AMD.

kvm_skip_emulated_instruction() also has a return value, which says
whether the debug exception was requested by the userspace or by the
guest (userspace has priority).

This patch fixes the guest debugging, but userspace still won't receive
its events.  I think it would be better to fix both at once,

> Signed-off-by: Ladi Prosek <lprosek@xxxxxxxxxx>
> ---
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> @@ -2278,7 +2278,7 @@ static int io_interception(struct vcpu_svm *svm)
>  	port = io_info >> 16;
>  	size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT;
>  	svm->next_rip = svm->vmcb->control.exit_info_2;
> -	skip_emulated_instruction(&svm->vcpu);
> +	kvm_skip_emulated_instruction(&svm->vcpu);
>  
>  	return in ? kvm_fast_pio_in(vcpu, size, port)
>  		  : kvm_fast_pio_out(vcpu, size, port);

i.e.
	ret = kvm_skip_emulated_instruction(&svm->vcpu);

	return ret && (...);

> @@ -3063,7 +3063,7 @@ static int vmload_interception(struct vcpu_svm *svm)
>  		return 1;
>  
>  	svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
> -	skip_emulated_instruction(&svm->vcpu);
> +	kvm_skip_emulated_instruction(&svm->vcpu);

	ret = kvm_skip_emulated_instruction(&svm->vcpu);
>  
>  	nested_svm_vmloadsave(nested_vmcb, svm->vmcb);
>  	nested_svm_unmap(page);

	return ret;

and so on ... thanks.



[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