netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [IPROUTE 00/05]: Time cleanups
@ 2007-01-10 10:01 Patrick McHardy
  2007-01-10 10:01 ` [IPROUTE 01/05]: Use tc_calc_xmittime where appropriate Patrick McHardy
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Patrick McHardy @ 2007-01-10 10:01 UTC (permalink / raw)
  To: shemminger; +Cc: netdev, Patrick McHardy

These patches clean up the tc time handling a bit, with the goal of making
it easier to audit for integer overflows when increasing the internal clock
resolution, which is necessary for all token bucket based schedulers to take
advantage of a higher kernel clock resolution (ktime) because the kernel only
does lookups and additions/subtractions, which can never result in values that
have a higher precision that those passed from userspace.

The way I imagine it we have to keep (at least on of) the old clock sources
around for userspace compatibility since they can't deal with the higher
precision values. iproute is changed to use nsec internally and reads the
kernel clock resulution from /proc/net/psched (third value, currently assumed
to always be 10^6) to convert it's internal resolution to that of the kernel.
With ktime as clocksource the kernel will report a resulution of 10^9. The
downside is that distributors can't enable ktime unless they want to break
compatibility with old iproute versions, but I can't see a way around this.


 tc/m_estimator.c  |    4 ++--
 tc/m_police.c     |    2 +-
 tc/q_cbq.c        |   15 ++++++++-------
 tc/q_hfsc.c       |   18 +++++++++---------
 tc/q_htb.c        |    4 ++--
 tc/q_netem.c      |   12 +++---------
 tc/q_tbf.c        |   20 ++++++++++----------
 tc/tc_cbq.c       |    8 ++++----
 tc/tc_core.c      |   35 +++++++++++++++++++++++++----------
 tc/tc_core.h      |   11 ++++++++---
 tc/tc_estimator.c |    2 +-
 tc/tc_red.c       |    2 +-
 tc/tc_util.c      |   33 +++++++++++++++++++--------------
 tc/tc_util.h      |    7 ++++---
 14 files changed, 97 insertions(+), 76 deletions(-)

Patrick McHardy:
      [IPROUTE]: Use tc_calc_xmittime where appropriate
      [IPROUTE]: Introduce tc_calc_xmitsize and use where appropriate
      [IPROUTE]: Introduce TIME_UNITS_PER_SEC to represent internal clock resolution
      [IPROUTE]: Replace "usec" by "time" in function names
      [IPROUTE]: Add sprint_ticks() function and use in CBQ

^ permalink raw reply	[flat|nested] 16+ messages in thread
* [RFC IPROUTE 00/05]: Time cleanups
@ 2006-06-23 18:06 Patrick McHardy
  2006-06-23 18:06 ` [IPROUTE 04/05]: Replace "usec" by "time" in function names Patrick McHardy
  0 siblings, 1 reply; 16+ messages in thread
From: Patrick McHardy @ 2006-06-23 18:06 UTC (permalink / raw)
  To: hemminger; +Cc: netdev, Patrick McHardy, hadi

I'm currently adding support for ktime as clocksource to the qdisc layer and
in the course of doing that cleaned up the iproute time handling a bit to
make it easier to use a different internal clock resultion and audit for
integer overflows.

Increasing iproutes internal clock resolution is necessary for all token bucket
based schedulers to take advantage of a higher kernel clock resolution because
the kernel only does lookups and additions/subtractions, which can never result
in values that have a higher precision that those passed from userspace.

The way I imagine it we have to keep the old clock sources around for userspace
compatibility since they can't deal with the higher precision values. iproute is
changed to use nsec internally and reads the kernel clock resulution from
/proc/net/psched (third value, currently assumed to always be 10^6) to convert
it's internal resolution to that of the kernel. With ktime as clocksource the
kernel will report a resulution of 10^9. The downside is that distributors can't
enable ktime unless they want to break compatibility with old iproute versions.
Any better suggestions are welcome of course.


 tc/m_estimator.c  |    4 ++--
 tc/m_police.c     |    2 +-
 tc/q_cbq.c        |   15 ++++++++-------
 tc/q_hfsc.c       |   18 +++++++++---------
 tc/q_htb.c        |    4 ++--
 tc/q_netem.c      |   12 +++---------
 tc/q_tbf.c        |   20 ++++++++++----------
 tc/tc_cbq.c       |    8 ++++----
 tc/tc_core.c      |   31 +++++++++++++++++++++++--------
 tc/tc_core.h      |    9 +++++++--
 tc/tc_estimator.c |    2 +-
 tc/tc_red.c       |    2 +-
 tc/tc_util.c      |   33 +++++++++++++++++++--------------
 tc/tc_util.h      |    7 ++++---
 14 files changed, 94 insertions(+), 73 deletions(-)

Patrick McHardy:
      [IPROUTE]: Use tc_calc_xmittime where appropriate
      [IPROUTE]: Introduce tc_calc_xmitsize and use where appropriate
      [IPROUTE]: Introduce TIME_UNITS_PER_SEC to represent internal clock resulution
      [IPROUTE]: Replace "usec" by "time" in function names
      [IPROUTE]: Add sprint_ticks() function and use in CBQ

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2007-01-16 13:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-10 10:01 [IPROUTE 00/05]: Time cleanups Patrick McHardy
2007-01-10 10:01 ` [IPROUTE 01/05]: Use tc_calc_xmittime where appropriate Patrick McHardy
2007-01-16  8:56   ` Jarek Poplawski
2007-01-16 10:19     ` Patrick McHardy
2007-01-16 11:02       ` Jarek Poplawski
2007-01-16 12:28         ` Patrick McHardy
2007-01-16 12:48           ` Jarek Poplawski
2007-01-10 10:01 ` [IPROUTE 02/05]: Introduce tc_calc_xmitsize and use " Patrick McHardy
2007-01-15 12:35   ` Jarek Poplawski
2007-01-15 15:07     ` Patrick McHardy
2007-01-10 10:01 ` [IPROUTE 03/05]: Introduce TIME_UNITS_PER_SEC to represent internal clock resolution Patrick McHardy
2007-01-10 10:01 ` [IPROUTE 04/05]: Replace "usec" by "time" in function names Patrick McHardy
2007-01-15 10:17   ` Jarek Poplawski
2007-01-16 13:42     ` Patrick McHardy
2007-01-10 10:01 ` [IPROUTE 05/05]: Add sprint_ticks() function and use in CBQ Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2006-06-23 18:06 [RFC IPROUTE 00/05]: Time cleanups Patrick McHardy
2006-06-23 18:06 ` [IPROUTE 04/05]: Replace "usec" by "time" in function names Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).