From patchwork Tue Jan 27 14:07:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Horman X-Patchwork-Id: 20453 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 10A0ADE0E9 for ; Wed, 28 Jan 2009 01:07:25 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753368AbZA0OHQ (ORCPT ); Tue, 27 Jan 2009 09:07:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753358AbZA0OHQ (ORCPT ); Tue, 27 Jan 2009 09:07:16 -0500 Received: from charlotte.tuxdriver.com ([70.61.120.58]:55184 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753333AbZA0OHO (ORCPT ); Tue, 27 Jan 2009 09:07:14 -0500 Received: from nat-pool-rdu.redhat.com ([66.187.233.202] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1LRoas-0002Tq-D1; Tue, 27 Jan 2009 09:07:11 -0500 Date: Tue, 27 Jan 2009 09:07:03 -0500 From: Neil Horman To: David Miller Cc: acme@redhat.com, netdev@vger.kernel.org Subject: Re: [PATCH] net: add tracepoints to socket api Message-ID: <20090127140703.GA14432@hmsreliant.think-freely.org> References: <20090126195930.GA28208@hmsreliant.think-freely.org> <20090126.172253.25010769.davem@davemloft.net> <20090127013127.GB25660@ghostprotocols.net> <20090126.215703.115893965.davem@davemloft.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090126.215703.115893965.davem@davemloft.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam-Score: -1.4 (-) X-Spam-Status: No Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, Jan 26, 2009 at 09:57:03PM -0800, David Miller wrote: > From: Arnaldo Carvalho de Melo > Date: Mon, 26 Jan 2009 23:31:27 -0200 > > > Em Mon, Jan 26, 2009 at 05:22:53PM -0800, David Miller escreveu: > > > From: Neil Horman > > > Date: Mon, 26 Jan 2009 14:59:30 -0500 > > > > > > > @@ -95,6 +95,7 @@ > > > > > > > > #include > > > > #include > > > > +#include > > > > > > Where is this mysterious include/trace/socket.h file? > > > I can't seem to find it :-) > > > > Its something along the lines of include/trace/block.h, with the > > DECLARE_TRACE that match the DEFINE_TRACE entries he added, probably he > > forgot to git-add this new file :-) > > I kind of figured as much, so now Neil just needs to respin his > patch with the relevant bits of that header file included. > Here we go, same patch as before, just adding our missing wayward header file. Sorry for the noise. I've been working for a bit with the various tracepoints that have been developed in the lttng tree. The infrastructure is available in the main line kernel. All thats missing are the tracepoints themselves. While some seem to be contentious for various reasons, most seem benign, and can be rather usefull, so I was thinking we could start importing Some for the net stack. Heres a patch for the top level socket api tracepoints. If these are acceptable, I'll begin porting over the rest for the remainder of the network stack. This patch applies cleanly against the net-next tree. Signed-off-by: Neil Horman include/trace/socket.h | 26 ++++++++++++++++++++++++++ net/socket.c | 12 ++++++++++++ 2 files changed, 38 insertions(+) --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/trace/socket.h b/include/trace/socket.h new file mode 100644 index 0000000..60f216c --- /dev/null +++ b/include/trace/socket.h @@ -0,0 +1,26 @@ +#ifndef _TRACE_SOCKET_H +#define _TRACE_SOCKET_H + +#include +#include + +DECLARE_TRACE(socket_sendmsg, + TPPROTO(struct socket *sock, struct msghdr *msg, size_t size, int ret), + TPARGS(sock, msg, size, ret)); +DECLARE_TRACE(socket_recvmsg, + TPPROTO(struct socket *sock, struct msghdr *msg, size_t size, int flags, + int ret), + TPARGS(sock, msg, size, flags, ret)); +DECLARE_TRACE(socket_create, + TPPROTO(struct socket *sock, int fd), + TPARGS(sock, fd)); +/* + * socket_call + * + * TODO : This tracepoint should be expanded to cover each element of the + * switch in sys_socketcall(). + */ +DECLARE_TRACE(socket_call, + TPPROTO(int call, unsigned long a0), + TPARGS(call, a0)); +#endif diff --git a/net/socket.c b/net/socket.c index 35dd737..6cf37f8 100644 --- a/net/socket.c +++ b/net/socket.c @@ -95,6 +95,7 @@ #include #include +#include static int sock_no_open(struct inode *irrelevant, struct file *dontcare); static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov, @@ -155,6 +156,11 @@ static const struct net_proto_family *net_families[NPROTO] __read_mostly; static DEFINE_PER_CPU(int, sockets_in_use) = 0; +DEFINE_TRACE(socket_sendmsg); +DEFINE_TRACE(socket_recvmsg); +DEFINE_TRACE(socket_create); +DEFINE_TRACE(socket_call); + /* * Support routines. * Move socket addresses back and forth across the kernel/user @@ -574,6 +580,7 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) ret = __sock_sendmsg(&iocb, sock, msg, size); if (-EIOCBQUEUED == ret) ret = wait_on_sync_kiocb(&iocb); + trace_socket_sendmsg(sock, msg, size, ret); return ret; } @@ -653,10 +660,12 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg, int ret; init_sync_kiocb(&iocb, NULL); + iocb.private = &siocb; ret = __sock_recvmsg(&iocb, sock, msg, size, flags); if (-EIOCBQUEUED == ret) ret = wait_on_sync_kiocb(&iocb); + trace_socket_recvmsg(sock, msg, size, flags, ret); return ret; } @@ -1242,6 +1251,7 @@ SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) if (retval < 0) goto out_release; + trace_socket_create(sock, retval); out: /* It may be already another descriptor 8) Not kernel problem. */ return retval; @@ -2064,6 +2074,8 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) a0 = a[0]; a1 = a[1]; + trace_socket_call(call, a0); + switch (call) { case SYS_SOCKET: err = sys_socket(a0, a1, a[2]);