Skip to contentSkip to conversation

clocksource: dummy: don't show message on first cs read

RFC In review Antony Pavlov 2 participants 3 messages Nov 28, 2014 – Dec 1, 2014 Clocksource, clockevent drivers

lore
Share & tools
lore
#0 lore raw

RFC 1/1 clocksource: dummy: don't show message on first cs read

In the commit

commit 96cae61eba199b9c3f5451f293cf60db2b535164
Author: Sascha Hauer <[email protected]>
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.

---
 drivers/clocksource/dummy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clocksource/dummy.c +4 -1
index 96f9b6e..9a42305 100644
@@ -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;
 	}
 
Signature · 7 lines
2.1.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 11 lines · Antony Pavlov

In the commit

commit 96cae61eba199b9c3f5451f293cf60db2b535164
Author: Sascha Hauer <[email protected]>
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.

Quoted 6 lines

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

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
Quoted 32 lines · On Mon, 1 Dec 2014 07:31:40 +0100 Sascha Hauer <[email protected]> wrote:
Quoted 11 lines · Antony Pavlov

In the commit

commit 96cae61eba199b9c3f5451f293cf60db2b535164
Author: Sascha Hauer <[email protected]>
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.

Quoted 6 lines

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++;

	...
}
Quoted 2 lines

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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox