Commit 0fde882f authored by David Howells's avatar David Howells
Browse files

rxrpc: trace: Don't use __builtin_return_address for rxrpc_local tracing



In rxrpc tracing, use enums to generate lists of points of interest rather
than __builtin_return_address() for the rxrpc_local tracepoint

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
parent f14febd8
Loading
Loading
Loading
Loading
+36 −13
Original line number Diff line number Diff line
@@ -32,12 +32,35 @@
	E_(rxrpc_skb_unshared_nomem,		"US0")

#define rxrpc_local_traces \
	EM(rxrpc_local_got,			"GOT") \
	EM(rxrpc_local_free,			"FREE        ") \
	EM(rxrpc_local_get_client_conn,		"GET conn-cln") \
	EM(rxrpc_local_get_for_use,		"GET for-use ") \
	EM(rxrpc_local_get_peer,		"GET peer    ") \
	EM(rxrpc_local_get_prealloc_conn,	"GET conn-pre") \
	EM(rxrpc_local_get_queue,		"GET queue   ") \
	EM(rxrpc_local_new,			"NEW         ") \
	EM(rxrpc_local_processing,		"PRO") \
	EM(rxrpc_local_put,			"PUT") \
	EM(rxrpc_local_queued,			"QUE") \
	E_(rxrpc_local_tx_ack,			"TAK")
	EM(rxrpc_local_processing,		"PROCESSING  ") \
	EM(rxrpc_local_put_already_queued,	"PUT alreadyq") \
	EM(rxrpc_local_put_bind,		"PUT bind    ") \
	EM(rxrpc_local_put_for_use,		"PUT for-use ") \
	EM(rxrpc_local_put_kill_conn,		"PUT conn-kil") \
	EM(rxrpc_local_put_peer,		"PUT peer    ") \
	EM(rxrpc_local_put_prealloc_conn,	"PUT conn-pre") \
	EM(rxrpc_local_put_release_sock,	"PUT rel-sock") \
	EM(rxrpc_local_put_queue,		"PUT queue   ") \
	EM(rxrpc_local_queued,			"QUEUED      ") \
	EM(rxrpc_local_see_tx_ack,		"SEE tx-ack  ") \
	EM(rxrpc_local_stop,			"STOP        ") \
	EM(rxrpc_local_stopped,			"STOPPED     ") \
	EM(rxrpc_local_unuse_bind,		"UNU bind    ") \
	EM(rxrpc_local_unuse_conn_work,		"UNU conn-wrk") \
	EM(rxrpc_local_unuse_peer_keepalive,	"UNU peer-kpa") \
	EM(rxrpc_local_unuse_release_sock,	"UNU rel-sock") \
	EM(rxrpc_local_unuse_work,		"UNU work    ") \
	EM(rxrpc_local_use_conn_work,		"USE conn-wrk") \
	EM(rxrpc_local_use_lookup,		"USE lookup  ") \
	EM(rxrpc_local_use_peer_keepalive,	"USE peer-kpa") \
	E_(rxrpc_local_use_work,		"USE work    ")

#define rxrpc_peer_traces \
	EM(rxrpc_peer_got,			"GOT") \
@@ -345,29 +368,29 @@ rxrpc_txqueue_traces;

TRACE_EVENT(rxrpc_local,
	    TP_PROTO(unsigned int local_debug_id, enum rxrpc_local_trace op,
		     int usage, const void *where),
		     int ref, int usage),

	    TP_ARGS(local_debug_id, op, usage, where),
	    TP_ARGS(local_debug_id, op, ref, usage),

	    TP_STRUCT__entry(
		    __field(unsigned int,	local		)
		    __field(int,		op		)
		    __field(int,		ref		)
		    __field(int,		usage		)
		    __field(const void *,	where		)
			     ),

	    TP_fast_assign(
		    __entry->local = local_debug_id;
		    __entry->op = op;
		    __entry->ref = ref;
		    __entry->usage = usage;
		    __entry->where = where;
			   ),

	    TP_printk("L=%08x %s u=%d sp=%pSR",
	    TP_printk("L=%08x %s r=%d u=%d",
		      __entry->local,
		      __print_symbolic(__entry->op, rxrpc_local_traces),
		      __entry->usage,
		      __entry->where)
		      __entry->ref,
		      __entry->usage)
	    );

