Skip to content

Commit

Permalink
Merge tag 'rxrpc-rewrite-20160917-2' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/dhowells/linux-fs

David Howells says:

====================
rxrpc: Tracepoint addition and improvement

Here is a set of patches that add some more tracepoints and improve a couple
of existing ones.  New additions include:

 (1) Connection refcount tracking.

 (2) Client connection state machine tracking.

 (3) Tx and Rx packet lifecycle.

 (4) ACK reception and transmission.

 (5) recvmsg processing.

Updates include:

 (1) Print the symbolic packet name in the Rx packet tracepoint.

 (2) Additional call refcount trace events.

 (3) Improvements to sk_buff tracking with AF_RXRPC.

In addition:

 (1) Config option to inject packet loss during both transmission and
     reception.

 (2) Removal of some printks.

This series needs to be applied on top of the previously posted fixes.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 19, 2016
2 parents 5b0c6fc + 8a681c3 commit e867e87
Show file tree
Hide file tree
Showing 19 changed files with 740 additions and 150 deletions.
226 changes: 216 additions & 10 deletions include/trace/events/rxrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,66 @@

#include <linux/tracepoint.h>

TRACE_EVENT(rxrpc_conn,
TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op,
int usage, const void *where),

TP_ARGS(conn, op, usage, where),

TP_STRUCT__entry(
__field(struct rxrpc_connection *, conn )
__field(int, op )
__field(int, usage )
__field(const void *, where )
),

TP_fast_assign(
__entry->conn = conn;
__entry->op = op;
__entry->usage = usage;
__entry->where = where;
),

TP_printk("C=%p %s u=%d sp=%pSR",
__entry->conn,
rxrpc_conn_traces[__entry->op],
__entry->usage,
__entry->where)
);

TRACE_EVENT(rxrpc_client,
TP_PROTO(struct rxrpc_connection *conn, int channel,
enum rxrpc_client_trace op),

TP_ARGS(conn, channel, op),

TP_STRUCT__entry(
__field(struct rxrpc_connection *, conn )
__field(u32, cid )
__field(int, channel )
__field(int, usage )
__field(enum rxrpc_client_trace, op )
__field(enum rxrpc_conn_cache_state, cs )
),

TP_fast_assign(
__entry->conn = conn;
__entry->channel = channel;
__entry->usage = atomic_read(&conn->usage);
__entry->op = op;
__entry->cid = conn->proto.cid;
__entry->cs = conn->cache_state;
),

TP_printk("C=%p h=%2d %s %s i=%08x u=%d",
__entry->conn,
__entry->channel,
rxrpc_client_traces[__entry->op],
rxrpc_conn_cache_states[__entry->cs],
__entry->cid,
__entry->usage)
);

TRACE_EVENT(rxrpc_call,
TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op,
int usage, const void *where, const void *aux),
Expand Down Expand Up @@ -47,14 +107,14 @@ TRACE_EVENT(rxrpc_call,
);

TRACE_EVENT(rxrpc_skb,
TP_PROTO(struct sk_buff *skb, int op, int usage, int mod_count,
const void *where),
TP_PROTO(struct sk_buff *skb, enum rxrpc_skb_trace op,
int usage, int mod_count, const void *where),

TP_ARGS(skb, op, usage, mod_count, where),

TP_STRUCT__entry(
__field(struct sk_buff *, skb )
__field(int, op )
__field(enum rxrpc_skb_trace, op )
__field(int, usage )
__field(int, mod_count )
__field(const void *, where )
Expand All @@ -70,11 +130,7 @@ TRACE_EVENT(rxrpc_skb,

TP_printk("s=%p %s u=%d m=%d p=%pSR",
__entry->skb,
(__entry->op == 0 ? "NEW" :
__entry->op == 1 ? "SEE" :
__entry->op == 2 ? "GET" :
__entry->op == 3 ? "FRE" :
"PUR"),
rxrpc_skb_traces[__entry->op],
__entry->usage,
__entry->mod_count,
__entry->where)
Expand All @@ -93,11 +149,12 @@ TRACE_EVENT(rxrpc_rx_packet,
memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
),

TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x",
TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s",
__entry->hdr.epoch, __entry->hdr.cid,
__entry->hdr.callNumber, __entry->hdr.serviceId,
__entry->hdr.serial, __entry->hdr.seq,
__entry->hdr.type, __entry->hdr.flags)
__entry->hdr.type, __entry->hdr.flags,
__entry->hdr.type <= 15 ? rxrpc_pkts[__entry->hdr.type] : "?UNK")
);

TRACE_EVENT(rxrpc_rx_done,
Expand Down Expand Up @@ -147,6 +204,155 @@ TRACE_EVENT(rxrpc_abort,
__entry->abort_code, __entry->error, __entry->why)
);

TRACE_EVENT(rxrpc_transmit,
TP_PROTO(struct rxrpc_call *call, enum rxrpc_transmit_trace why),

TP_ARGS(call, why),

TP_STRUCT__entry(
__field(struct rxrpc_call *, call )
__field(enum rxrpc_transmit_trace, why )
__field(rxrpc_seq_t, tx_hard_ack )
__field(rxrpc_seq_t, tx_top )
),

TP_fast_assign(
__entry->call = call;
__entry->why = why;
__entry->tx_hard_ack = call->tx_hard_ack;
__entry->tx_top = call->tx_top;
),

TP_printk("c=%p %s f=%08x n=%u",
__entry->call,
rxrpc_transmit_traces[__entry->why],
__entry->tx_hard_ack + 1,
__entry->tx_top - __entry->tx_hard_ack)
);

