From: Gleb Natapov <gleb@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH] trace "exit to userspace" event
Date: Thu, 7 Oct 2010 19:56:55 +0200 [thread overview]
Message-ID: <20101007175655.GG2397@redhat.com> (raw)
In-Reply-To: <20101007161839.GA31784@amt.cnet>
On Thu, Oct 07, 2010 at 01:18:39PM -0300, Marcelo Tosatti wrote:
> On Tue, Oct 05, 2010 at 03:14:32PM +0200, Gleb Natapov wrote:
> > Add tracepoint for userspace exit.
> >
> > Signed-off-by: Gleb Natapov <gleb@redhat.com>
> > diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
> > index 6dd3a51..fb44da0 100644
> > --- a/include/trace/events/kvm.h
> > +++ b/include/trace/events/kvm.h
> > @@ -6,6 +6,31 @@
> > #undef TRACE_SYSTEM
> > #define TRACE_SYSTEM kvm
> >
> > +#define ERSN(x) { KVM_EXIT_##x, "KVM_EXIT_" #x }
> > +
> > +#define kvm_trace_exit_reason \
> > + ERSN(UNKNOWN), ERSN(EXCEPTION), ERSN(IO), ERSN(HYPERCALL), \
> > + ERSN(DEBUG), ERSN(HLT), ERSN(MMIO), ERSN(IRQ_WINDOW_OPEN), \
> > + ERSN(SHUTDOWN), ERSN(FAIL_ENTRY), ERSN(INTR), ERSN(SET_TPR), \
> > + ERSN(TPR_ACCESS), ERSN(S390_SIEIC), ERSN(S390_RESET), ERSN(DCR),\
> > + ERSN(NMI), ERSN(INTERNAL_ERROR), ERSN(OSI)
> > +
> > +TRACE_EVENT(kvm_userspace_exit,
> > + TP_PROTO(__u32 reason),
> > + TP_ARGS(reason),
> > +
> > + TP_STRUCT__entry(
> > + __field( __u32, reason )
> > + ),
> > +
> > + TP_fast_assign(
> > + __entry->reason = reason;
> > + ),
> > +
> > + TP_printk("reason %s", __print_symbolic(__entry->reason,
> > + kvm_trace_exit_reason))
> > +);
> > +
> > #if defined(__KVM_HAVE_IOAPIC)
> > TRACE_EVENT(kvm_set_irq,
> > TP_PROTO(unsigned int gsi, int level, int irq_source_id),
> > 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.
--
Gleb.
next prev parent reply other threads:[~2010-10-07 17:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-05 13:14 [PATCH] trace "exit to userspace" event Gleb Natapov
2010-10-07 16:18 ` Marcelo Tosatti
2010-10-07 17:56 ` Gleb Natapov [this message]
2010-10-08 0:49 ` Marcelo Tosatti
2010-10-08 16:44 ` Gleb Natapov
2010-10-10 8:45 ` Avi Kivity
2010-10-10 15:46 ` Gleb Natapov
2010-10-14 10:27 ` Avi Kivity
2010-10-14 10:29 ` Gleb Natapov
2010-10-14 11:11 ` Avi Kivity
2010-10-14 11:28 ` Gleb Natapov
2010-10-14 11:32 ` Avi Kivity
2010-10-14 11:41 ` Gleb Natapov
2010-10-14 11:43 ` Avi Kivity
2010-10-14 11:47 ` Gleb Natapov
2010-10-14 12:09 ` Avi Kivity
2010-10-14 12:10 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101007175655.GG2397@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox