Packet timestamps (was: Re: Network performance degradation from 2.6.11.12 to 2.6.16.20)

2007-03-06 Thread Vladimir B. Savkin
On Fri, Sep 22, 2006 at 09:51:09AM -0700, Rick Jones wrote:
 That came from named. It opens lots of sockets with SIOCGSTAMP.
 No idea what it needs that many for.
 
 IIRC ISC BIND named opens a socket for each IP it finds on the system. 
 Presumeably in this way it knows implicitly the destination IP without 
 using platform-specific recvfrom/whatever extensions and gets some 
 additional parallelism in the stack on SMP systems.
 
 Why it needs/wants the timestamps I've no idea, I don't think it gets 
 them that way on all platforms.  I suppose the next time I do some named 
 benchmarking I can try to take a closer look in the source.
 

Returning to the discussion about packet timestamps, I just
use the following patch now:

diff -ur ../linux-2.6.20.1/include/linux/sysctl.h 
linux-2.6.20.1-ts/include/linux/sysctl.h
--- ../linux-2.6.20.1/include/linux/sysctl.h2007-02-20 09:34:32.0 
+0300
+++ linux-2.6.20.1-ts/include/linux/sysctl.h2007-03-04 19:10:36.0 
+0300
@@ -280,6 +280,7 @@
NET_CORE_BUDGET=19,
NET_CORE_AEVENT_ETIME=20,
NET_CORE_AEVENT_RSEQTH=21,
+   NET_CORE_ACCURATE_TIMESTAMPS=99,
 };
 
 /* /proc/sys/net/ethernet */
diff -ur ../linux-2.6.20.1/net/core/dev.c linux-2.6.20.1-ts/net/core/dev.c
--- ../linux-2.6.20.1/net/core/dev.c2007-02-20 09:34:32.0 +0300
+++ linux-2.6.20.1-ts/net/core/dev.c2007-03-04 19:09:44.0 +0300
@@ -1043,9 +1043,11 @@
 }
 EXPORT_SYMBOL(__net_timestamp);
 
+int sysctl_accurate_timestamps = 1;
+
 static inline void net_timestamp(struct sk_buff *skb)
 {
-   if (atomic_read(netstamp_needed))
+   if (sysctl_accurate_timestamps  atomic_read(netstamp_needed))
__net_timestamp(skb);
else {
skb-tstamp.off_sec = 0;
diff -ur ../linux-2.6.20.1/net/core/sysctl_net_core.c 
linux-2.6.20.1-ts/net/core/sysctl_net_core.c
--- ../linux-2.6.20.1/net/core/sysctl_net_core.c2007-02-20 
09:34:32.0 +0300
+++ linux-2.6.20.1-ts/net/core/sysctl_net_core.c2007-03-04 
19:05:11.0 +0300
@@ -21,6 +21,8 @@
 
 extern int sysctl_core_destroy_delay;
 
+extern int sysctl_accurate_timestamps;
+
 #ifdef CONFIG_XFRM
 extern u32 sysctl_xfrm_aevent_etime;
 extern u32 sysctl_xfrm_aevent_rseqth;
@@ -136,6 +138,14 @@
.mode   = 0644,
.proc_handler   = proc_dointvec
},
+   {
+   .ctl_name   = NET_CORE_ACCURATE_TIMESTAMPS,
+   .procname   = accurate_timestamps,
+   .data   = sysctl_accurate_timestamps,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
+   .proc_handler   = proc_dointvec
+   },
{ .ctl_name = 0 }
 };
 

May I ask about integrating this or a similar solution for those
like me who values routing performance (with bind9 running) over
minor convinience of having tcpdump always display accurate
timestamps?

And why current kernel (2.6.20.1) still ignores parameter
clocksource=tsc ? I think with idle=poll TSC is safe to use on my setup,
it had ran with TSC for many months without a problem.

~
:wq
With best regards, 
   Vladimir Savkin. 

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Packet timestamps (was: Re: Network performance degradation from 2.6.11.12 to 2.6.16.20)

2007-03-06 Thread Eric Dumazet
On Tuesday 06 March 2007 14:25, Vladimir B. Savkin wrote:

   },
 + {
 + .ctl_name   = NET_CORE_ACCURATE_TIMESTAMPS,
 + .procname   = accurate_timestamps,
 + .data   = sysctl_accurate_timestamps,
 + .maxlen = sizeof(int),
 + .mode   = 0644,
 + .proc_handler   = proc_dointvec
 + },
   { .ctl_name = 0 }
  };


 May I ask about integrating this or a similar solution for those
 like me who values routing performance (with bind9 running) over
 minor convinience of having tcpdump always display accurate
 timestamps?


Quite frankly I dont like this patch :

1) Fix applications, do not bloat kernel.

2) accurate_timestamps is misleading. 
Should be disable_timestamps 

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Packet timestamps (was: Re: Network performance degradation from 2.6.11.12 to 2.6.16.20)

2007-03-06 Thread Vladimir B. Savkin
On Tue, Mar 06, 2007 at 03:38:44PM +0100, Eric Dumazet wrote:
 2) accurate_timestamps is misleading. 
   Should be disable_timestamps 

Not, if default is 1, as in my patch.

~
:wq
With best regards, 
   Vladimir Savkin. 

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Packet timestamps (was: Re: Network performance degradation from 2.6.11.12 to 2.6.16.20)

2007-03-06 Thread Eric Dumazet
On Tuesday 06 March 2007 15:43, Vladimir B. Savkin wrote:
 On Tue, Mar 06, 2007 at 03:38:44PM +0100, Eric Dumazet wrote:
  2) accurate_timestamps is misleading.
  Should be disable_timestamps

 Not, if default is 1, as in my patch.

Yes I saw this. I should write more words next time :)

Full explanation:
--

If your tunable is named accurate_timestamps then a 0 value would mean :

Use a low precision timestamp (based on xtime for example) instead of a full 
resolution...

This is not what your patch does (while it could do that, but beware that 
net-2.6.22 includes now a ktime_t timestamping)

So :
--

It would be better to name the tunable disable_timestamps, default 0 of 
course 
It would better describe what your patch is actually doing : Even if a tcpdump 
is running (so asking for timestamps), it wont have them because the sysctl 
disabled them.

Thank you

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Packet timestamps (was: Re: Network performance degradation from 2.6.11.12 to 2.6.16.20)

2007-03-06 Thread Vladimir B. Savkin
On Tue, Mar 06, 2007 at 04:16:24PM +0100, Eric Dumazet wrote:
 
 It would be better to name the tunable disable_timestamps, default 0 of 
 course 

I agree.
If networking maintainers are interested, I surely can prepare a patch.

But IMO some way to force TSC usage on x86_64 will be even better.

 It would better describe what your patch is actually doing : Even if a 
 tcpdump 
 is running (so asking for timestamps), it wont have them because the sysctl 
 disabled them.

Well, tcpdump will have timestamps, but taken at wrong moment.
But some other applications (that use ip_queue, ulog etc.) will not,
as I understand.

 
 Thank you
 
~
:wq
With best regards, 
   Vladimir Savkin. 

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html