TRACE_EVENT(rxrpc_rx_ack,
TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t first, u8 reason, u8 n_acks),

TP_ARGS(call, first, reason, n_acks),

TP_STRUCT__entry(
__field(struct rxrpc_call *, call )
__field(rxrpc_seq_t, first )
__field(u8, reason )
__field(u8, n_acks )
),

TP_fast_assign(
__entry->call = call;
__entry->first = first;
__entry->reason = reason;
__entry->n_acks = n_acks;
),

TP_printk("c=%p %s f=%08x n=%u",
__entry->call,
rxrpc_acks(__entry->reason),
__entry->first,
__entry->n_acks)
);

TRACE_EVENT(rxrpc_tx_ack,
TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t first,
rxrpc_serial_t serial, u8 reason, u8 n_acks),

TP_ARGS(call, first, serial, reason, n_acks),

TP_STRUCT__entry(
__field(struct rxrpc_call *, call )
__field(rxrpc_seq_t, first )
__field(rxrpc_serial_t, serial )
__field(u8, reason )
__field(u8, n_acks )
),

TP_fast_assign(
__entry->call = call;
__entry->first = first;
__entry->serial = serial;
__entry->reason = reason;
__entry->n_acks = n_acks;
),

TP_printk("c=%p %s f=%08x r=%08x n=%u",
__entry->call,
rxrpc_acks(__entry->reason),
__entry->first,
__entry->serial,
__entry->n_acks)
);

TRACE_EVENT(rxrpc_receive,
TP_PROTO(struct rxrpc_call *call, enum rxrpc_receive_trace why,
rxrpc_serial_t serial, rxrpc_seq_t seq),

TP_ARGS(call, why, serial, seq),

TP_STRUCT__entry(
__field(struct rxrpc_call *, call )
__field(enum rxrpc_receive_trace, why )
__field(rxrpc_serial_t, serial )
__field(rxrpc_seq_t, seq )
__field(rxrpc_seq_t, hard_ack )
__field(rxrpc_seq_t, top )
),

TP_fast_assign(
__entry->call = call;
__entry->why = why;
__entry->serial = serial;
__entry->seq = seq;
__entry->hard_ack = call->rx_hard_ack;
__entry->top = call->rx_top;
),

TP_printk("c=%p %s r=%08x q=%08x w=%08x-%08x",
__entry->call,
rxrpc_receive_traces[__entry->why],
__entry->serial,
__entry->seq,
__entry->hard_ack,
__entry->top)
);

TRACE_EVENT(rxrpc_recvmsg,
TP_PROTO(struct rxrpc_call *call, enum rxrpc_recvmsg_trace why,
rxrpc_seq_t seq, unsigned int offset, unsigned int len,
int ret),

TP_ARGS(call, why, seq, offset, len, ret),

TP_STRUCT__entry(
__field(struct rxrpc_call *, call )
__field(enum rxrpc_recvmsg_trace, why )
__field(rxrpc_seq_t, seq )
__field(unsigned int, offset )
__field(unsigned int, len )
__field(int, ret )
),

TP_fast_assign(
__entry->call = call;
__entry->why = why;
__entry->seq = seq;
__entry->offset = offset;
__entry->len = len;
__entry->ret = ret;
),

TP_printk("c=%p %s q=%08x o=%u l=%u ret=%d",
__entry->call,
rxrpc_recvmsg_traces[__entry->why],
__entry->seq,
__entry->offset,
__entry->len,
__entry->ret)
);

#endif /* _TRACE_RXRPC_H */

/* This part must be outside protection */
Expand Down
7 changes: 7 additions & 0 deletions net/rxrpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ config AF_RXRPC_IPV6
Say Y here to allow AF_RXRPC to use IPV6 UDP as well as IPV4 UDP as
its network transport.

config AF_RXRPC_INJECT_LOSS
bool "Inject packet loss into RxRPC packet stream"
depends on AF_RXRPC
help
Say Y here to inject packet loss by discarding some received and some
transmitted packets.


config AF_RXRPC_DEBUG
bool "RxRPC dynamic debugging"
Expand Down
5 changes: 3 additions & 2 deletions net/rxrpc/af_rxrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ u32 rxrpc_epoch;
atomic_t rxrpc_debug_id;

/* count of skbs currently in use */
atomic_t rxrpc_n_skbs;
atomic_t rxrpc_n_tx_skbs, rxrpc_n_rx_skbs;

struct workqueue_struct *rxrpc_workqueue;

Expand Down Expand Up @@ -867,7 +867,8 @@ static void __exit af_rxrpc_exit(void)
proto_unregister(&rxrpc_proto);
rxrpc_destroy_all_calls();
rxrpc_destroy_all_connections();
ASSERTCMP(atomic_read(&rxrpc_n_skbs), ==, 0);
ASSERTCMP(atomic_read(&rxrpc_n_tx_skbs), ==, 0);
ASSERTCMP(atomic_read(&rxrpc_n_rx_skbs), ==, 0);
rxrpc_destroy_all_locals();

remove_proc_entry("rxrpc_conns", init_net.proc_net);
Expand Down
Loading

0 comments on commit e867e87

Please sign in to comment.