Linux NFS development
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 8/8] SUNRPC: Display symbolic function addresses in rpc_show_tasks
Date: Tue, 20 May 2008 17:11:32 -0400	[thread overview]
Message-ID: <1211317892.26809.8.camel@localhost> (raw)
In-Reply-To: <20080520203018.3851.21166.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>

On Tue, 2008-05-20 at 16:30 -0400, Chuck Lever wrote:
> For each running RPC task, rpc_show_tasks displays the hex address of=
 the
> call_foo function that the task is running.  To make debugging slight=
ly
> nicer, let's display the call_foo function name instead.
>=20
> Sample output:
>=20
>  -pid- flgs status -client- --rqstp- -timeout ---ops--
>  27915 0001      0 ee84a460 eedf00d0    60000 f8fa677c nfs3 COMMIT ac=
t:status wq:xprt_pending
>  27918 0080      0 ee84a460 eedf0000    60000 f8d527a8 nfs3 SETATTR a=
ct:status wq:xprt_pending
>=20
>  -pid- flgs status -client- --rqstp- -timeout ---ops--
>  60859 0001      0 ee84a460 eedf00d0        0 f8fa66c8 nfs3 READ act:=
status
>  60860 0080      0 ee84a460 eedf0000        0 f8d527a8 nfs3 GETATTR a=
ct:status
>=20
>=20
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>=20
>  include/linux/sunrpc/sched.h |    1 +
>  net/sunrpc/clnt.c            |   52 ++++++++++++++++++++++++++++++++=
+++++++---
>  net/sunrpc/sched.c           |    2 +-
>  3 files changed, 50 insertions(+), 5 deletions(-)
>=20
>=20
> diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sche=
d.h
> index d1a5c8c..108342e 100644
> --- a/include/linux/sunrpc/sched.h
> +++ b/include/linux/sunrpc/sched.h
> @@ -212,6 +212,7 @@ struct rpc_wait_queue {
>  struct rpc_task *rpc_new_task(const struct rpc_task_setup *);
>  struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
>  void		rpc_put_task(struct rpc_task *);
> +void		rpc_prepare_task(struct rpc_task *);
>  void		rpc_exit_task(struct rpc_task *);
>  void		rpc_release_calldata(const struct rpc_call_ops *, void *);
>  void		rpc_killall_tasks(struct rpc_clnt *);
> diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
> index c33d727..ec9c072 100644
> --- a/net/sunrpc/clnt.c
> +++ b/net/sunrpc/clnt.c
> @@ -1510,24 +1510,68 @@ struct rpc_task *rpc_call_null(struct rpc_cln=
t *clnt, struct rpc_cred *cred, int
>  EXPORT_SYMBOL_GPL(rpc_call_null);
> =20
>  #ifdef RPC_DEBUG
> +/*
> + * To make it easier to tell what action each running RPC task
> + * is executing, use a table to map the content of tk_action to
> + * a human-readable name.  This uses a little extra memory, but
> + * causes no additional run-time overhead per RPC request.
> + */
> +typedef void   (*rpc_task_action)(struct rpc_task *);
> +
> +static struct {
> +	rpc_task_action		action;
> +	const char		*name;
> +} rpc_action_table[] =3D {
> +	{ rpc_prepare_task,		"prepare"		},
> +	{ call_start,			"start"			},
> +	{ call_reserve,			"reserve"		},
> +	{ call_reserveresult,		"reserveresult"		},
> +	{ call_allocate,		"allocate"		},
> +	{ call_bind,			"bind"			},
> +	{ call_bind_status,		"bindstatus"		},
> +	{ call_connect,			"connect"		},
> +	{ call_connect_status,		"connectstatus"		},
> +	{ call_transmit,		"transmit"		},
> +	{ call_transmit_status,		"transmitstatus"	},
> +	{ call_status,			"status"		},
> +	{ call_timeout,			"timeout"		},
> +	{ call_decode,			"decode"		},
> +	{ call_refresh,			"refresh"		},
> +	{ call_refreshresult,		"refreshresult"		},
> +	{ rpc_exit_task,		"exit"			},
> +	{ NULL,				"null"			},
> +};
>
> +
> +static const char *rpc_show_action(rpc_task_action action)
> +{
> +	unsigned int i;
> +
> +	for (i =3D 0; i <=3D ARRAY_SIZE(rpc_action_table); i++)
> +		if (rpc_action_table[i].action =3D=3D action)
> +			return rpc_action_table[i].name;
> +
> +	return "unknown";
> +}

=EF=BB=BF
NACK. Maintaining tables like the above in the long run is a nightmare.
What's more, by eliminating the printout of the actual pointer you are
potentially replacing useful information that could otherwise easily be
looked up using /proc/kallsyms with "unknown".

The above translation could easily be done using a simple script in
userspace instead.


--=20
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com

  parent reply	other threads:[~2008-05-20 21:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-20 20:29 [PATCH 0/8] Initial set of 2.6.27 patches, take 2 Chuck Lever
     [not found] ` <20080520202108.3851.7464.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-20 20:29   ` [PATCH 1/8] NFS: Update help text for CONFIG_NFS_FS Chuck Lever
2008-05-20 20:29   ` [PATCH 2/8] SUNRPC: Use RPC procedure name in call_start Chuck Lever
2008-05-20 20:29   ` [PATCH 3/8] SUNRPC: Use RPC procedure name in call_verify Chuck Lever
     [not found]     ` <20080520202941.3851.61861.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-20 21:21       ` Trond Myklebust
2008-05-20 21:39         ` Chuck Lever
2008-05-20 21:56           ` Trond Myklebust
2008-05-21 12:14           ` Peter Staubach
2008-05-21 12:24             ` Talpey, Thomas
     [not found]               ` <RTPCLUEXC1-PRDQrwFN00000141-rtwIt2gI0FxT+ZUat5FNkAK/GNPrWCqfQQ4Iyu8u01E@public.gmane.org>
2008-05-21 12:38                 ` Peter Staubach
2008-05-21 15:27                   ` Robert Gordon
     [not found]                     ` <E3DF41A5-5DBA-42CE-ADE2-FAE8AC5E4722-UdXhSnd/wVw@public.gmane.org>
2008-05-21 16:02                       ` Peter Staubach
2008-05-21 16:57             ` Chuck Lever
2008-05-20 20:29   ` [PATCH 4/8] SUNRPC: Don't display the rpc_show_tasks header if there are no tasks Chuck Lever
2008-05-20 20:29   ` [PATCH 5/8] SUNRPC: Refactor rpc_show_tasks Chuck Lever
2008-05-20 20:30   ` [PATCH 6/8] SUNRPC: Display some debugging information as text rather than numbers Chuck Lever
2008-05-20 20:30   ` [PATCH 7/8] SUNRPC: Rename "call_" functions that are no longer FSM states Chuck Lever
2008-05-20 20:30   ` [PATCH 8/8] SUNRPC: Display symbolic function addresses in rpc_show_tasks Chuck Lever
     [not found]     ` <20080520203018.3851.21166.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-20 21:11       ` Trond Myklebust [this message]
2008-05-20 21:37         ` Chuck Lever
2008-05-20 21:42           ` Trond Myklebust
  -- strict thread matches above, loose matches on Subject: below --
2008-05-18  2:16 [PATCH 0/8] First set of 2.6.27 patches Chuck Lever
     [not found] ` <20080518021241.8366.12464.stgit-ewv44WTpT0t9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2008-05-18  2:17   ` [PATCH 8/8] SUNRPC: Display symbolic function addresses in rpc_show_tasks Chuck Lever

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=1211317892.26809.8.camel@localhost \
    --to=trond.myklebust@netapp.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@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