mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [RFC] clocksource: dummy: don't show message on first cs read
@ 2014-11-28 13:07 Antony Pavlov
  2014-12-01  6:31 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Antony Pavlov @ 2014-11-28 13:07 UTC (permalink / raw)
  To: barebox

In the commit

    commit 96cae61eba199b9c3f5451f293cf60db2b535164
    Author: Sascha Hauer <s.hauer@pengutronix.de>
    Date:   Tue Sep 30 08:25:55 2014 +0200

        clock: Add a variable with the first timestamp after startup

        For measuring the startup time it's useful to save the first
        timestamp after the clocksource has been registered.

the behaviour of clocksource subsystem is changed: every registered
clocksource is called at least once. So the dummy clocksource (if enabled)
_ALWAYS_ prints a confusing 'Using dummy clocksource' warning.

This patch fixes the situation: now the 'Using dummy clocksource'
warning is printed only if the dummy clocksource is called second time.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 drivers/clocksource/dummy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/dummy.c b/drivers/clocksource/dummy.c
index 96f9b6e..9a42305 100644
--- a/drivers/clocksource/dummy.c
+++ b/drivers/clocksource/dummy.c
@@ -25,8 +25,11 @@ static uint64_t dummy_cs_read(void)
 {
 	static int first;
 
-	if (!first) {
+	if (first == 1) {
 		pr_warn("Warning: Using dummy clocksource\n");
+		first = 2;
+	}
+	if (!first) {
 		first = 1;
 	}
 
-- 
2.1.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC] clocksource: dummy: don't show message on first cs read
  2014-11-28 13:07 [RFC] clocksource: dummy: don't show message on first cs read Antony Pavlov
@ 2014-12-01  6:31 ` Sascha Hauer
  2014-12-01 10:01   ` Antony Pavlov
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2014-12-01  6:31 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Fri, Nov 28, 2014 at 04:07:32PM +0300, Antony Pavlov wrote:
> In the commit
> 
>     commit 96cae61eba199b9c3f5451f293cf60db2b535164
>     Author: Sascha Hauer <s.hauer@pengutronix.de>
>     Date:   Tue Sep 30 08:25:55 2014 +0200
> 
>         clock: Add a variable with the first timestamp after startup
> 
>         For measuring the startup time it's useful to save the first
>         timestamp after the clocksource has been registered.
> 
> the behaviour of clocksource subsystem is changed: every registered
> clocksource is called at least once. So the dummy clocksource (if enabled)
> _ALWAYS_ prints a confusing 'Using dummy clocksource' warning.
> 
> This patch fixes the situation: now the 'Using dummy clocksource'
> warning is printed only if the dummy clocksource is called second time.

I don't like this very much. The dummy clocksource expects some certain
behaviour of the common clocksource code and works around this when it
changes. How about integrating the dummy clocksource into the core
instead, like

uint64_t get_time_ns(void)
{
	if (!current_clock)
		return dummy_counter++;

	...
}

Then add a initcall which warns later if we still don't have a valid
clocksource?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [RFC] clocksource: dummy: don't show message on first cs read
  2014-12-01  6:31 ` Sascha Hauer
@ 2014-12-01 10:01   ` Antony Pavlov
  0 siblings, 0 replies; 3+ messages in thread
From: Antony Pavlov @ 2014-12-01 10:01 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, 1 Dec 2014 07:31:40 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Fri, Nov 28, 2014 at 04:07:32PM +0300, Antony Pavlov wrote:
> > In the commit
> > 
> >     commit 96cae61eba199b9c3f5451f293cf60db2b535164
> >     Author: Sascha Hauer <s.hauer@pengutronix.de>
> >     Date:   Tue Sep 30 08:25:55 2014 +0200
> > 
> >         clock: Add a variable with the first timestamp after startup
> > 
> >         For measuring the startup time it's useful to save the first
> >         timestamp after the clocksource has been registered.
> > 
> > the behaviour of clocksource subsystem is changed: every registered
> > clocksource is called at least once. So the dummy clocksource (if enabled)
> > _ALWAYS_ prints a confusing 'Using dummy clocksource' warning.
> > 
> > This patch fixes the situation: now the 'Using dummy clocksource'
> > warning is printed only if the dummy clocksource is called second time.
> 
> I don't like this very much. The dummy clocksource expects some certain
> behaviour of the common clocksource code and works around this when it
> changes. How about integrating the dummy clocksource into the core
> instead, like
> 
> uint64_t get_time_ns(void)
> {
> 	if (!current_clock)
> 		return dummy_counter++;
> 
> 	...
> }
> 
> Then add a initcall which warns later if we still don't have a valid
> clocksource?

Good plan! I'll try to realize it in several days.
 
-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2014-12-01 10:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-28 13:07 [RFC] clocksource: dummy: don't show message on first cs read Antony Pavlov
2014-12-01  6:31 ` Sascha Hauer
2014-12-01 10:01   ` Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox