public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing/irq: use softirq_to_name instead of __print_symbolic
Date: Mon, 1 Jun 2009 10:36:26 -0400	[thread overview]
Message-ID: <20090601143626.GA26981@infradead.org> (raw)
In-Reply-To: <4A2396C7.3000700@cn.fujitsu.com>

On Mon, Jun 01, 2009 at 04:52:23PM +0800, Li Zefan wrote:
> It's great to boost recording of softirq events, but why not simply
> use softirq_to_name in TP_printk()?

Because userspace programs using the binary trace buffer have no chance to
retrieve the values from softirq_to_name.

> The above commit has 2 flaws:
> 
>   - we waste memory defining local static struct trace_print_flags array
>     in each softirq TRACE_EVENT

That could be solved by declaring the array manually and just passing
the address to __print_symbolic.  Steve, would that work?  (also for
__print_flags)

>   - if someone adds/removes a softirq, he may not know show_softirq_name()
>     needs to be updated

Just make sure you have the translation defined next to the actual
flags.  This is what I do in the XFS tracer:

typedef enum xfs_alloctype
{
	XFS_ALLOCTYPE_ANY_AG,           /* allocate anywhere, use rotor */
	XFS_ALLOCTYPE_FIRST_AG,         /* ... start at ag 0 */
	XFS_ALLOCTYPE_START_AG,         /* anywhere, start in this a.g. */
	XFS_ALLOCTYPE_THIS_AG,          /* anywhere in this a.g. */
	XFS_ALLOCTYPE_START_BNO,	/* near this block else anywhere */
	XFS_ALLOCTYPE_NEAR_BNO,		/* in this a.g. and near this block */
	XFS_ALLOCTYPE_THIS_BNO		/* at exactly this block */
} xfs_alloctype_t;

#define XFS_ALLOC_TYPES \
	{ XFS_ALLOCTYPE_ANY_AG,         "ANY_AG" }, \
	{ XFS_ALLOCTYPE_FIRST_AG,       "FIRST_AG" }, \
	{ XFS_ALLOCTYPE_START_AG,       "START_AG" }, \
	{ XFS_ALLOCTYPE_THIS_AG,	"THIS_AG" }, \
	{ XFS_ALLOCTYPE_START_BNO,	"START_BNO" }, \
	{ XFS_ALLOCTYPE_NEAR_BNO,	"NEAR_BNO" }, \
	{ XFS_ALLOCTYPE_THIS_BNO,	"THIS_BNO" }

> Another issue with the above commit, that the output of softirq events
> becomes:
> 
>   X-1701  [000]  1595.220739: softirq_entry: softirq=1 action=TIMER_SOFTIRQ
> 
> Compared to the original output:
> 
>   X-1701  [000]  1595.220739: softirq_entry: softirq=1 action=TIMER

Which is trivially fixable, see above :)


  reply	other threads:[~2009-06-01 14:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01  8:52 [PATCH] tracing/irq: use softirq_to_name instead of __print_symbolic Li Zefan
2009-06-01 14:36 ` Christoph Hellwig [this message]
2009-06-01 15:06   ` Steven Rostedt
2009-06-02  1:31     ` Li Zefan

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=20090601143626.GA26981@infradead.org \
    --to=hch@infradead.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.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