Commit fff72429 authored by David Howells's avatar David Howells
Browse files

rxrpc: Improve the call tracking tracepoint



Improve the call tracking tracepoint by showing more differentiation
between some of the put and get events, including:

  (1) Getting and putting refs for the socket call user ID tree.

  (2) Getting and putting refs for queueing and failing to queue the call
      processor work item.

Note that these aren't necessarily used in this patch, but will be taken
advantage of in future patches.

An enum is added for the event subtype numbers rather than coding them
directly as decimal numbers and a table of 3-letter strings is provided
rather than a sequence of ?: operators.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent e796cb41
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
#include <linux/tracepoint.h>

TRACE_EVENT(rxrpc_call,
	    TP_PROTO(struct rxrpc_call *call, int op, int usage, int nskb,
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op,
		     int usage, int nskb,
		     const void *where, const void *aux),

	    TP_ARGS(call, op, usage, nskb, where, aux),
@@ -42,13 +43,7 @@ TRACE_EVENT(rxrpc_call,

	    TP_printk("c=%p %s u=%d s=%d p=%pSR a=%p",
		      __entry->call,
		      (__entry->op == 0 ? "NWc" :
		       __entry->op == 1 ? "NWs" :
		       __entry->op == 2 ? "SEE" :
		       __entry->op == 3 ? "GET" :
		       __entry->op == 4 ? "Gsb" :
		       __entry->op == 5 ? "PUT" :
		       "Psb"),
		      rxrpc_call_traces[__entry->op],
		      __entry->usage,
		      __entry->nskb,
		      __entry->where,
+1 −1
Original line number Diff line number Diff line
@@ -296,7 +296,7 @@ void rxrpc_kernel_end_call(struct socket *sock, struct rxrpc_call *call)
	_enter("%d{%d}", call->debug_id, atomic_read(&call->usage));
	rxrpc_remove_user_ID(rxrpc_sk(sock->sk), call);
	rxrpc_purge_queue(&call->knlrecv_queue);
	rxrpc_put_call(call);
	rxrpc_put_call(call, rxrpc_call_put);
}
EXPORT_SYMBOL(rxrpc_kernel_end_call);

+20 −2
Original line number Diff line number Diff line
@@ -508,6 +508,24 @@ struct rxrpc_call {
	unsigned long		ackr_window[RXRPC_ACKR_WINDOW_ASZ + 1];
};

enum rxrpc_call_trace {
	rxrpc_call_new_client,
	rxrpc_call_new_service,
	rxrpc_call_queued,
	rxrpc_call_queued_ref,
	rxrpc_call_seen,
	rxrpc_call_got,
	rxrpc_call_got_skb,
	rxrpc_call_got_userid,
	rxrpc_call_put,
	rxrpc_call_put_skb,
	rxrpc_call_put_userid,
	rxrpc_call_put_noqueue,
	rxrpc_call__nr_trace
};

extern const char rxrpc_call_traces[rxrpc_call__nr_trace][4];

#include <trace/events/rxrpc.h>

/*
@@ -555,8 +573,8 @@ struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *,
void rxrpc_release_call(struct rxrpc_call *);
void rxrpc_release_calls_on_socket(struct rxrpc_sock *);
void rxrpc_see_call(struct rxrpc_call *);
void rxrpc_get_call(struct rxrpc_call *);
void rxrpc_put_call(struct rxrpc_call *);
void rxrpc_get_call(struct rxrpc_call *, enum rxrpc_call_trace);
void rxrpc_put_call(struct rxrpc_call *, enum rxrpc_call_trace);
void rxrpc_get_call_for_skb(struct rxrpc_call *, struct sk_buff *);
void rxrpc_put_call_for_skb(struct rxrpc_call *, struct sk_buff *);
void __exit rxrpc_destroy_all_calls(void);
+5 −5
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,

	write_lock(&rx->call_lock);
	if (!test_and_set_bit(RXRPC_CALL_INIT_ACCEPT, &call->flags)) {
		rxrpc_get_call(call);
		rxrpc_get_call(call, rxrpc_call_got);

		spin_lock(&call->conn->state_lock);
		if (sp->hdr.securityIndex > 0 &&
@@ -155,7 +155,7 @@ static int rxrpc_accept_incoming_call(struct rxrpc_local *local,
	_debug("done");
	read_unlock_bh(&local->services_lock);
	rxrpc_free_skb(notification);
	rxrpc_put_call(call);
	rxrpc_put_call(call, rxrpc_call_put);
	_leave(" = 0");
	return 0;

@@ -166,11 +166,11 @@ invalid_service:
	read_lock_bh(&call->state_lock);
	if (!test_bit(RXRPC_CALL_RELEASED, &call->flags) &&
	    !test_and_set_bit(RXRPC_CALL_EV_RELEASE, &call->events)) {
		rxrpc_get_call(call);
		rxrpc_get_call(call, rxrpc_call_got);
		rxrpc_queue_call(call);
	}
	read_unlock_bh(&call->state_lock);
	rxrpc_put_call(call);
	rxrpc_put_call(call, rxrpc_call_put);
	ret = -ECONNREFUSED;
error:
	rxrpc_free_skb(notification);
@@ -341,6 +341,7 @@ struct rxrpc_call *rxrpc_accept_call(struct rxrpc_sock *rx,
	}

	/* formalise the acceptance */
	rxrpc_get_call(call, rxrpc_call_got_userid);
	call->notify_rx = notify_rx;
	call->user_call_ID = user_call_ID;
	rb_link_node(&call->sock_node, parent, pp);
@@ -351,7 +352,6 @@ struct rxrpc_call *rxrpc_accept_call(struct rxrpc_sock *rx,
		BUG();
	rxrpc_queue_call(call);

	rxrpc_get_call(call);
	write_unlock_bh(&call->state_lock);
	write_unlock(&rx->call_lock);
	_leave(" = %p{%d}", call, call->debug_id);
+1 −1
Original line number Diff line number Diff line
@@ -1246,7 +1246,7 @@ send_message_2:
kill_ACKs:
	del_timer_sync(&call->ack_timer);
	if (test_and_clear_bit(RXRPC_CALL_EV_ACK_FINAL, &call->events))
		rxrpc_put_call(call);
		rxrpc_put_call(call, rxrpc_call_put);
	clear_bit(RXRPC_CALL_EV_ACK, &call->events);

maybe_reschedule:
Loading