From: Ben Hutchings <bhutchings@solarflare.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Daniel Turull <daniel.turull@gmail.com>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, Robert Olsson <robert@herjulf.net>,
Voravit Tanyingyong <voravit@kth.se>,
Jens Laas <jens.laas@uadm.uu.se>
Subject: Re: [patch] pktgen: bug when calling ndelay in x86 architectures
Date: Tue, 18 Oct 2011 15:00:01 +0100 [thread overview]
Message-ID: <1318946401.23980.6.camel@deadeye> (raw)
In-Reply-To: <1318939007.2657.57.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
On Tue, 2011-10-18 at 13:56 +0200, Eric Dumazet wrote:
> Le mardi 18 octobre 2011 à 13:08 +0200, Daniel Turull a écrit :
> > The value selected to delay the transmission in pktgen with the ndelay function should be lower.
> > In Linux/arch/x86/include/asm/delay.h and Linux/arch/sh/include/asm/delay.h
> > the maximal expected value for a constant is 20000 ns.
> >
> > Signed-off-by: Daniel Turull <daniel.turull@gmail.com>
> > ---
> > diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> > index 796044a..e17bd41 100644
> > --- a/net/core/pktgen.c
> > +++ b/net/core/pktgen.c
> > @@ -2145,7 +2145,7 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until)
> > }
> >
> > start_time = ktime_now();
> > - if (remaining < 100000)
> > + if (remaining < 20000)
> > ndelay(remaining); /* really small just spin */
> > else {
> > /* see do_nanosleep */
>
> But 'remaining' is not a constant.
>
> If we want exactly 40.000 packets per second rate (25 us between
> packets), your patch makes this not quite possible without
> CONFIG_HIGH_RES_TIMERS and probable high jitter because of scheduler
> effects.
>
> pktgen is kind of special, we _want_ a cpu for our exclusive use.
AIUI, the reason for limits on delays is not that it's bad practice to
spin for so long, but that the delay calculations may overflow or
otherwise become inaccurate.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2011-10-18 14:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 11:08 [patch] pktgen: bug when calling ndelay in x86 architectures Daniel Turull
2011-10-18 11:56 ` Eric Dumazet
2011-10-18 14:00 ` Ben Hutchings [this message]
2011-10-18 14:47 ` Eric Dumazet
[not found] ` <4E9E9963.7090209@gmail.com>
2011-10-19 10:13 ` Eric Dumazet
2011-10-20 13:22 ` Daniel Turull
2011-10-20 13:44 ` Eric Dumazet
2011-10-20 14:26 ` Daniel Turull
2011-10-20 20:24 ` David Miller
2011-10-20 20:55 ` Eric Dumazet
2011-10-20 21:02 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318946401.23980.6.camel@deadeye \
--to=bhutchings@solarflare.com \
--cc=daniel.turull@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jens.laas@uadm.uu.se \
--cc=netdev@vger.kernel.org \
--cc=robert@herjulf.net \
--cc=voravit@kth.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).