TRACE_EVENT(rxrpc_peer,
+4 −4
Original line number Diff line number Diff line
@@ -194,8 +194,8 @@ static int rxrpc_bind(struct socket *sock, struct sockaddr *saddr, int len)

service_in_use:
	write_unlock(&local->services_lock);
	rxrpc_unuse_local(local);
	rxrpc_put_local(local);
	rxrpc_unuse_local(local, rxrpc_local_unuse_bind);
	rxrpc_put_local(local, rxrpc_local_put_bind);
	ret = -EADDRINUSE;
error_unlock:
	release_sock(&rx->sk);
@@ -888,8 +888,8 @@ static int rxrpc_release_sock(struct sock *sk)
	flush_workqueue(rxrpc_workqueue);
	rxrpc_purge_queue(&sk->sk_receive_queue);

	rxrpc_unuse_local(rx->local);
	rxrpc_put_local(rx->local);
	rxrpc_unuse_local(rx->local, rxrpc_local_unuse_release_sock);
	rxrpc_put_local(rx->local, rxrpc_local_put_release_sock);
	rx->local = NULL;
	key_put(rx->key);
	rx->key = NULL;
+32 −9
Original line number Diff line number Diff line
@@ -979,22 +979,45 @@ extern void rxrpc_process_local_events(struct rxrpc_local *);
 * local_object.c
 */
struct rxrpc_local *rxrpc_lookup_local(struct net *, const struct sockaddr_rxrpc *);
struct rxrpc_local *rxrpc_get_local(struct rxrpc_local *);
struct rxrpc_local *rxrpc_get_local_maybe(struct rxrpc_local *);
void rxrpc_put_local(struct rxrpc_local *);
struct rxrpc_local *rxrpc_use_local(struct rxrpc_local *);
void rxrpc_unuse_local(struct rxrpc_local *);
struct rxrpc_local *rxrpc_get_local(struct rxrpc_local *, enum rxrpc_local_trace);
struct rxrpc_local *rxrpc_get_local_maybe(struct rxrpc_local *, enum rxrpc_local_trace);
void rxrpc_put_local(struct rxrpc_local *, enum rxrpc_local_trace);
struct rxrpc_local *rxrpc_use_local(struct rxrpc_local *, enum rxrpc_local_trace);
void rxrpc_unuse_local(struct rxrpc_local *, enum rxrpc_local_trace);
void rxrpc_queue_local(struct rxrpc_local *);
void rxrpc_destroy_all_locals(struct rxrpc_net *);

static inline bool __rxrpc_unuse_local(struct rxrpc_local *local)
static inline bool __rxrpc_unuse_local(struct rxrpc_local *local,
				       enum rxrpc_local_trace why)
{
	return atomic_dec_return(&local->active_users) == 0;
	unsigned int debug_id = local->debug_id;
	int r, u;

	r = refcount_read(&local->ref);
	u = atomic_dec_return(&local->active_users);
	trace_rxrpc_local(debug_id, why, r, u);
	return u == 0;
}

static inline bool __rxrpc_use_local(struct rxrpc_local *local,
				     enum rxrpc_local_trace why)
{
	int r, u;

	r = refcount_read(&local->ref);
	u = atomic_fetch_add_unless(&local->active_users, 1, 0);
	trace_rxrpc_local(local->debug_id, why, r, u);
	return u != 0;
}

static inline bool __rxrpc_use_local(struct rxrpc_local *local)
static inline void rxrpc_see_local(struct rxrpc_local *local,
				   enum rxrpc_local_trace why)
{
	return atomic_fetch_add_unless(&local->active_users, 1, 0) != 0;
	int r, u;

	r = refcount_read(&local->ref);
	u = atomic_read(&local->active_users);
	trace_rxrpc_local(local->debug_id, why, r, u);
}

/*
+2 −2
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ void rxrpc_discard_prealloc(struct rxrpc_sock *rx)
	tail = b->peer_backlog_tail;
	while (CIRC_CNT(head, tail, size) > 0) {
		struct rxrpc_peer *peer = b->peer_backlog[tail];
		rxrpc_put_local(peer->local);
		rxrpc_put_local(peer->local, rxrpc_local_put_prealloc_conn);
		kfree(peer);
		tail = (tail + 1) & (size - 1);
	}
@@ -305,7 +305,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx,
		b->conn_backlog[conn_tail] = NULL;
		smp_store_release(&b->conn_backlog_tail,
				  (conn_tail + 1) & (RXRPC_BACKLOG_MAX - 1));
		conn->local = rxrpc_get_local(local);
		conn->local = rxrpc_get_local(local, rxrpc_local_get_prealloc_conn);
		conn->peer = peer;
		rxrpc_see_connection(conn);
		rxrpc_new_incoming_connection(rx, conn, sec, skb);
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ void rxrpc_send_ACK(struct rxrpc_call *call, u8 ack_reason,
	if (in_task()) {
		rxrpc_transmit_ack_packets(call->peer->local);
	} else {
		rxrpc_get_local(local);
		rxrpc_get_local(local, rxrpc_local_get_queue);
		rxrpc_queue_local(local);
	}
}
Loading