Skip to contentSkip to conversation

tcp: /proc/net/tcp rto,ato values not scaled properly

PATCH In review Stephen Hemminger 2 participants 6 messages Jun 20, 2008 – Jun 28, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp: /proc/net/tcp rto,ato values not scaled properly

I found another case where we are sending information to userspace in the wrong HZ scale. This should have been fixed back in 2.5 :-(

This means an ABI change but as it stands there is no way for an application like ss to get the right value.

net/ipv4/tcp_ipv4.c +2 -2
@@ -2201,8 +2201,8 @@ static void get_tcp4_sock(struct sock *s
 		icsk->icsk_probes_out,
 		sock_i_ino(sk),
 		atomic_read(&sk->sk_refcnt), sk,
-		icsk->icsk_rto,
-		icsk->icsk_ack.ato,
+		jiffies_to_clock_t(icsk->icsk_rto),
+		jiffies_to_clock_t(icsk->icsk_ack.ato),
 		(icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
 		tp->snd_cwnd,
 		tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh,
net/ipv6/tcp_ipv6.c +2 -2
@@ -1962,8 +1962,8 @@ static void get_tcp6_sock(struct seq_fil
 		   icsk->icsk_probes_out,
 		   sock_i_ino(sp),
 		   atomic_read(&sp->sk_refcnt), sp,
-		   icsk->icsk_rto,
-		   icsk->icsk_ack.ato,
+		   jiffies_to_clock_t(icsk->icsk_rto),
+		   jiffies_to_clock_t(icsk->icsk_ack.ato),
 		   (icsk->icsk_ack.quick << 1 ) | icsk->icsk_ack.pingpong,
 		   tp->snd_cwnd, tp->snd_ssthresh>=0xFFFF?-1:tp->snd_ssthresh
 		   );
maintainer
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Fri, 20 Jun 2008 11:56:03 -0700

Quoted 7 lines

I found another case where we are sending information to userspace in the wrong HZ scale. This should have been fixed back in 2.5 :-(

This means an ABI change but as it stands there is no way for an application like ss to get the right value.

Agree with your patch, but 'ss' should be getting this kind of info from netlink not procfs, right?

#2 lore raw
Quoted 6 lines · On Fri, 20 Jun 2008 12:05:26 -0700 (PDT) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Fri, 20 Jun 2008 11:56:03 -0700

Quoted 3 lines

I found another case where we are sending information to userspace in the wrong HZ scale. This should have been fixed back in 2.5 :-(

Quoted 8 lines
Quoted 4 lines

This means an ABI change but as it stands there is no way for an application like ss to get the right value.

Agree with your patch, but 'ss' should be getting this kind of info from netlink not procfs, right?

Yes, ss tries netlink first and fallsback to /proc.

I am in process of making sure all usages of HZ in iproute utilities are correct. The old user code assumed that the hz value used by tc (psched) was also correct for lots of other places. That is where I keep finding these turds.

Soon all uses of get_hz() in iproute will be replaced with either get_psched_hz() for tc; get_user_hz for clock values, or just use ms or us.

maintainer
#3 lore raw
In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>
Date: Fri, 20 Jun 2008 11:56:03 -0700

Quoted 7 lines

I found another case where we are sending information to userspace in the wrong HZ scale. This should have been fixed back in 2.5 :-(

This means an ABI change but as it stands there is no way for an application like ss to get the right value.

Please fix these warnings and resubmit:

net/ipv4/tcp_ipv4.c: In function 'get_tcp4_sock':
net/ipv4/tcp_ipv4.c:2311: warning: format '%u' expects type 'unsigned int', but argument 19 has type 'clock_t' net/ipv4/tcp_ipv4.c:2311: warning: format '%u' expects type 'unsigned int', but argument 20 has type 'clock_t' net/ipv6/tcp_ipv6.c: In function 'get_tcp6_sock':
net/ipv6/tcp_ipv6.c:2059: warning: format '%u' expects type 'unsigned int', but argument 25 has type 'clock_t' net/ipv6/tcp_ipv6.c:2059: warning: format '%u' expects type 'unsigned int', but argument 26 has type 'clock_t'

Thanks!

#4 lore raw

PATCH 1/1 tcp: /proc/net/tcp rto,ato values not scaled properly (v2)

In reply to Stephen Hemminger

I found another case where we are sending information to userspace in the wrong HZ scale. This should have been fixed back in 2.5 :-(

This means an ABI change but as it stands there is no way for an application like ss to get the right value.

---
Fixed printf format warnings in earlier patch

net/ipv4/tcp_ipv4.c +3 -3
@@ -2189,7 +2189,7 @@ static void get_tcp4_sock(struct sock *s
 	}
 
 	seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
-			"%08X %5d %8d %lu %d %p %u %u %u %u %d%n",
+			"%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
 		i, src, srcp, dest, destp, sk->sk_state,
 		tp->write_seq - tp->snd_una,
 		sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog :
@@ -2201,8 +2201,8 @@ static void get_tcp4_sock(struct sock *s
 		icsk->icsk_probes_out,
 		sock_i_ino(sk),
 		atomic_read(&sk->sk_refcnt), sk,
-		icsk->icsk_rto,
-		icsk->icsk_ack.ato,
+		jiffies_to_clock_t(icsk->icsk_rto),
+		jiffies_to_clock_t(icsk->icsk_ack.ato),
 		(icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
 		tp->snd_cwnd,
 		tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh,
net/ipv6/tcp_ipv6.c +3 -3
@@ -1946,7 +1946,7 @@ static void get_tcp6_sock(struct seq_fil
 
 	seq_printf(seq,
 		   "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
-		   "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %u %u %u %u %d\n",
+		   "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %lu %lu %u %u %d\n",
 		   i,
 		   src->s6_addr32[0], src->s6_addr32[1],
 		   src->s6_addr32[2], src->s6_addr32[3], srcp,
@@ -1962,8 +1962,8 @@ static void get_tcp6_sock(struct seq_fil
 		   icsk->icsk_probes_out,
 		   sock_i_ino(sp),
 		   atomic_read(&sp->sk_refcnt), sp,
-		   icsk->icsk_rto,
-		   icsk->icsk_ack.ato,
+		   jiffies_to_clock_t(icsk->icsk_rto),
+		   jiffies_to_clock_t(icsk->icsk_ack.ato),
 		   (icsk->icsk_ack.quick << 1 ) | icsk->icsk_ack.pingpong,
 		   tp->snd_cwnd, tp->snd_ssthresh>=0xFFFF?-1:tp->snd_ssthresh
 		   );
maintainer Applied
#5 lore raw

Re: [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly (v2)

From: Stephen Hemminger <[email protected]>
Date: Mon, 23 Jun 2008 11:16:00 -0700

Quoted 7 lines

I found another case where we are sending information to userspace in the wrong HZ scale. This should have been fixed back in 2.5 :-(

This means an ABI change but as it stands there is no way for an application like ss to get the right value.

Applied, thanks.