netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net,
	kaneshige.kenji@jp.fujitsu.com, izumi.taku@jp.fujitsu.com,
	kosaki.motohiro@jp.fujitsu.com, nhorman@tuxdriver.com,
	laijs@cn.fujitsu.com, scott.a.mcmillan@intel.com,
	rostedt@goodmis.org, eric.dumazet@gmail.com, fweisbec@gmail.com,
	mathieu.desnoyers@polymtl.ca
Subject: [RFC PATCH v3 0/5] netdev: show a process of packets
Date: Tue, 20 Jul 2010 09:43:27 +0900	[thread overview]
Message-ID: <4C44F12F.5090908@jp.fujitsu.com> (raw)

CHANGE-LOG since v2:
    1) let all tracepoints of softirq use DECLARE_EVENT_CLASS
    2) let tracepoint of netdev_queue and netdev_receive use DECLARE_EVENT_CLASS
    3) add tracepoint to skb_free_datagram_locked
    4) show function and time when received packet is freed

These patch-set adds tracepoints to show us a process of packets.
Using these tracepoints and existing points, we can get the time when
packet passes through some points in transmit or receive sequence.
For example, this is an output of perf script which is attached by patch 5/5.

79074.756672832sec cpu=1
irq_entry(+0.000000msec,irq=77:eth3)
         |------------softirq_raise(+0.001277msec)
irq_exit (+0.002278msec)     |
                             |
                      softirq_entry(+0.003562msec)
                             |
                             |---netif_receive_skb(+0.006279msec,len=100)
                             |            |
                             |   skb_copy_datagram_iovec(+0.038778msec, 2285:sshd)
                             |
                      napi_poll_exit(+0.017160msec, eth3)
                             |
                      softirq_exit(+0.018248msec)

The above is a receive side. Like this, it can show receive sequence from
interrupt(irq_entry) to application(skb_copy_datagram_iovec). There are eight
points in this side. All events except for skb_copy_datagram_iovec and
freeing skb events can be associated with each other by CPU number.
skb_copy_datagram_iovec and freeing skb events can be associated with
netif_receive_skb by skbaddr.
This script shows one NET_RX softirq and events related to it. All relative
time bases on first irq_entry which raise NET_RX softirq.

   dev    len      Qdisc               netdevice             free
   eth3   114  79044.417123332sec     0.005242msec          0.103843msec
   eth3   114  79044.580090422sec     0.002306msec          0.103632msec
   eth3   114  79044.719078251sec     0.002288msec          0.104093msec

The above is a transmit side. There are three tracepoints in this side.
Point1 is before putting a packet to Qdisc. point2 is after ndo_start_xmit in
dev_hard_start_xmit. It indicates finishing putting a packet to driver.
point3 is in consume_skb and dev_kfree_skb_irq. It indicates freeing a
transmitted packet.
Values of this script are, from left, device name, length of a packet, a time of
point1, an interval time between point1 and point2 and an interval time between
point2 and point3.

These times are useful to analyze a performance or to detect a point where
packet delays. For example,
- NET_RX softirq calling is late.
- Application is late to take a packet.
- It takes much time to put a transmitting packet to driver
  (It may be caused by packed queue)

And also, these tracepoint help us to investigate a network driver's trouble
from memory dump because ftrace records it to memory. And ftrace is so light
even if always trace on. So, in a case investigating a problem which doesn't
reproduce, it is useful.

Thanks,
Koki Sanagi.

             reply	other threads:[~2010-07-20  0:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-20  0:43 Koki Sanagi [this message]
2010-07-20  0:45 ` [RFC PATCH v3 1/5] irq: add tracepoint to softirq_raise Koki Sanagi
2010-07-20 11:04   ` Neil Horman
2010-07-21  6:57     ` Koki Sanagi
2010-07-21 11:14       ` Neil Horman
2010-07-21 13:01         ` KOSAKI Motohiro
2010-07-21 13:56           ` Neil Horman
2010-07-23  5:34             ` KOSAKI Motohiro
2010-07-22  8:41         ` Koki Sanagi
2010-07-20  0:46 ` [RFC PATCH v3 2/5] napi: convert trace_napi_poll to TRACE_EVENT Koki Sanagi
2010-07-20 11:09   ` Neil Horman
2010-07-21  7:00     ` Koki Sanagi
2010-07-21 11:24       ` Neil Horman
2010-07-20  0:47 ` [RFC PATCH v3 3/5] netdev: add tracepoints to netdev layer Koki Sanagi
2010-07-20 11:41   ` Neil Horman
2010-07-21  7:01     ` Koki Sanagi
2010-07-20  0:49 ` [RFC PATCH v3 4/5] skb: add tracepoints to freeing skb Koki Sanagi
2010-07-20  4:54   ` Eric Dumazet
2010-07-20  6:47     ` Koki Sanagi
2010-07-20 11:50   ` Neil Horman
2010-07-21  7:02     ` Koki Sanagi
2010-07-21 10:56       ` Neil Horman
2010-07-22  8:39         ` Koki Sanagi
2010-07-22 14:57           ` Neil Horman
2010-07-20  0:50 ` [RFC PATCH v3 5/5] perf:add a script shows a process of packet Koki Sanagi

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=4C44F12F.5090908@jp.fujitsu.com \
    --to=sanagi.koki@jp.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=rostedt@goodmis.org \
    --cc=scott.a.mcmillan@intel.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;
as well as URLs for NNTP newsgroup(s).