public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com,
	linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:core/rcu] rcutorture: Make initrd/init execute in userspace
Date: Wed, 5 Dec 2018 14:25:24 -0800	[thread overview]
Message-ID: <20181205222523.GA14609@localhost> (raw)
In-Reply-To: <20181204230423.GP4170@linux.ibm.com>

On Tue, Dec 04, 2018 at 03:04:23PM -0800, Paul E. McKenney wrote:
> On Tue, Dec 04, 2018 at 02:24:13PM -0800, Josh Triplett wrote:
> > On Tue, Dec 04, 2018 at 02:09:42PM -0800, tip-bot for Paul E. McKenney wrote:
> > > --- a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh
> > > +++ b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh
> > > @@ -39,9 +39,22 @@ mkdir $T
> > >  
> > >  cat > $T/init << '__EOF___'
> > >  #!/bin/sh
> > > +# Run in userspace a few milliseconds every second.  This helps to
> > > +# exercise the NO_HZ_FULL portions of RCU.
> > >  while :
> > >  do
> > > -	sleep 1000000
> > > +	q=
> > > +	for i in \
> > > +		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> > > +		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> > > +		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> > > +		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> > > +		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
> > > +		a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
> > 
> > Ow. If there's no better way to do this, please do at least comment how many 'a's
> > this is. (And why 186, exactly?)
> 
> Yeah, that is admittedly a bit strange.  The reason for 186 occurrences of
> "a" to one-time calibration, measuring a few millisecond's worth of delay.
> 
> > Please also consider calibrating the delay loop as you do in the C code.
> 
> Good point.  And a quick web search finds me "date '+%s%N'", which gives
> me nanoseconds since the epoch.  I probably don't want to do a 2038 to
> myself (after all, I might still be alive then), so I should probably try
> to make something work with "date '+%N'".  Or use something like this:
> 
> 	$ date '+%4N'; date '+%4N';date '+%4N'; date '+%4N'
> 	6660
> 	6685
> 	6697
> 	6710
> 
> Ah, but that means I need to add the "date" command to my initrd, doesn't
> it?  And calculation requires either bash or the "test" command.  And it
> would be quite good to restrict this to what can be done with Bourne shell
> built-in commands, since a big point of this is to maintain a small-sized
> initrd.  :-/

Sure, and I'm not suggesting adding commands to the initrd, hence my
mention of "If there's no better way".

> So how about the following patch, which attempts to explain the situation?

That would help, but please also consider consolidating with something
like a10="a a a a a a a a a a" to make it more readable (and perhaps
rounding up to 200 for simplicity).

- Josh

  reply	other threads:[~2018-12-05 22:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tip-229ab0cb5be3bfbac5947df7240f6905470ca413@git.kernel.org>
2018-12-04 22:24 ` [tip:core/rcu] rcutorture: Make initrd/init execute in userspace Josh Triplett
2018-12-04 23:04   ` Paul E. McKenney
2018-12-05 22:25     ` Josh Triplett [this message]
2018-12-06  0:08       ` Paul E. McKenney
2018-12-06  0:27         ` Josh Triplett
2018-12-06  1:04           ` Paul E. McKenney
2018-12-06  0:51         ` Andrea Parri
2018-12-06  0:58           ` Josh Triplett
2018-12-06  1:06             ` Paul E. McKenney
2018-12-06  1:05           ` Paul E. McKenney

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=20181205222523.GA14609@localhost \
    --to=josh@joshtriplett.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.ibm.com \
    --cc=tglx@linutronix.de \
    /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