[PATCH net-next 3/9] rxrpc: Add per-peer RTT tracker [ver #2]

2016-09-22 Thread David Howells
Add a function to track the average RTT for a peer.  Sources of RTT data
will be added in subsequent patches.

The RTT data will be useful in the future for determining resend timeouts
and for handling the slow-start part of the Rx protocol.

Also add a pair of tracepoints, one to log transmissions to elicit a
response for RTT purposes and one to log responses that contribute RTT
data.

Signed-off-by: David Howells 
---

 include/trace/events/rxrpc.h |   61 ++
 net/rxrpc/ar-internal.h  |   25 ++---
 net/rxrpc/misc.c |8 ++
 net/rxrpc/peer_event.c   |   41 
 4 files changed, 131 insertions(+), 4 deletions(-)

diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
index 75a5d8bf50e1..e8f2afbbe0bf 100644
--- a/include/trace/events/rxrpc.h
+++ b/include/trace/events/rxrpc.h
@@ -353,6 +353,67 @@ TRACE_EVENT(rxrpc_recvmsg,
  __entry->ret)
);
 
+TRACE_EVENT(rxrpc_rtt_tx,
+   TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
+rxrpc_serial_t send_serial),
+
+   TP_ARGS(call, why, send_serial),
+
+   TP_STRUCT__entry(
+   __field(struct rxrpc_call *,call)
+   __field(enum rxrpc_rtt_tx_trace,why )
+   __field(rxrpc_serial_t, send_serial )
+),
+
+   TP_fast_assign(
+   __entry->call = call;
+   __entry->why = why;
+   __entry->send_serial = send_serial;
+  ),
+
+   TP_printk("c=%p %s sr=%08x",
+ __entry->call,
+ rxrpc_rtt_tx_traces[__entry->why],
+ __entry->send_serial)
+   );
+
+TRACE_EVENT(rxrpc_rtt_rx,
+   TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
+rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
+s64 rtt, u8 nr, s64 avg),
+
+   TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),
+
+   TP_STRUCT__entry(
+   __field(struct rxrpc_call *,call)
+   __field(enum rxrpc_rtt_rx_trace,why )
+   __field(u8, nr  )
+   __field(rxrpc_serial_t, send_serial )
+   __field(rxrpc_serial_t, resp_serial )
+   __field(s64,rtt )
+   __field(u64,avg )
+),
+
+   TP_fast_assign(
+   __entry->call = call;
+   __entry->why = why;
+   __entry->send_serial = send_serial;
+   __entry->resp_serial = resp_serial;
+   __entry->rtt = rtt;
+   __entry->nr = nr;
+   __entry->avg = avg;
+  ),
+
+   TP_printk("c=%p %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
+ __entry->call,
+ rxrpc_rtt_rx_traces[__entry->why],
+ __entry->send_serial,
+ __entry->resp_serial,
+ __entry->rtt,
+ __entry->nr,
+ __entry->avg)
+   );
+
 #endif /* _TRACE_RXRPC_H */
 
 /* This part must be outside protection */
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index dcf54e3fb478..79c671e552c3 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -258,10 +258,11 @@ struct rxrpc_peer {
 
/* calculated RTT cache */
 #define RXRPC_RTT_CACHE_SIZE 32
-   suseconds_t rtt;/* current RTT estimate (in uS) 
*/
-   unsigned intrtt_point;  /* next entry at which to 
insert */
-   unsigned intrtt_usage;  /* amount of cache actually 
used */
-   suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated 
RTT cache */
+   u64 rtt;/* Current RTT estimate (in nS) 
*/
+   u64 rtt_sum;/* Sum of cache contents */
+   u64 rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* Determined 
RTT cache */
+   u8  rtt_cursor; /* next entry at which to 
insert */
+   u8  rtt_usage;  /* amount of cache actually 
used */
 };
 
 /*
@@ -657,6 +658,20 @@ enum rxrpc_recvmsg_trace {
 
 extern const char rxrpc_recvmsg_traces[rxrpc_recvmsg__nr_trace][5];
 
+enum rxrpc_rtt_tx_trace {
+   rxrpc_rtt_tx_ping,
+   rxrpc_rtt_tx__nr_trace
+};
+
+extern const char rxrpc_rtt_tx_traces[rxrpc_rtt_tx__nr_trace][5];
+
+enum rxrpc_rtt_rx_trace {
+   rxrpc_rtt_rx_ping_response,
+ 

Re: [PATCH net-next 3/9] rxrpc: Add per-peer RTT tracker

2016-09-21 Thread kbuild test robot
Hi David,

[auto build test ERROR on net-next/master]

url:
https://github.com/0day-ci/linux/commits/David-Howells/rxrpc-Preparation-for-slow-start-algorithm/20160922-085242
config: i386-randconfig-h0-09220655 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   net/built-in.o: In function `rxrpc_peer_add_rtt':
>> (.text+0x239e99): undefined reference to `__udivdi3'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH net-next 3/9] rxrpc: Add per-peer RTT tracker

2016-09-21 Thread kbuild test robot
Hi David,

[auto build test ERROR on net-next/master]

url:
https://github.com/0day-ci/linux/commits/David-Howells/rxrpc-Preparation-for-slow-start-algorithm/20160922-085242
config: arm-omap2plus_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> ERROR: "__aeabi_uldivmod" [net/rxrpc/af-rxrpc.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH net-next 3/9] rxrpc: Add per-peer RTT tracker

2016-09-21 Thread David Howells
Add a function to track the average RTT for a peer.  Sources of RTT data
will be added in subsequent patches.

The RTT data will be useful in the future for determining resend timeouts
and for handling the slow-start part of the Rx protocol.

Also add a pair of tracepoints, one to log transmissions to elicit a
response for RTT purposes and one to log responses that contribute RTT
data.

Signed-off-by: David Howells 
---

 include/trace/events/rxrpc.h |   61 ++
 net/rxrpc/ar-internal.h  |   25 ++---
 net/rxrpc/misc.c |8 ++
 net/rxrpc/peer_event.c   |   39 +++
 4 files changed, 129 insertions(+), 4 deletions(-)

diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h
index 75a5d8bf50e1..e8f2afbbe0bf 100644
--- a/include/trace/events/rxrpc.h
+++ b/include/trace/events/rxrpc.h
@@ -353,6 +353,67 @@ TRACE_EVENT(rxrpc_recvmsg,
  __entry->ret)
);
 
+TRACE_EVENT(rxrpc_rtt_tx,
+   TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
+rxrpc_serial_t send_serial),
+
+   TP_ARGS(call, why, send_serial),
+
+   TP_STRUCT__entry(
+   __field(struct rxrpc_call *,call)
+   __field(enum rxrpc_rtt_tx_trace,why )
+   __field(rxrpc_serial_t, send_serial )
+),
+
+   TP_fast_assign(
+   __entry->call = call;
+   __entry->why = why;
+   __entry->send_serial = send_serial;
+  ),
+
+   TP_printk("c=%p %s sr=%08x",
+ __entry->call,
+ rxrpc_rtt_tx_traces[__entry->why],
+ __entry->send_serial)
+   );
+
+TRACE_EVENT(rxrpc_rtt_rx,
+   TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
+rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
+s64 rtt, u8 nr, s64 avg),
+
+   TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),
+
+   TP_STRUCT__entry(
+   __field(struct rxrpc_call *,call)
+   __field(enum rxrpc_rtt_rx_trace,why )
+   __field(u8, nr  )
+   __field(rxrpc_serial_t, send_serial )
+   __field(rxrpc_serial_t, resp_serial )
+   __field(s64,rtt )
+   __field(u64,avg )
+),
+
+   TP_fast_assign(
+   __entry->call = call;
+   __entry->why = why;
+   __entry->send_serial = send_serial;
+   __entry->resp_serial = resp_serial;
+   __entry->rtt = rtt;
+   __entry->nr = nr;
+   __entry->avg = avg;
+  ),
+
+   TP_printk("c=%p %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
+ __entry->call,
+ rxrpc_rtt_rx_traces[__entry->why],
+ __entry->send_serial,
+ __entry->resp_serial,
+ __entry->rtt,
+ __entry->nr,
+ __entry->avg)
+   );
+
 #endif /* _TRACE_RXRPC_H */
 
 /* This part must be outside protection */
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index dcf54e3fb478..79c671e552c3 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -258,10 +258,11 @@ struct rxrpc_peer {
 
/* calculated RTT cache */
 #define RXRPC_RTT_CACHE_SIZE 32
-   suseconds_t rtt;/* current RTT estimate (in uS) 
*/
-   unsigned intrtt_point;  /* next entry at which to 
insert */
-   unsigned intrtt_usage;  /* amount of cache actually 
used */
-   suseconds_t rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* calculated 
RTT cache */
+   u64 rtt;/* Current RTT estimate (in nS) 
*/
+   u64 rtt_sum;/* Sum of cache contents */
+   u64 rtt_cache[RXRPC_RTT_CACHE_SIZE]; /* Determined 
RTT cache */
+   u8  rtt_cursor; /* next entry at which to 
insert */
+   u8  rtt_usage;  /* amount of cache actually 
used */
 };
 
 /*
@@ -657,6 +658,20 @@ enum rxrpc_recvmsg_trace {
 
 extern const char rxrpc_recvmsg_traces[rxrpc_recvmsg__nr_trace][5];
 
+enum rxrpc_rtt_tx_trace {
+   rxrpc_rtt_tx_ping,
+   rxrpc_rtt_tx__nr_trace
+};
+
+extern const char rxrpc_rtt_tx_traces[rxrpc_rtt_tx__nr_trace][5];
+
+enum rxrpc_rtt_rx_trace {
+   rxrpc_rtt_rx_ping_response,
+