From: David Ahern <dsahern@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Valdis.Kletnieks@vt.edu, acme@kernel.org,
linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
Jiri Olsa <jolsa@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] tools lib traceevent: Add support for IP address formats
Date: Mon, 22 Dec 2014 10:10:02 -0700 [thread overview]
Message-ID: <5498506A.4010100@gmail.com> (raw)
In-Reply-To: <20141222170103.GG29096@krava.brq.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
On 12/22/14 10:01 AM, Jiri Olsa wrote:
> apart from your tracepoints, is there another tracepoint using this?
> I couldn't find any.. I dont think it's a problem.. just wanted to
> try it;-)
grrr... i was hoping no one would ask that question. I am not aware of
any in tree. We use it locally in custom tracepoints in the networking
stack (from what I can tell netdev will not take -- LTTng tried many
years ago) and in a couple of klms.
The attached patch is what I used to test (plus our local versions). It
is derived from a patch on the 3.4 kernel which allows us to trace
address changes.
David
[-- Attachment #2: tracepoints-to-test-IP-address-format-output.patch --]
[-- Type: text/plain, Size: 5419 bytes --]
>From bedfad82a159226f06a8035f6a7622fce6df7a0a Mon Sep 17 00:00:00 2001
From: David Ahern <dsahern@gmail.com>
Date: Thu, 18 Dec 2014 19:03:28 -0700
Subject: [PATCH 2/2] tracepoints to test IP address format output
Signed-off-by: David Ahern <dsahern@gmail.com>
---
include/trace/events/ipv4.h | 42 ++++++++++++++++++++++++++++++++++++++++++
include/trace/events/ipv6.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
net/core/net-traces.c | 2 ++
net/ipv4/devinet.c | 4 ++++
net/ipv6/addrconf.c | 4 ++++
5 files changed, 96 insertions(+)
create mode 100644 include/trace/events/ipv4.h
create mode 100644 include/trace/events/ipv6.h
diff --git a/include/trace/events/ipv4.h b/include/trace/events/ipv4.h
new file mode 100644
index 000000000000..24e1e8a8b843
--- /dev/null
+++ b/include/trace/events/ipv4.h
@@ -0,0 +1,42 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM ipv4
+
+#if !defined(_TRACE_EVENTS_IPV4_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_EVENTS_IPV4_H
+
+#include <linux/inetdevice.h>
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(ipv4_addr_template,
+
+ TP_PROTO(struct in_ifaddr *ifa,
+ struct in_device *in_dev),
+
+ TP_ARGS(ifa, in_dev),
+
+ TP_STRUCT__entry(
+ __array(__u8, addr, 4)
+ ),
+
+ TP_fast_assign(
+ memcpy(&__entry->addr, &ifa->ifa_address, 4);
+ ),
+
+ TP_printk("pI4=%pI4 pi4=%pi4",
+ __entry->addr, __entry->addr)
+);
+
+DEFINE_EVENT(ipv4_addr_template, ipv4_add_addr,
+ TP_PROTO(struct in_ifaddr *ifa, struct in_device *in_dev),
+ TP_ARGS(ifa, in_dev)
+);
+
+DEFINE_EVENT(ipv4_addr_template, ipv4_del_addr,
+ TP_PROTO(struct in_ifaddr *ifa, struct in_device *in_dev),
+ TP_ARGS(ifa, in_dev)
+);
+
+#endif /* _TRACE_EVENTS_IPV4_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/include/trace/events/ipv6.h b/include/trace/events/ipv6.h
new file mode 100644
index 000000000000..db1ae85eaa0c
--- /dev/null
+++ b/include/trace/events/ipv6.h
@@ -0,0 +1,44 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM ipv6
+
+#if !defined(_TRACE_EVENTS_IPV6_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_EVENTS_IPV6_H
+
+#include <net/if_inet6.h>
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(ipv6_addr_template,
+
+ TP_PROTO(struct inet6_ifaddr *ifa),
+
+ TP_ARGS(ifa),
+
+ TP_STRUCT__entry(
+ __array(__u8, addr, (int)sizeof(struct in6_addr))
+ ),
+
+ TP_fast_assign(
+ memcpy(&__entry->addr, &ifa->addr, (int)sizeof(struct in6_addr));
+ ),
+
+ TP_printk("pi6=%pi6 pI6=%pI6 pI6c=%pI6c",
+ __entry->addr, __entry->addr, __entry->addr)
+);
+
+DEFINE_EVENT(ipv6_addr_template, ipv6_add_addr,
+
+ TP_PROTO(struct inet6_ifaddr *ifa),
+
+ TP_ARGS(ifa)
+);
+DEFINE_EVENT(ipv6_addr_template, ipv6_del_addr,
+
+ TP_PROTO(struct inet6_ifaddr *ifa),
+
+ TP_ARGS(ifa)
+);
+
+#endif /* _TRACE_EVENTS_IPV6_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/net/core/net-traces.c b/net/core/net-traces.c
index ba3c0120786c..b564a28852d1 100644
--- a/net/core/net-traces.c
+++ b/net/core/net-traces.c
@@ -31,6 +31,8 @@
#include <trace/events/napi.h>
#include <trace/events/sock.h>
#include <trace/events/udp.h>
+#include <trace/events/ipv4.h>
+#include <trace/events/ipv6.h>
EXPORT_TRACEPOINT_SYMBOL_GPL(kfree_skb);
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 214882e7d6de..aa6ba2ad93fd 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -64,6 +64,7 @@
#include <net/rtnetlink.h>
#include <net/net_namespace.h>
#include <net/addrconf.h>
+#include <trace/events/ipv4.h>
#include "fib_lookup.h"
@@ -358,6 +359,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
inet_hash_remove(ifa);
*ifap1 = ifa->ifa_next;
+ trace_ipv4_del_addr(ifa, in_dev);
rtmsg_ifa(RTM_DELADDR, ifa, nlh, portid);
blocking_notifier_call_chain(&inetaddr_chain,
NETDEV_DOWN, ifa);
@@ -395,6 +397,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
is valid, it will try to restore deleted routes... Grr.
So that, this order is correct.
*/
+ trace_ipv4_del_addr(ifa1, in_dev);
rtmsg_ifa(RTM_DELADDR, ifa1, nlh, portid);
blocking_notifier_call_chain(&inetaddr_chain, NETDEV_DOWN, ifa1);
@@ -476,6 +479,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh,
ifa->ifa_next = *ifap;
*ifap = ifa;
+ trace_ipv4_add_addr(ifa, in_dev);
inet_hash_insert(dev_net(in_dev->dev), ifa);
cancel_delayed_work(&check_lifetime_work);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f7c8bbeb27b7..294cb618baf5 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -90,6 +90,7 @@
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/export.h>
+#include <trace/events/ipv6.h>
/* Set to 3 to get tracing... */
#define ACONF_DEBUG 2
@@ -874,6 +875,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
in6_dev_hold(idev);
/* For caller */
in6_ifa_hold(ifa);
+ trace_ipv6_add_addr(ifa);
/* Add to big hash table */
hash = inet6_addr_hash(addr);
@@ -1658,8 +1660,10 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp, int dad_failed)
} else {
spin_unlock_bh(&ifp->lock);
}
+ trace_ipv6_del_addr(ifp);
ipv6_del_addr(ifp);
} else {
+ trace_ipv6_del_addr(ifp);
ipv6_del_addr(ifp);
}
}
--
1.9.3 (Apple Git-50)
next prev parent reply other threads:[~2014-12-22 17:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 15:10 David Ahern
2014-12-18 15:52 ` Arnaldo Carvalho de Melo
2014-12-18 15:59 ` David Ahern
2014-12-18 16:27 ` Steven Rostedt
2014-12-18 22:16 ` Arnaldo Carvalho de Melo
2014-12-18 22:50 ` David Ahern
2014-12-18 21:45 ` Valdis.Kletnieks
2014-12-18 22:13 ` David Ahern
2014-12-19 1:41 ` David Ahern
2014-12-22 17:01 ` Jiri Olsa
2014-12-22 17:10 ` David Ahern [this message]
2014-12-22 17:28 ` Jiri Olsa
-- strict thread matches above, loose matches on Subject: below --
2014-12-17 20:29 David Ahern
2014-12-18 4:26 ` Namhyung Kim
2014-12-18 4:32 ` David Ahern
2014-12-18 5:04 ` Namhyung Kim
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=5498506A.4010100@gmail.com \
--to=dsahern@gmail.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=acme@kernel.org \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--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
Powered by JetHome