Re: [PATCH v5] printk: Add monotonic, boottime, and realtime timestamps

From: Thomas Gleixner
Date: Tue Aug 15 2017 - 08:51:18 EST


On Thu, 10 Aug 2017, Prarit Bhargava wrote:
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index cedafa008de5..1ddf04201047 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -25,6 +25,7 @@
> #include <linux/stop_machine.h>
> #include <linux/pvclock_gtod.h>
> #include <linux/compiler.h>
> +#include <linux/sched/clock.h>

That's needed because?

> #include "tick-internal.h"
> #include "ntp_internal.h"
> @@ -60,8 +61,39 @@ struct tk_fast {
> struct tk_read_base base[2];
> };
>
> -static struct tk_fast tk_fast_mono ____cacheline_aligned;
> -static struct tk_fast tk_fast_raw ____cacheline_aligned;
> +/* Suspend-time cycles value for halted fast timekeeper. */
> +static u64 cycles_at_suspend;
> +
> +static u64 dummy_clock_read(struct clocksource *cs)
> +{
> + return cycles_at_suspend;
> +}
> +
> +static struct clocksource dummy_clock = {
> + .read = dummy_clock_read,
> +};
> +
> +static struct tk_fast tk_fast_mono ____cacheline_aligned = {
> + .base = {
> + (struct tk_read_base){

Eew.

> + .clock = &dummy_clock,
> + },

.base[0] = {
.clock = &dummy_clock,
},

.base[1] = {
.clock = &dummy_clock,
},

Hmm?

> -static struct clocksource dummy_clock = {
> - .read = dummy_clock_read,
> -};
> -

Can we please have that timekeeping change as a seperate patch?

Thanks,

tglx