public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] add trace points in irqchip code
Date: Tue, 07 Jul 2009 13:06:00 +0300	[thread overview]
Message-ID: <4A531E08.9010302@redhat.com> (raw)
In-Reply-To: <20090706131723.GA28046@redhat.com>

On 07/06/2009 04:17 PM, Gleb Natapov wrote:
> Add tracepoint in msi/ioapic/pic set_irq() functions,
> in IPI sending and in the point where IRQ is placed into
> apic's IRR.
>
> Signed-off-by: Gleb Natapov<gleb@redhat.com>
> diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
> index 1d1bb75..e4bcbdd 100644
> --- a/arch/x86/kvm/i8259.c
> +++ b/arch/x86/kvm/i8259.c
> @@ -30,6 +30,7 @@
>   #include "irq.h"
>
>   #include<linux/kvm_host.h>
> +#include "trace.h"
>
>   static void pic_lock(struct kvm_pic *s)
>   	__acquires(&s->lock)
> @@ -190,6 +191,8 @@ int kvm_pic_set_irq(void *opaque, int irq, int level)
>   	if (irq>= 0&&  irq<  PIC_NUM_PINS) {
>   		ret = pic_set_irq1(&s->pics[irq>>  3], irq&  7, level);
>   		pic_update_irq(s);
> +		trace_kvm_pic_set_irq(irq>>  3, irq&  7, s->pics[irq>>  3].elcr,
> +				      s->pics[irq>>  3].imr, ret == 0);
>    

It's better to send undecoded arguments (irq, s, ret) and do the 
shifting/masking/derefing in the TP_fast_assign.  This is because 
argument preparation is always compiled inline and executed (so I 
understand; not sure) but TP_fast_assign is out-of-line and only 
executed if the tracepoint is enabled.
> +TRACE_EVENT(kvm_pic_set_irq,
> +	    TP_PROTO(__u8 chip, __u8 pin, __u8 elcr, __u8 imr, int coalesced),
> +	    TP_ARGS(chip, pin, elcr, imr, coalesced),
> +
> +	TP_STRUCT__entry(
> +		__field(	__u8,		chip		)
> +		__field(	__u8,		pin		)
> +		__field(	__u8,		elcr		)
> +		__field(	__u8,		imr		)
> +		__field(	int,		coalesced	)
> +	),
>    

bool is slightly more descriptive.

> +
> +	TP_fast_assign(
> +		__entry->chip		= chip;
> +		__entry->pin		= pin;
> +		__entry->elcr		= elcr;
> +		__entry->imr		= imr;
> +		__entry->coalesced	= coalesced;
> +	),
> +
> +	TP_printk("chip=%u pin=%u (%s%s)%s",
> +		  __entry->chip, __entry->pin,
> +		  (__entry->elcr&  (1<<  __entry->pin)) ? "level":"edge",
> +		  (__entry->imr&  (1<<  __entry->pin)) ? "|masked":"",
> +		  __entry->coalesced ? " (coalesced)" : "")
> +);
>    

kvm style is not to use equals signs.

> +
> +	TP_printk("dst=%x vec=%u (%s|%s|%s|%s|%s)",
> +		  __entry->dest_id, (u8)__entry->icr_low,
> +		  __print_symbolic((__entry->icr_low>>  8&  0x7),
> +				   kvm_deliver_mode),
> +		  (__entry->icr_low&  (1<<11)) ? "logical":"physical",
> +		  (__entry->icr_low&  (1<<14)) ? "assert":"de-assert",
> +		  (__entry->icr_low&  (1<<15)) ? "level":"edge",
>    

Spaces around :.

> +	TP_STRUCT__entry(
> +		__field(	__u32,		apicid		)
> +		__field(	__u8,		dm		)
> +		__field(	__u8,		tm		)
> +		__field(	__u8,		vec		)
> +		__field(	__u8,		coalesced	)
> +	),
>    

bool.

> +
> +TRACE_EVENT(kvm_msi_set_irq,
> +	    TP_PROTO(__u32 address, __u64 data),
> +	    TP_ARGS(address, data),
> +
> +	TP_STRUCT__entry(
> +		__field(	__u32,		address		)
>    

Make this a u64 just in case.


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


  reply	other threads:[~2009-07-07 10:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06 13:17 [PATCH] add trace points in irqchip code Gleb Natapov
2009-07-07 10:06 ` Avi Kivity [this message]
2009-07-07 12:44   ` Gleb Natapov
2009-07-07 12:52     ` 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=4A531E08.9010302@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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