linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: alexandre.belloni at bootlin.com (Alexandre Belloni)
Subject: [PATCH 1/4] selftests: timers: move PIE tests out of rtctest
Date: Sat, 1 Dec 2018 10:55:51 +0100	[thread overview]
Message-ID: <20181201095551.GN8952@piout.net> (raw)
In-Reply-To: <a304b6f1-11db-543b-2cb3-372f34dc7697@linaro.org>

Hello,

On 29/11/2018 17:57:05-0200, Rafael David Tinoco wrote:
> On 4/19/18 9:50 AM, Alexandre Belloni wrote:
> > Since commit 6610e0893b8bc ("RTC: Rework RTC code to use timerqueue for
> > events"), PIE are completely handled using hrtimers, without actually using
> > any underlying hardware RTC.
> > 
> > Move PIE testing out of rtctest. It still depends on the presence of an RTC
> > (to access the device file) but doesn't depend on it actually working.
> > 
> > Signed-off-by: Alexandre Belloni <alexandre.belloni at bootlin.com>
> > ---
> >  tools/testing/selftests/timers/.gitignore |   1 +
> >  tools/testing/selftests/timers/Makefile   |   2 +-
> >  tools/testing/selftests/timers/rtcpie.c   | 132 ++++++++++++++++++++++
> >  tools/testing/selftests/timers/rtctest.c  |  83 +-------------
> >  4 files changed, 138 insertions(+), 80 deletions(-)
> >  create mode 100644 tools/testing/selftests/timers/rtcpie.c
> > 
> ...
> > +	/* The frequencies 128Hz, 256Hz, ... 8192Hz are only allowed for root. */
> > +	for (tmp=2; tmp<=64; tmp*=2) {
> > +
> > +		retval = ioctl(fd, RTC_IRQP_SET, tmp);
> > +		if (retval == -1) {
> > +			/* not all RTCs can change their periodic IRQ rate */
> > +			if (errno == EINVAL) {
> > +				fprintf(stderr,
> > +					"\n...Periodic IRQ rate is fixed\n");
> > +				goto done;
> > +			}
> > +			perror("RTC_IRQP_SET ioctl");
> > +			exit(errno);
> > +		}
> 
> Hello Alexandre,
> 
> In our tests, having failures under 64Hz is quite common in embedded
> systems with few number of CPUs/Cores:
> 
> --------
> root at bug3402:opt$ find /sys -name rtc0
> /sys/devices/platform/9010000.pl031/rtc/rtc0
> /sys/class/rtc/rtc0
> 
> selftests: timers: rtcpie
> Periodic IRQ rate is 1Hz.
> Counting 20 interrupts at:
> 2Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 4Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 8Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 16Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 32Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 64Hz:	
> PIE delta error: 0.017697 should be close to 0.015625
> not ok 1..9 selftests: timers: rtcpie [FAIL]
> --------
> 
> Mainly because 64Hz gives us.. ~16ms in the test, and the variation
> being taken in consideration for an error, for this test, is 10%, which
> is ~1.6ms... pretty close to scheduler limit for lower number of CPUs in
> a functional testing environment.
> 

I would think that enabling HR timers would actually make things better,
not matter how many CPUs are in the system. At least, this was the case
for AT91.

> Would you mind if we change the default for up to 32Hz ? Or, do you have
> any other suggestion ?
> 

I must admit that the whole point of moving this test out of rtctest was
that I didn't want to maintain it. John is the one responsible for the
timers so he will have to take that decision.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: alexandre.belloni@bootlin.com (Alexandre Belloni)
Subject: [PATCH 1/4] selftests: timers: move PIE tests out of rtctest
Date: Sat, 1 Dec 2018 10:55:51 +0100	[thread overview]
Message-ID: <20181201095551.GN8952@piout.net> (raw)
Message-ID: <20181201095551.zg79qyYBSqDHFPDfGINfGuGXWPVNs_VjeARaAwwOC40@z> (raw)
In-Reply-To: <a304b6f1-11db-543b-2cb3-372f34dc7697@linaro.org>

Hello,

On 29/11/2018 17:57:05-0200, Rafael David Tinoco wrote:
> On 4/19/18 9:50 AM, Alexandre Belloni wrote:
> > Since commit 6610e0893b8bc ("RTC: Rework RTC code to use timerqueue for
> > events"), PIE are completely handled using hrtimers, without actually using
> > any underlying hardware RTC.
> > 
> > Move PIE testing out of rtctest. It still depends on the presence of an RTC
> > (to access the device file) but doesn't depend on it actually working.
> > 
> > Signed-off-by: Alexandre Belloni <alexandre.belloni at bootlin.com>
> > ---
> >  tools/testing/selftests/timers/.gitignore |   1 +
> >  tools/testing/selftests/timers/Makefile   |   2 +-
> >  tools/testing/selftests/timers/rtcpie.c   | 132 ++++++++++++++++++++++
> >  tools/testing/selftests/timers/rtctest.c  |  83 +-------------
> >  4 files changed, 138 insertions(+), 80 deletions(-)
> >  create mode 100644 tools/testing/selftests/timers/rtcpie.c
> > 
> ...
> > +	/* The frequencies 128Hz, 256Hz, ... 8192Hz are only allowed for root. */
> > +	for (tmp=2; tmp<=64; tmp*=2) {
> > +
> > +		retval = ioctl(fd, RTC_IRQP_SET, tmp);
> > +		if (retval == -1) {
> > +			/* not all RTCs can change their periodic IRQ rate */
> > +			if (errno == EINVAL) {
> > +				fprintf(stderr,
> > +					"\n...Periodic IRQ rate is fixed\n");
> > +				goto done;
> > +			}
> > +			perror("RTC_IRQP_SET ioctl");
> > +			exit(errno);
> > +		}
> 
> Hello Alexandre,
> 
> In our tests, having failures under 64Hz is quite common in embedded
> systems with few number of CPUs/Cores:
> 
> --------
> root at bug3402:opt$ find /sys -name rtc0
> /sys/devices/platform/9010000.pl031/rtc/rtc0
> /sys/class/rtc/rtc0
> 
> selftests: timers: rtcpie
> Periodic IRQ rate is 1Hz.
> Counting 20 interrupts at:
> 2Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 4Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 8Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 16Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 32Hz:	 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 64Hz:	
> PIE delta error: 0.017697 should be close to 0.015625
> not ok 1..9 selftests: timers: rtcpie [FAIL]
> --------
> 
> Mainly because 64Hz gives us.. ~16ms in the test, and the variation
> being taken in consideration for an error, for this test, is 10%, which
> is ~1.6ms... pretty close to scheduler limit for lower number of CPUs in
> a functional testing environment.
> 

I would think that enabling HR timers would actually make things better,
not matter how many CPUs are in the system. At least, this was the case
for AT91.

> Would you mind if we change the default for up to 32Hz ? Or, do you have
> any other suggestion ?
> 

I must admit that the whole point of moving this test out of rtctest was
that I didn't want to maintain it. John is the one responsible for the
timers so he will have to take that decision.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  parent reply	other threads:[~2018-12-01  9:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19 12:50 [PATCH 0/4] selftests: rework RTC tests alexandre.belloni
2018-04-19 12:50 ` Alexandre Belloni
2018-04-19 12:50 ` [PATCH 1/4] selftests: timers: move PIE tests out of rtctest alexandre.belloni
2018-04-19 12:50   ` Alexandre Belloni
2018-11-29 19:57   ` rafael.tinoco
2018-11-29 19:57     ` Rafael David Tinoco
2018-12-01  9:55     ` alexandre.belloni [this message]
2018-12-01  9:55       ` Alexandre Belloni
2018-04-19 12:50 ` [PATCH 2/4] selftests: timers: rtcpie: restore previous PIE rate alexandre.belloni
2018-04-19 12:50   ` Alexandre Belloni
2018-04-19 12:50 ` [PATCH 3/4] selftests: move RTC tests to rtc subfolder alexandre.belloni
2018-04-19 12:50   ` Alexandre Belloni
2018-04-19 12:50 ` [PATCH 4/4] selftests: rtc: rework rtctest alexandre.belloni
2018-04-19 12:50   ` Alexandre Belloni
2018-04-24 19:33 ` [PATCH 0/4] selftests: rework RTC tests shuah
2018-04-24 19:33   ` Shuah Khan
2018-05-10 17:34   ` shuah
2018-05-10 17:34     ` Shuah Khan

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=20181201095551.GN8952@piout.net \
    --to=linux-kselftest@vger.kernel.org \
    /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).