Re: [PATCH] trace "exit to userspace" event

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

 



 On 10/08/2010 06:44 PM, Gleb Natapov wrote:
On Thu, Oct 07, 2010 at 09:49:17PM -0300, Marcelo Tosatti wrote:
>  On Thu, Oct 07, 2010 at 07:56:55PM +0200, Gleb Natapov wrote:
>  >  >  >  diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
>  >  >  >  index b8499f5..8800713 100644
>  >  >  >  --- a/virt/kvm/kvm_main.c
>  >  >  >  +++ b/virt/kvm/kvm_main.c
>  >  >  >  @@ -1458,6 +1458,8 @@ static long kvm_vcpu_ioctl(struct file *filp,
>  >  >  >   		if (arg)
>  >  >  >   			goto out;
>  >  >  >   		r = kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run);
>  >  >  >  +		if (r>= 0)
>  >  >  >  +			trace_kvm_userspace_exit(vcpu->run->exit_reason);
>  >  >  >   		break;
>  >  >  >   	case KVM_GET_REGS: {
>  >  >  >   		struct kvm_regs *kvm_regs;
>  >  >  >  --
>  >  >  >  			Gleb.
>  >  >
>  >  >  Exit codes are also valid for r == -EINTR and -EAGAIN cases, eg
>  >  >  EXIT_INTR. Better print it out for all cases, and let the reader
>  >  >  decide whether exit_reason is valid.
>  >  Are they? I see that userspace does not look into run->exit_reason in
>  >  case of -EINTR and -EAGAIN.
>
>  Not userspace, but for a human reader. Otherwise the trace information
>  is incomplete and confusing.
But if we will always call trace_kvm_userspace_exit() here trace
information will show erroneous info since on any error but -EINTR
exit_reason contains stale info. What about changing r>= 0 to r>= 0 ||
r ==  -EINTR.

We should log both errno and exit_reason. If we want to be clever, we can display strerror(errno) if it's nonzero, and exit_reason otherwise (easy to do in a trace-cmd plugin).

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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