From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCHv2] trace "exit to userspace" event Date: Sun, 24 Oct 2010 19:37:11 +0200 Message-ID: <20101024173711.GB27391@redhat.com> References: <20101024144908.GF2343@redhat.com> <4CC4666A.2030604@redhat.com> <20101024172414.GA27391@redhat.com> <4CC46C79.3070701@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:17585 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932203Ab0JXRhM (ORCPT ); Sun, 24 Oct 2010 13:37:12 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9OHbCSh012070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 24 Oct 2010 13:37:12 -0400 Content-Disposition: inline In-Reply-To: <4CC46C79.3070701@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Oct 24, 2010 at 07:27:21PM +0200, Avi Kivity wrote: > On 10/24/2010 07:24 PM, Gleb Natapov wrote: > >On Sun, Oct 24, 2010 at 07:01:30PM +0200, Avi Kivity wrote: > >> On 10/24/2010 04:49 PM, Gleb Natapov wrote: > >> >Add tracepoint for userspace exit. > >> > > >> > > >> >+ > >> >+TRACE_EVENT(kvm_userspace_exit, > >> >+ TP_PROTO(__u32 reason, int errno), > >> >+ TP_ARGS(reason, errno), > >> >+ > >> >+ TP_STRUCT__entry( > >> >+ __field( __u32, reason ) > >> >+ __field( int, errno ) > >> >+ ), > >> >+ > >> >+ TP_fast_assign( > >> >+ __entry->reason = reason; > >> >+ __entry->errno = errno; > >> > >> Shouldn't this be -errno? > >> > >I check for __entry->errno< 0 below to see if exit was due to an error. > > > > Then check for > 0. If a variable is named errno, it should work as Is it documented that kvm_arch_vcpu_ioctl_run() never returns positive value? > an input to strerror() (or a __print_symbolic for errno). > __print_symbolic for all errno will be rather long. Anyway I think ftrace is not proper place to check for syscall errors. The only error value that is interesting here is EINTR, all others will cause userspace to halt. The only things that errno accomplish here is that TP_printk string become less readable. -- Gleb.