2017-03-26 13:52:52

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] x86/apic/timer: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the x86 arch's apic clockevent driver initialize these fields
properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
(First test sending for 23 similar patches in different subsystems
to follow.)

This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/x86/kernel/apic/apic.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 8ccb7ef512e0..875091d4609d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -731,8 +731,10 @@ static int __init calibrate_APIC_clock(void)
TICK_NSEC, lapic_clockevent.shift);
lapic_clockevent.max_delta_ns =
clockevent_delta2ns(0x7FFFFF, &lapic_clockevent);
+ lapic_clockevent.max_delta_ticks = 0x7FFFFF;
lapic_clockevent.min_delta_ns =
clockevent_delta2ns(0xF, &lapic_clockevent);
+ lapic_clockevent.min_delta_ticks = 0xF;
lapic_clockevent.features &= ~CLOCK_EVT_FEAT_DUMMY;
return 0;
}
@@ -778,8 +780,10 @@ static int __init calibrate_APIC_clock(void)
lapic_clockevent.shift);
lapic_clockevent.max_delta_ns =
clockevent_delta2ns(0x7FFFFFFF, &lapic_clockevent);
+ lapic_clockevent.max_delta_ticks = 0x7FFFFFFF;
lapic_clockevent.min_delta_ns =
clockevent_delta2ns(0xF, &lapic_clockevent);
+ lapic_clockevent.min_delta_ticks = 0xF;

lapic_timer_frequency = (delta * APIC_DIVISOR) / LAPIC_CAL_LOOPS;

--
2.12.0


2017-03-30 19:39:48

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] avr32/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the avr32 arch's clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/avr32/kernel/time.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 4d9b69615979..fe98273fc0dc 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -142,7 +142,9 @@ void __init time_init(void)
/* setup COMPARE clockevent */
comparator.mult = div_sc(counter_hz, NSEC_PER_SEC, comparator.shift);
comparator.max_delta_ns = clockevent_delta2ns((u32)~0, &comparator);
+ comparator.max_delta_ticks = (u32)~0;
comparator.min_delta_ns = clockevent_delta2ns(50, &comparator) + 1;
+ comparator.min_delta_ticks = 50;
comparator.cpumask = cpumask_of(0);

sysreg_write(COMPARE, 0);
--
2.12.0

2017-03-30 19:41:20

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] blackfin: time-ts: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the blackfin arch's clockevent driver initialize these fields
properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/blackfin/kernel/time-ts.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c
index 0e9fcf841d67..01350557fbd7 100644
--- a/arch/blackfin/kernel/time-ts.c
+++ b/arch/blackfin/kernel/time-ts.c
@@ -230,7 +230,9 @@ static void __init bfin_gptmr0_clockevent_init(struct clock_event_device *evt)
clock_tick = get_sclk();
evt->mult = div_sc(clock_tick, NSEC_PER_SEC, evt->shift);
evt->max_delta_ns = clockevent_delta2ns(-1, evt);
+ evt->max_delta_ticks = (unsigned long)-1;
evt->min_delta_ns = clockevent_delta2ns(100, evt);
+ evt->min_delta_ticks = 100;

evt->cpumask = cpumask_of(0);

@@ -344,7 +346,9 @@ void bfin_coretmr_clockevent_init(void)
clock_tick = get_cclk() / TIME_SCALE;
evt->mult = div_sc(clock_tick, NSEC_PER_SEC, evt->shift);
evt->max_delta_ns = clockevent_delta2ns(-1, evt);
+ evt->max_delta_ticks = (unsigned long)-1;
evt->min_delta_ns = clockevent_delta2ns(100, evt);
+ evt->min_delta_ticks = 100;

evt->cpumask = cpumask_of(cpu);

--
2.12.0

2017-03-30 19:42:28

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] c6x/timer64: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the c6x arch's clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/c6x/platforms/timer64.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/c6x/platforms/timer64.c b/arch/c6x/platforms/timer64.c
index c19901e5f055..0bd0452ded80 100644
--- a/arch/c6x/platforms/timer64.c
+++ b/arch/c6x/platforms/timer64.c
@@ -234,7 +234,9 @@ void __init timer64_init(void)
clockevents_calc_mult_shift(cd, c6x_core_freq / TIMER_DIVISOR, 5);

cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
+ cd->max_delta_ticks = 0x7fffffff;
cd->min_delta_ns = clockevent_delta2ns(250, cd);
+ cd->min_delta_ticks = 250;

cd->cpumask = cpumask_of(smp_processor_id());

--
2.12.0

2017-03-30 19:43:38

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] hexagon/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the hexagon arch's clockevent driver initialize these fields
properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/hexagon/kernel/time.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/hexagon/kernel/time.c b/arch/hexagon/kernel/time.c
index ff4e9bf995e9..29b1f57116c8 100644
--- a/arch/hexagon/kernel/time.c
+++ b/arch/hexagon/kernel/time.c
@@ -199,7 +199,9 @@ void __init time_init_deferred(void)
clockevents_calc_mult_shift(ce_dev, sleep_clk_freq, 4);

ce_dev->max_delta_ns = clockevent_delta2ns(0x7fffffff, ce_dev);
+ ce_dev->max_delta_ticks = 0x7fffffff;
ce_dev->min_delta_ns = clockevent_delta2ns(0xf, ce_dev);
+ ce_dev->min_delta_ticks = 0xf;

#ifdef CONFIG_SMP
setup_percpu_clockdev();
--
2.12.0

2017-03-30 19:45:34

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] microblaze/timer: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the microblaze arch's clockevent driver initialize these fields
properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/microblaze/kernel/timer.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index 999066192715..545ccd46edb3 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -178,8 +178,10 @@ static __init int xilinx_clockevent_init(void)
clockevent_xilinx_timer.shift);
clockevent_xilinx_timer.max_delta_ns =
clockevent_delta2ns((u32)~0, &clockevent_xilinx_timer);
+ clockevent_xilinx_timer.max_delta_ticks = (u32)~0;
clockevent_xilinx_timer.min_delta_ns =
clockevent_delta2ns(1, &clockevent_xilinx_timer);
+ clockevent_xilinx_timer.min_delta_ticks = 1;
clockevent_xilinx_timer.cpumask = cpumask_of(0);
clockevents_register_device(&clockevent_xilinx_timer);

--
2.12.0

2017-03-30 19:44:37

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] m68k/coldfire/pit: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the m68k arch's coldfire clockevent driver initialize these fields
properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/m68k/coldfire/pit.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/m68k/coldfire/pit.c b/arch/m68k/coldfire/pit.c
index 175553d5b8ed..6c0878018b44 100644
--- a/arch/m68k/coldfire/pit.c
+++ b/arch/m68k/coldfire/pit.c
@@ -149,8 +149,10 @@ void hw_timer_init(irq_handler_t handler)
cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32);
cf_pit_clockevent.max_delta_ns =
clockevent_delta2ns(0xFFFF, &cf_pit_clockevent);
+ cf_pit_clockevent.max_delta_ticks = 0xFFFF;
cf_pit_clockevent.min_delta_ns =
clockevent_delta2ns(0x3f, &cf_pit_clockevent);
+ cf_pit_clockevent.min_delta_ticks = 0x3f;
clockevents_register_device(&cf_pit_clockevent);

setup_irq(MCF_IRQ_PIT1, &pit_irq);
--
2.12.0

2017-03-30 19:48:33

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] mn10300/cevt-mn10300: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the mn10300 arch's clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/mn10300/kernel/cevt-mn10300.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/mn10300/kernel/cevt-mn10300.c b/arch/mn10300/kernel/cevt-mn10300.c
index d9b34dd44f04..2b21bbc9efa4 100644
--- a/arch/mn10300/kernel/cevt-mn10300.c
+++ b/arch/mn10300/kernel/cevt-mn10300.c
@@ -98,7 +98,9 @@ int __init init_clockevents(void)

/* Calculate the min / max delta */
cd->max_delta_ns = clockevent_delta2ns(TMJCBR_MAX, cd);
+ cd->max_delta_ticks = TMJCBR_MAX;
cd->min_delta_ns = clockevent_delta2ns(100, cd);
+ cd->min_delta_ticks = 100;

cd->rating = 200;
cd->cpumask = cpumask_of(smp_processor_id());
--
2.12.0

2017-03-30 19:47:39

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] MIPS: clockevent drivers: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the MIPS arch's clockevent drivers initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from these
drivers.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/mips/alchemy/common/time.c | 4 +++-
arch/mips/jz4740/time.c | 2 ++
arch/mips/kernel/cevt-bcm1480.c | 2 ++
arch/mips/kernel/cevt-ds1287.c | 2 ++
arch/mips/kernel/cevt-gt641xx.c | 2 ++
arch/mips/kernel/cevt-sb1250.c | 2 ++
arch/mips/kernel/cevt-txx9.c | 2 ++
arch/mips/loongson32/common/time.c | 2 ++
arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c | 2 ++
arch/mips/loongson64/loongson-3/hpet.c | 2 ++
arch/mips/ralink/cevt-rt3352.c | 2 ++
arch/mips/sgi-ip27/ip27-timer.c | 2 ++
12 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/mips/alchemy/common/time.c b/arch/mips/alchemy/common/time.c
index e1bec5a77c39..32d1333bb243 100644
--- a/arch/mips/alchemy/common/time.c
+++ b/arch/mips/alchemy/common/time.c
@@ -138,7 +138,9 @@ static int __init alchemy_time_init(unsigned int m2int)
cd->shift = 32;
cd->mult = div_sc(32768, NSEC_PER_SEC, cd->shift);
cd->max_delta_ns = clockevent_delta2ns(0xffffffff, cd);
- cd->min_delta_ns = clockevent_delta2ns(9, cd); /* ~0.28ms */
+ cd->max_delta_ticks = 0xffffffff;
+ cd->min_delta_ns = clockevent_delta2ns(9, cd);
+ cd->min_delta_ticks = 9; /* ~0.28ms */
clockevents_register_device(cd);
setup_irq(m2int, &au1x_rtcmatch2_irqaction);

diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
index bcf8f8c62737..bb1ad5119da4 100644
--- a/arch/mips/jz4740/time.c
+++ b/arch/mips/jz4740/time.c
@@ -145,7 +145,9 @@ void __init plat_time_init(void)

clockevent_set_clock(&jz4740_clockevent, clk_rate);
jz4740_clockevent.min_delta_ns = clockevent_delta2ns(100, &jz4740_clockevent);
+ jz4740_clockevent.min_delta_ticks = 100;
jz4740_clockevent.max_delta_ns = clockevent_delta2ns(0xffff, &jz4740_clockevent);
+ jz4740_clockevent.max_delta_ticks = 0xffff;
jz4740_clockevent.cpumask = cpumask_of(0);

clockevents_register_device(&jz4740_clockevent);
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c
index 940ac00e9129..8f9f2daf06a3 100644
--- a/arch/mips/kernel/cevt-bcm1480.c
+++ b/arch/mips/kernel/cevt-bcm1480.c
@@ -123,7 +123,9 @@ void sb1480_clockevent_init(void)
CLOCK_EVT_FEAT_ONESHOT;
clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
+ cd->max_delta_ticks = 0x7fffff;
cd->min_delta_ns = clockevent_delta2ns(2, cd);
+ cd->min_delta_ticks = 2;
cd->rating = 200;
cd->irq = irq;
cd->cpumask = cpumask_of(cpu);
diff --git a/arch/mips/kernel/cevt-ds1287.c b/arch/mips/kernel/cevt-ds1287.c
index 77a5ddf53f57..61ad9079fa16 100644
--- a/arch/mips/kernel/cevt-ds1287.c
+++ b/arch/mips/kernel/cevt-ds1287.c
@@ -128,7 +128,9 @@ int __init ds1287_clockevent_init(int irq)
cd->irq = irq;
clockevent_set_clock(cd, 32768);
cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
+ cd->max_delta_ticks = 0x7fffffff;
cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
+ cd->min_delta_ticks = 0x300;
cd->cpumask = cpumask_of(0);

clockevents_register_device(&ds1287_clockevent);
diff --git a/arch/mips/kernel/cevt-gt641xx.c b/arch/mips/kernel/cevt-gt641xx.c
index 66040051151d..fd90c82dc17d 100644
--- a/arch/mips/kernel/cevt-gt641xx.c
+++ b/arch/mips/kernel/cevt-gt641xx.c
@@ -152,7 +152,9 @@ static int __init gt641xx_timer0_clockevent_init(void)
cd->rating = 200 + gt641xx_base_clock / 10000000;
clockevent_set_clock(cd, gt641xx_base_clock);
cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
+ cd->max_delta_ticks = 0x7fffffff;
cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
+ cd->min_delta_ticks = 0x300;
cd->cpumask = cpumask_of(0);

clockevents_register_device(&gt641xx_timer0_clockevent);
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c
index 3d860efd63b9..9d1edb5938b8 100644
--- a/arch/mips/kernel/cevt-sb1250.c
+++ b/arch/mips/kernel/cevt-sb1250.c
@@ -123,7 +123,9 @@ void sb1250_clockevent_init(void)
CLOCK_EVT_FEAT_ONESHOT;
clockevent_set_clock(cd, V_SCD_TIMER_FREQ);
cd->max_delta_ns = clockevent_delta2ns(0x7fffff, cd);
+ cd->max_delta_ticks = 0x7fffff;
cd->min_delta_ns = clockevent_delta2ns(2, cd);
+ cd->min_delta_ticks = 2;
cd->rating = 200;
cd->irq = irq;
cd->cpumask = cpumask_of(cpu);
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c
index aaca60d6ffc3..7b17c8f5009d 100644
--- a/arch/mips/kernel/cevt-txx9.c
+++ b/arch/mips/kernel/cevt-txx9.c
@@ -196,7 +196,9 @@ void __init txx9_clockevent_init(unsigned long baseaddr, int irq,
clockevent_set_clock(cd, TIMER_CLK(imbusclk));
cd->max_delta_ns =
clockevent_delta2ns(0xffffffff >> (32 - TXX9_TIMER_BITS), cd);
+ cd->max_delta_ticks = 0xffffffff >> (32 - TXX9_TIMER_BITS);
cd->min_delta_ns = clockevent_delta2ns(0xf, cd);
+ cd->min_delta_ticks = 0xf;
cd->irq = irq;
cd->cpumask = cpumask_of(0),
clockevents_register_device(cd);
diff --git a/arch/mips/loongson32/common/time.c b/arch/mips/loongson32/common/time.c
index e6f972d35252..1c4332a26cf1 100644
--- a/arch/mips/loongson32/common/time.c
+++ b/arch/mips/loongson32/common/time.c
@@ -199,7 +199,9 @@ static void __init ls1x_time_init(void)

clockevent_set_clock(cd, mips_hpt_frequency);
cd->max_delta_ns = clockevent_delta2ns(0xffffff, cd);
+ cd->max_delta_ticks = 0xffffff;
cd->min_delta_ns = clockevent_delta2ns(0x000300, cd);
+ cd->min_delta_ticks = 0x000300;
cd->cpumask = cpumask_of(smp_processor_id());
clockevents_register_device(cd);

diff --git a/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c b/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c
index b817d6d3a060..a6adcc4f8960 100644
--- a/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c
+++ b/arch/mips/loongson64/common/cs5536/cs5536_mfgpt.c
@@ -123,7 +123,9 @@ void __init setup_mfgpt0_timer(void)
cd->cpumask = cpumask_of(cpu);
clockevent_set_clock(cd, MFGPT_TICK_RATE);
cd->max_delta_ns = clockevent_delta2ns(0xffff, cd);
+ cd->max_delta_ticks = 0xffff;
cd->min_delta_ns = clockevent_delta2ns(0xf, cd);
+ cd->min_delta_ticks = 0xf;

/* Enable MFGPT0 Comparator 2 Output to the Interrupt Mapper */
_wrmsr(DIVIL_MSR_REG(MFGPT_IRQ), 0, 0x100);
diff --git a/arch/mips/loongson64/loongson-3/hpet.c b/arch/mips/loongson64/loongson-3/hpet.c
index 24afe364637b..4df9d4b7356a 100644
--- a/arch/mips/loongson64/loongson-3/hpet.c
+++ b/arch/mips/loongson64/loongson-3/hpet.c
@@ -241,7 +241,9 @@ void __init setup_hpet_timer(void)
cd->cpumask = cpumask_of(cpu);
clockevent_set_clock(cd, HPET_FREQ);
cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
+ cd->max_delta_ticks = 0x7fffffff;
cd->min_delta_ns = clockevent_delta2ns(HPET_MIN_PROG_DELTA, cd);
+ cd->min_delta_ticks = HPET_MIN_PROG_DELTA;

clockevents_register_device(cd);
setup_irq(HPET_T0_IRQ, &hpet_irq);
diff --git a/arch/mips/ralink/cevt-rt3352.c b/arch/mips/ralink/cevt-rt3352.c
index f24eee04e16a..b8a1376165b0 100644
--- a/arch/mips/ralink/cevt-rt3352.c
+++ b/arch/mips/ralink/cevt-rt3352.c
@@ -129,7 +129,9 @@ static int __init ralink_systick_init(struct device_node *np)
systick.dev.name = np->name;
clockevents_calc_mult_shift(&systick.dev, SYSTICK_FREQ, 60);
systick.dev.max_delta_ns = clockevent_delta2ns(0x7fff, &systick.dev);
+ systick.dev.max_delta_ticks = 0x7fff;
systick.dev.min_delta_ns = clockevent_delta2ns(0x3, &systick.dev);
+ systick.dev.min_delta_ticks = 0x3;
systick.dev.irq = irq_of_parse_and_map(np, 0);
if (!systick.dev.irq) {
pr_err("%s: request_irq failed", np->name);
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 695c51bdd7dc..a53f0c8c901e 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -113,7 +113,9 @@ void hub_rt_clock_event_init(void)
cd->features = CLOCK_EVT_FEAT_ONESHOT;
clockevent_set_clock(cd, CYCLES_PER_SEC);
cd->max_delta_ns = clockevent_delta2ns(0xfffffffffffff, cd);
+ cd->max_delta_ticks = 0xfffffffffffff;
cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
+ cd->min_delta_ticks = 0x300;
cd->rating = 200;
cd->irq = irq;
cd->cpumask = cpumask_of(cpu);
--
2.12.0

2017-03-30 19:53:30

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] powerpc/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the powerpc arch's clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/powerpc/kernel/time.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 07b90725855e..2b33cfaac7b8 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -995,8 +995,10 @@ static void __init init_decrementer_clockevent(void)

decrementer_clockevent.max_delta_ns =
clockevent_delta2ns(decrementer_max, &decrementer_clockevent);
+ decrementer_clockevent.max_delta_ticks = decrementer_max;
decrementer_clockevent.min_delta_ns =
clockevent_delta2ns(2, &decrementer_clockevent);
+ decrementer_clockevent.min_delta_ticks = 2;

register_decrementer_clockevent(cpu);
}
--
2.12.0

2017-03-30 19:55:01

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] s390/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Currently, the s390's CPU timer clockevent device is initialized as
follows:

cd->min_delta_ns = 1;
cd->max_delta_ns = LONG_MAX;

Note that the device's time to cycle conversion factor, i.e.
cd->mult / (2^cd->shift), is approx. equal to 4.

Hence, this would translate to

cd->min_delta_ticks = 4;
cd->max_delta_ticks = 4 * LONG_MAX;

However, a minimum value of 1ns is in the range of noise anyway and the
clockevent core will take care of this by increasing it to 1us or so.
Furthermore, 4*LONG_MAX would overflow the unsigned long argument the
clockevent devices gets programmed with.

Thus, initialize ->min_delta_ticks with 1 and ->max_delta_ticks with
ULONG_MAX.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/s390/kernel/time.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index c31da46bc037..c3a52f9a69a0 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -158,7 +158,9 @@ void init_cpu_timer(void)
cd->mult = 16777;
cd->shift = 12;
cd->min_delta_ns = 1;
+ cd->min_delta_ticks = 1;
cd->max_delta_ns = LONG_MAX;
+ cd->max_delta_ticks = ULONG_MAX;
cd->rating = 400;
cd->cpumask = cpumask_of(cpu);
cd->set_next_event = s390_next_event;
--
2.12.0

2017-03-30 19:56:01

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] score/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the score arch's clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/score/kernel/time.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/score/kernel/time.c b/arch/score/kernel/time.c
index 679b8d7b0350..29aafc741f69 100644
--- a/arch/score/kernel/time.c
+++ b/arch/score/kernel/time.c
@@ -81,8 +81,10 @@ void __init time_init(void)
score_clockevent.shift);
score_clockevent.max_delta_ns = clockevent_delta2ns((u32)~0,
&score_clockevent);
+ score_clockevent.max_delta_ticks = (u32)~0;
score_clockevent.min_delta_ns = clockevent_delta2ns(50,
&score_clockevent) + 1;
+ score_clockevent.min_delta_ticks = 50;
score_clockevent.cpumask = cpumask_of(0);
clockevents_register_device(&score_clockevent);
}
--
2.12.0

2017-03-30 19:57:03

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] sparc/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the sparc arch's clockevent drivers initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from these
drivers.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/sparc/kernel/time_32.c | 2 ++
arch/sparc/kernel/time_64.c | 2 ++
2 files changed, 4 insertions(+)

diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 244062bdaa56..9f575dfc2e41 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -228,7 +228,9 @@ void register_percpu_ce(int cpu)
ce->mult = div_sc(sparc_config.clock_rate, NSEC_PER_SEC,
ce->shift);
ce->max_delta_ns = clockevent_delta2ns(sparc_config.clock_rate, ce);
+ ce->max_delta_ticks = (unsigned long)sparc_config.clock_rate;
ce->min_delta_ns = clockevent_delta2ns(100, ce);
+ ce->min_delta_ticks = 100;

clockevents_register_device(ce);
}
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 12a6d3555cb8..98d05de8da66 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -796,8 +796,10 @@ void __init time_init(void)

sparc64_clockevent.max_delta_ns =
clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent);
+ sparc64_clockevent.max_delta_ticks = 0x7fffffffffffffffUL;
sparc64_clockevent.min_delta_ns =
clockevent_delta2ns(0xF, &sparc64_clockevent);
+ sparc64_clockevent.min_delta_ticks = 0xF;

printk("clockevent: mult[%x] shift[%d]\n",
sparc64_clockevent.mult, sparc64_clockevent.shift);
--
2.12.0

2017-03-30 19:57:49

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] tile/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Currently, the tile's timer clockevent device is initialized as follows:

evt->max_delta_ns = clockevent_delta2ns(MAX_TICK, evt);

and

.min_delta_ns = 1000,

The first one translates to a ->max_delta_ticks value of MAX_TICK.
For the latter, note that the clockevent core will superimpose a
minimum of 1us by itself -- setting ->min_delta_ticks to 1 is safe here.

Initialize ->min_delta_ticks and ->max_delta_ticks with these values.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/tile/kernel/time.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index 5bd4e88c7c60..6643ffbc0615 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -155,6 +155,8 @@ static DEFINE_PER_CPU(struct clock_event_device, tile_timer) = {
.name = "tile timer",
.features = CLOCK_EVT_FEAT_ONESHOT,
.min_delta_ns = 1000,
+ .min_delta_ticks = 1,
+ .max_delta_ticks = MAX_TICK,
.rating = 100,
.irq = -1,
.set_next_event = tile_timer_set_next_event,
--
2.12.0

2017-03-30 19:59:48

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] um/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the uml arch's clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/um/kernel/time.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index ba87a27d6715..0b034ebbda2a 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -65,7 +65,9 @@ static struct clock_event_device timer_clockevent = {
.set_next_event = itimer_next_event,
.shift = 0,
.max_delta_ns = 0xffffffff,
- .min_delta_ns = TIMER_MIN_DELTA, //microsecond resolution should be enough for anyone, same as 640K RAM
+ .max_delta_ticks = 0xffffffff,
+ .min_delta_ns = TIMER_MIN_DELTA,
+ .min_delta_ticks = TIMER_MIN_DELTA, // microsecond resolution should be enough for anyone, same as 640K RAM
.irq = 0,
.mult = 1,
};
--
2.12.0

2017-03-30 20:01:19

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] unicore32/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the unicore32 arch's clockevent driver initialize these fields
properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/unicore32/kernel/time.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/unicore32/kernel/time.c b/arch/unicore32/kernel/time.c
index fceaa673f861..c6b3fa3ee0b6 100644
--- a/arch/unicore32/kernel/time.c
+++ b/arch/unicore32/kernel/time.c
@@ -91,8 +91,10 @@ void __init time_init(void)

ckevt_puv3_osmr0.max_delta_ns =
clockevent_delta2ns(0x7fffffff, &ckevt_puv3_osmr0);
+ ckevt_puv3_osmr0.max_delta_ticks = 0x7fffffff;
ckevt_puv3_osmr0.min_delta_ns =
clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_puv3_osmr0) + 1;
+ ckevt_puv3_osmr0.min_delta_ticks = MIN_OSCR_DELTA * 2;
ckevt_puv3_osmr0.cpumask = cpumask_of(0);

setup_irq(IRQ_TIMER0, &puv3_timer_irq);
--
2.12.0

2017-03-30 20:03:52

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] x86/lguest/timer: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the x86 arch's lguest clockevent driver initialize these fields
properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/x86/lguest/boot.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index d3289d7e78fa..3e4bf887a246 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -994,7 +994,9 @@ static struct clock_event_device lguest_clockevent = {
.mult = 1,
.shift = 0,
.min_delta_ns = LG_CLOCK_MIN_DELTA,
+ .min_delta_ticks = LG_CLOCK_MIN_DELTA,
.max_delta_ns = LG_CLOCK_MAX_DELTA,
+ .max_delta_ticks = LG_CLOCK_MAX_DELTA,
};

/*
--
2.12.0

2017-03-30 20:05:05

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] x86/uv/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Currently, the x86's uv rtc clockevent device is initialized as follows:

clock_event_device_uv.min_delta_ns = NSEC_PER_SEC /
sn_rtc_cycles_per_second;
clock_event_device_uv.max_delta_ns = clocksource_uv.mask *
(NSEC_PER_SEC / sn_rtc_cycles_per_second);

This translates to a ->min_delta_ticks value of 1 and a ->max_delta_ticks
value of clocksource_uv.mask.

Initialize ->min_delta_ticks and ->max_delta_ticks with these values
respectively.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/x86/platform/uv/uv_time.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c
index 2ee7632d4916..b082d71b08ee 100644
--- a/arch/x86/platform/uv/uv_time.c
+++ b/arch/x86/platform/uv/uv_time.c
@@ -390,9 +390,11 @@ static __init int uv_rtc_setup_clock(void)

clock_event_device_uv.min_delta_ns = NSEC_PER_SEC /
sn_rtc_cycles_per_second;
+ clock_event_device_uv.min_delta_ticks = 1;

clock_event_device_uv.max_delta_ns = clocksource_uv.mask *
(NSEC_PER_SEC / sn_rtc_cycles_per_second);
+ clock_event_device_uv.max_delta_ticks = clocksource_uv.mask;

rc = schedule_on_each_cpu(uv_rtc_register_clockevents);
if (rc) {
--
2.12.0

2017-03-30 20:06:50

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] x86/xen/time: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the x86 arch's xen clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

arch/x86/xen/time.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 1e69956d7852..7a3089285c59 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -209,7 +209,9 @@ static const struct clock_event_device xen_timerop_clockevent = {
.features = CLOCK_EVT_FEAT_ONESHOT,

.max_delta_ns = 0xffffffff,
+ .max_delta_ticks = 0xffffffff,
.min_delta_ns = TIMER_SLOP,
+ .min_delta_ticks = TIMER_SLOP,

.mult = 1,
.shift = 0,
@@ -268,7 +270,9 @@ static const struct clock_event_device xen_vcpuop_clockevent = {
.features = CLOCK_EVT_FEAT_ONESHOT,

.max_delta_ns = 0xffffffff,
+ .max_delta_ticks = 0xffffffff,
.min_delta_ns = TIMER_SLOP,
+ .min_delta_ticks = TIMER_SLOP,

.mult = 1,
.shift = 0,
--
2.12.0

2017-03-30 20:07:56

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] clockevents/drivers/dw_apb: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the dw_apb clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

drivers/clocksource/dw_apb_timer.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clocksource/dw_apb_timer.c b/drivers/clocksource/dw_apb_timer.c
index 63e4f5519577..880f37e8278f 100644
--- a/drivers/clocksource/dw_apb_timer.c
+++ b/drivers/clocksource/dw_apb_timer.c
@@ -257,7 +257,9 @@ dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
clockevents_calc_mult_shift(&dw_ced->ced, freq, APBT_MIN_PERIOD);
dw_ced->ced.max_delta_ns = clockevent_delta2ns(0x7fffffff,
&dw_ced->ced);
+ dw_ced->ced.max_delta_ticks = 0x7fffffff;
dw_ced->ced.min_delta_ns = clockevent_delta2ns(5000, &dw_ced->ced);
+ dw_ced->ced.min_delta_ticks = 5000;
dw_ced->ced.cpumask = cpumask_of(cpu);
dw_ced->ced.features = CLOCK_EVT_FEAT_PERIODIC |
CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_DYNIRQ;
--
2.12.0

2017-03-30 20:08:26

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] clockevents/drivers/metag: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the metag_generic clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

drivers/clocksource/metag_generic.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
index 6fcf96540631..3e5fa2f62d5f 100644
--- a/drivers/clocksource/metag_generic.c
+++ b/drivers/clocksource/metag_generic.c
@@ -114,7 +114,9 @@ static int arch_timer_starting_cpu(unsigned int cpu)

clk->mult = div_sc(hwtimer_freq, NSEC_PER_SEC, clk->shift);
clk->max_delta_ns = clockevent_delta2ns(0x7fffffff, clk);
+ clk->max_delta_ticks = 0x7fffffff;
clk->min_delta_ns = clockevent_delta2ns(0xf, clk);
+ clk->min_delta_ticks = 0xf;
clk->cpumask = cpumask_of(cpu);

clockevents_register_device(clk);
--
2.12.0

2017-03-30 20:08:55

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] x86/numachip timer: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the numachip clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

drivers/clocksource/numachip.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clocksource/numachip.c b/drivers/clocksource/numachip.c
index 4e0f11fd2617..6a20dc8b253f 100644
--- a/drivers/clocksource/numachip.c
+++ b/drivers/clocksource/numachip.c
@@ -51,7 +51,9 @@ static struct clock_event_device numachip2_clockevent = {
.mult = 1,
.shift = 0,
.min_delta_ns = 1250,
+ .min_delta_ticks = 1250,
.max_delta_ns = LONG_MAX,
+ .max_delta_ticks = LONG_MAX,
};

static void numachip_timer_interrupt(void)
--
2.12.0

2017-03-30 20:09:19

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] clockevents/drivers/sh_cmt: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the sh_cmt clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Attention: due to 890f423b2666 ("clocksource: sh_cmt: Compute rate before
registration again"), this should go through John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

drivers/clocksource/sh_cmt.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index e3bf3baa12cc..e09e8bf0bb9b 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -815,7 +815,9 @@ static int sh_cmt_register_clockevent(struct sh_cmt_channel *ch,
ced->shift = 32;
ced->mult = div_sc(ch->cmt->rate, NSEC_PER_SEC, ced->shift);
ced->max_delta_ns = clockevent_delta2ns(ch->max_match_value, ced);
+ ced->max_delta_ticks = ch->max_match_value;
ced->min_delta_ns = clockevent_delta2ns(0x1f, ced);
+ ced->min_delta_ticks = 0x1f;

dev_info(&ch->cmt->pdev->dev, "ch%u: used for clock events\n",
ch->index);
--
2.12.0

2017-03-30 20:10:29

by Nicolai Stange

[permalink] [raw]
Subject: [PATCH] clockevents/drivers/atlas7: set ->min_delta_ticks and ->max_delta_ticks

In preparation for making the clockevents core NTP correction aware,
all clockevent device drivers must set ->min_delta_ticks and
->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
clockevent device's rate is going to change dynamically and thus, the
ratio of ns to ticks ceases to stay invariant.

Make the timer-atlas7 clockevent driver initialize these fields properly.

This patch alone doesn't introduce any change in functionality as the
clockevents core still looks exclusively at the (untouched) ->min_delta_ns
and ->max_delta_ns. As soon as this has changed, a followup patch will
purge the initialization of ->min_delta_ns and ->max_delta_ns from this
driver.

Signed-off-by: Nicolai Stange <[email protected]>
---

Notes:
This prerequisite patch is part of a larger effort to feed NTP
corrections into the clockevent devices' frequencies and thus
avoiding their notion of time to diverge from the system's
one. If you're interested, the current state of the whole series
can be found at [1].

If you haven't got any objections and these prerequisites get
merged by 4.12 everywhere, I'll proceed with the remainder of
this series in 4.13.

Applicable to next-20170324 as well as to John' Stultz tree [2].

[1]
git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time

[2]
https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time

drivers/clocksource/timer-atlas7.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clocksource/timer-atlas7.c b/drivers/clocksource/timer-atlas7.c
index 3d8a181f0252..50300eec4a39 100644
--- a/drivers/clocksource/timer-atlas7.c
+++ b/drivers/clocksource/timer-atlas7.c
@@ -192,7 +192,9 @@ static int sirfsoc_local_timer_starting_cpu(unsigned int cpu)
ce->set_next_event = sirfsoc_timer_set_next_event;
clockevents_calc_mult_shift(ce, atlas7_timer_rate, 60);
ce->max_delta_ns = clockevent_delta2ns(-2, ce);
+ ce->max_delta_ticks = (unsigned long)-2;
ce->min_delta_ns = clockevent_delta2ns(2, ce);
+ ce->min_delta_ticks = 2;
ce->cpumask = cpumask_of(cpu);

action->dev_id = ce;
--
2.12.0

2017-03-30 23:00:53

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [PATCH] x86/xen/time: set ->min_delta_ticks and ->max_delta_ticks

On 03/30/2017 04:06 PM, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the x86 arch's xen clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>

Reviewed-by: Boris Ostrovsky <[email protected]>


2017-03-31 01:10:48

by Greg Ungerer

[permalink] [raw]
Subject: Re: [PATCH] m68k/coldfire/pit: set ->min_delta_ticks and ->max_delta_ticks

Hi Nicolai,

On 31/03/17 05:44, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the m68k arch's coldfire clockevent driver initialize these fields
> properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>

Looks ok to me.

Acked-by: Greg Ungerer <[email protected]>

Are you pushing this through some other git tree?
Or do you want me to push up to Linus?

Regards
Greg



> ---
>
> Notes:
> This prerequisite patch is part of a larger effort to feed NTP
> corrections into the clockevent devices' frequencies and thus
> avoiding their notion of time to diverge from the system's
> one. If you're interested, the current state of the whole series
> can be found at [1].
>
> If you haven't got any objections and these prerequisites get
> merged by 4.12 everywhere, I'll proceed with the remainder of
> this series in 4.13.
>
> Applicable to next-20170324 as well as to John' Stultz tree [2].
>
> [1]
> git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
> https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time
>
> [2]
> https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time
>
> arch/m68k/coldfire/pit.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/m68k/coldfire/pit.c b/arch/m68k/coldfire/pit.c
> index 175553d5b8ed..6c0878018b44 100644
> --- a/arch/m68k/coldfire/pit.c
> +++ b/arch/m68k/coldfire/pit.c
> @@ -149,8 +149,10 @@ void hw_timer_init(irq_handler_t handler)
> cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32);
> cf_pit_clockevent.max_delta_ns =
> clockevent_delta2ns(0xFFFF, &cf_pit_clockevent);
> + cf_pit_clockevent.max_delta_ticks = 0xFFFF;
> cf_pit_clockevent.min_delta_ns =
> clockevent_delta2ns(0x3f, &cf_pit_clockevent);
> + cf_pit_clockevent.min_delta_ticks = 0x3f;
> clockevents_register_device(&cf_pit_clockevent);
>
> setup_irq(MCF_IRQ_PIT1, &pit_irq);
>

2017-03-31 02:35:21

by Xuetao Guan

[permalink] [raw]
Subject: Re: [PATCH] unicore32/time: set ->min_delta_ticks and ->max_delta_ticks

> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the unicore32 arch's clockevent driver initialize these fields
> properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>

Thanks,
Acked-by: Guan Xuetao <[email protected]>

> ---
>
> Notes:
> This prerequisite patch is part of a larger effort to feed NTP
> corrections into the clockevent devices' frequencies and thus
> avoiding their notion of time to diverge from the system's
> one. If you're interested, the current state of the whole series
> can be found at [1].
>
> If you haven't got any objections and these prerequisites get
> merged by 4.12 everywhere, I'll proceed with the remainder of
> this series in 4.13.
>
> Applicable to next-20170324 as well as to John' Stultz tree [2].
>
> [1]
> git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
> https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time
>
> [2]
> https://git.linaro.org/people/john.stultz/linux.git
> fortglx/4.12/time
>
> arch/unicore32/kernel/time.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/unicore32/kernel/time.c b/arch/unicore32/kernel/time.c
> index fceaa673f861..c6b3fa3ee0b6 100644
> --- a/arch/unicore32/kernel/time.c
> +++ b/arch/unicore32/kernel/time.c
> @@ -91,8 +91,10 @@ void __init time_init(void)
>
> ckevt_puv3_osmr0.max_delta_ns =
> clockevent_delta2ns(0x7fffffff, &ckevt_puv3_osmr0);
> + ckevt_puv3_osmr0.max_delta_ticks = 0x7fffffff;
> ckevt_puv3_osmr0.min_delta_ns =
> clockevent_delta2ns(MIN_OSCR_DELTA * 2, &ckevt_puv3_osmr0) + 1;
> + ckevt_puv3_osmr0.min_delta_ticks = MIN_OSCR_DELTA * 2;
> ckevt_puv3_osmr0.cpumask = cpumask_of(0);
>
> setup_irq(IRQ_TIMER0, &puv3_timer_irq);
> --
> 2.12.0
>

2017-03-31 03:03:30

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH] powerpc/time: set ->min_delta_ticks and ->max_delta_ticks

Nicolai Stange <[email protected]> writes:

> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the powerpc arch's clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>
> ---
>
> Notes:
> This prerequisite patch is part of a larger effort to feed NTP
> corrections into the clockevent devices' frequencies and thus
> avoiding their notion of time to diverge from the system's
> one. If you're interested, the current state of the whole series
> can be found at [1].
>
> If you haven't got any objections and these prerequisites get
> merged by 4.12 everywhere, I'll proceed with the remainder of
> this series in 4.13.
>
> Applicable to next-20170324 as well as to John' Stultz tree [2].
>
> [1]
> git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
> https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time
>
> [2]
> https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time
>
> arch/powerpc/kernel/time.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
> index 07b90725855e..2b33cfaac7b8 100644
> --- a/arch/powerpc/kernel/time.c
> +++ b/arch/powerpc/kernel/time.c
> @@ -995,8 +995,10 @@ static void __init init_decrementer_clockevent(void)
>
> decrementer_clockevent.max_delta_ns =
> clockevent_delta2ns(decrementer_max, &decrementer_clockevent);
> + decrementer_clockevent.max_delta_ticks = decrementer_max;
> decrementer_clockevent.min_delta_ns =
> clockevent_delta2ns(2, &decrementer_clockevent);
> + decrementer_clockevent.min_delta_ticks = 2;

Seems to do what it says on the tin.

Acked-by: Michael Ellerman <[email protected]> (powerpc)


cheers

2017-04-01 19:18:58

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] sparc/time: set ->min_delta_ticks and ->max_delta_ticks

From: Nicolai Stange <[email protected]>
Date: Thu, 30 Mar 2017 21:56:47 +0200

> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the sparc arch's clockevent drivers initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from these
> drivers.
>
> Signed-off-by: Nicolai Stange <[email protected]>

Acked-by: David S. Miller <[email protected]>

2017-04-02 23:42:12

by Rusty Russell

[permalink] [raw]
Subject: Re: [PATCH] x86/lguest/timer: set ->min_delta_ticks and ->max_delta_ticks

Nicolai Stange <[email protected]> writes:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the x86 arch's lguest clockevent driver initialize these fields
> properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.

Acked-by: Rusty Russell <[email protected]>

>
> Signed-off-by: Nicolai Stange <[email protected]>
> ---
>
> Notes:
> This prerequisite patch is part of a larger effort to feed NTP
> corrections into the clockevent devices' frequencies and thus
> avoiding their notion of time to diverge from the system's
> one. If you're interested, the current state of the whole series
> can be found at [1].
>
> If you haven't got any objections and these prerequisites get
> merged by 4.12 everywhere, I'll proceed with the remainder of
> this series in 4.13.
>
> Applicable to next-20170324 as well as to John' Stultz tree [2].
>
> [1]
> git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
> https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time
>
> [2]
> https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time
>
> arch/x86/lguest/boot.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
> index d3289d7e78fa..3e4bf887a246 100644
> --- a/arch/x86/lguest/boot.c
> +++ b/arch/x86/lguest/boot.c
> @@ -994,7 +994,9 @@ static struct clock_event_device lguest_clockevent = {
> .mult = 1,
> .shift = 0,
> .min_delta_ns = LG_CLOCK_MIN_DELTA,
> + .min_delta_ticks = LG_CLOCK_MIN_DELTA,
> .max_delta_ns = LG_CLOCK_MAX_DELTA,
> + .max_delta_ticks = LG_CLOCK_MAX_DELTA,
> };
>
> /*
> --
> 2.12.0

Subject: Re: [PATCH] avr32/time: set ->min_delta_ticks and ->max_delta_ticks

Around Thu 30 Mar 2017 21:39:33 +0200 or thereabout, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the avr32 arch's clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>

-1

Please do not spend time on AVR32 architecture. It will be removed in the
next merge window.

<snipp diff>

--
Best regards,
Hans-Christian Noren Egtvedt

2017-04-03 15:49:23

by Richard Kuo

[permalink] [raw]
Subject: Re: [PATCH] hexagon/time: set ->min_delta_ticks and ->max_delta_ticks

On Thu, Mar 30, 2017 at 09:43:32PM +0200, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the hexagon arch's clockevent driver initialize these fields
> properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>
> ---
>
> Notes:
> This prerequisite patch is part of a larger effort to feed NTP
> corrections into the clockevent devices' frequencies and thus
> avoiding their notion of time to diverge from the system's
> one. If you're interested, the current state of the whole series
> can be found at [1].
>
> If you haven't got any objections and these prerequisites get
> merged by 4.12 everywhere, I'll proceed with the remainder of
> this series in 4.13.
>
> Applicable to next-20170324 as well as to John' Stultz tree [2].
>
> [1]
> git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
> https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time
>
> [2]
> https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time
>
> arch/hexagon/kernel/time.c | 2 ++
> 1 file changed, 2 insertions(+)

Acked-by: Richard Kuo <[email protected]>


--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

2017-04-06 09:12:02

by Juergen Gross

[permalink] [raw]
Subject: Re: [PATCH] x86/xen/time: set ->min_delta_ticks and ->max_delta_ticks

On 30/03/17 22:06, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the x86 arch's xen clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>

Shall I carry this patch through the Xen tree or will it be processed
via the tip tree? I'm fine with both variants.


Juergen

> ---
>
> Notes:
> This prerequisite patch is part of a larger effort to feed NTP
> corrections into the clockevent devices' frequencies and thus
> avoiding their notion of time to diverge from the system's
> one. If you're interested, the current state of the whole series
> can be found at [1].
>
> If you haven't got any objections and these prerequisites get
> merged by 4.12 everywhere, I'll proceed with the remainder of
> this series in 4.13.
>
> Applicable to next-20170324 as well as to John' Stultz tree [2].
>
> [1]
> git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
> https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time
>
> [2]
> https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time
>
> arch/x86/xen/time.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
> index 1e69956d7852..7a3089285c59 100644
> --- a/arch/x86/xen/time.c
> +++ b/arch/x86/xen/time.c
> @@ -209,7 +209,9 @@ static const struct clock_event_device xen_timerop_clockevent = {
> .features = CLOCK_EVT_FEAT_ONESHOT,
>
> .max_delta_ns = 0xffffffff,
> + .max_delta_ticks = 0xffffffff,
> .min_delta_ns = TIMER_SLOP,
> + .min_delta_ticks = TIMER_SLOP,
>
> .mult = 1,
> .shift = 0,
> @@ -268,7 +270,9 @@ static const struct clock_event_device xen_vcpuop_clockevent = {
> .features = CLOCK_EVT_FEAT_ONESHOT,
>
> .max_delta_ns = 0xffffffff,
> + .max_delta_ticks = 0xffffffff,
> .min_delta_ns = TIMER_SLOP,
> + .min_delta_ticks = TIMER_SLOP,
>
> .mult = 1,
> .shift = 0,
>

2017-04-07 13:14:41

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] microblaze/timer: set ->min_delta_ticks and ->max_delta_ticks

On Thu, Mar 30, 2017 at 09:45:28PM +0200, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the microblaze arch's clockevent driver initialize these fields
> properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>
> ---
>
> Notes:
> This prerequisite patch is part of a larger effort to feed NTP
> corrections into the clockevent devices' frequencies and thus
> avoiding their notion of time to diverge from the system's
> one. If you're interested, the current state of the whole series
> can be found at [1].
>
> If you haven't got any objections and these prerequisites get
> merged by 4.12 everywhere, I'll proceed with the remainder of
> this series in 4.13.
>
> Applicable to next-20170324 as well as to John' Stultz tree [2].
>
> [1]
> git://nicst.de/linux.git cev-freq-adj.v10.fortglx-4.12-time
> https://nicst.de/git/?p=linux.git;a=shortlog;h=refs/heads/cev-freq-adj.v10.fortglx-4.12-time
>
> [2]
> https://git.linaro.org/people/john.stultz/linux.git fortglx/4.12/time
>
> arch/microblaze/kernel/timer.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
> index 999066192715..545ccd46edb3 100644
> --- a/arch/microblaze/kernel/timer.c
> +++ b/arch/microblaze/kernel/timer.c
> @@ -178,8 +178,10 @@ static __init int xilinx_clockevent_init(void)
> clockevent_xilinx_timer.shift);
> clockevent_xilinx_timer.max_delta_ns =
> clockevent_delta2ns((u32)~0, &clockevent_xilinx_timer);
> + clockevent_xilinx_timer.max_delta_ticks = (u32)~0;

Can you take the opportunity to fix the type (unsigned long) ?

> clockevent_xilinx_timer.min_delta_ns =
> clockevent_delta2ns(1, &clockevent_xilinx_timer);
> + clockevent_xilinx_timer.min_delta_ticks = 1;
> clockevent_xilinx_timer.cpumask = cpumask_of(0);
> clockevents_register_device(&clockevent_xilinx_timer);
>
> --
> 2.12.0
>

--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

2017-04-07 13:20:22

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] clockevents/drivers/dw_apb: set ->min_delta_ticks and ->max_delta_ticks

On Thu, Mar 30, 2017 at 10:07:49PM +0200, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the dw_apb clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>

Acked-by: Daniel Lezcano <[email protected]>

--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

2017-04-07 13:21:10

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] clockevents/drivers/metag: set ->min_delta_ticks and ->max_delta_ticks

On Thu, Mar 30, 2017 at 10:08:20PM +0200, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the metag_generic clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>
> ---

Acked-by: Daniel Lezcano <[email protected]>

--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

2017-04-07 13:21:50

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] x86/numachip timer: set ->min_delta_ticks and ->max_delta_ticks

On Thu, Mar 30, 2017 at 10:08:49PM +0200, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the numachip clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>
> ---

Acked-by: Daniel Lezcano <[email protected]>

--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

2017-04-07 13:22:31

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] clockevents/drivers/sh_cmt: set ->min_delta_ticks and ->max_delta_ticks

On Thu, Mar 30, 2017 at 10:09:12PM +0200, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the sh_cmt clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>
> ---

Acked-by: Daniel Lezcano <[email protected]>

--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

2017-04-07 13:23:29

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] clockevents/drivers/atlas7: set ->min_delta_ticks and ->max_delta_ticks

On Thu, Mar 30, 2017 at 10:10:21PM +0200, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the timer-atlas7 clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>
> ---

Acked-by: Daniel Lezcano <[email protected]>

--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

2017-04-11 05:09:21

by Juergen Gross

[permalink] [raw]
Subject: Re: [PATCH] x86/xen/time: set ->min_delta_ticks and ->max_delta_ticks

On 30/03/17 22:06, Nicolai Stange wrote:
> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the x86 arch's xen clockevent driver initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from this
> driver.
>
> Signed-off-by: Nicolai Stange <[email protected]>

Applied to xen/tip for-linus-4.12


Thanks,

Juergen

2017-04-12 20:10:45

by Ralf Baechle

[permalink] [raw]
Subject: Re: [PATCH] MIPS: clockevent drivers: set ->min_delta_ticks and ->max_delta_ticks

On Thu, Mar 30, 2017 at 09:47:32PM +0200, Nicolai Stange wrote:

> In preparation for making the clockevents core NTP correction aware,
> all clockevent device drivers must set ->min_delta_ticks and
> ->max_delta_ticks rather than ->min_delta_ns and ->max_delta_ns: a
> clockevent device's rate is going to change dynamically and thus, the
> ratio of ns to ticks ceases to stay invariant.
>
> Make the MIPS arch's clockevent drivers initialize these fields properly.
>
> This patch alone doesn't introduce any change in functionality as the
> clockevents core still looks exclusively at the (untouched) ->min_delta_ns
> and ->max_delta_ns. As soon as this has changed, a followup patch will
> purge the initialization of ->min_delta_ns and ->max_delta_ns from these
> drivers.
>
> Signed-off-by: Nicolai Stange <[email protected]>

Acked-by: Ralf Baechle <[email protected]>

Feel free to push this to Linus.

Ralf

2017-04-16 02:47:18

by Nicolai Stange

[permalink] [raw]
Subject: Re: [PATCH] microblaze/timer: set ->min_delta_ticks and ->max_delta_ticks

Hello Daniel,

On Fri, Apr 07 2017, Daniel Lezcano wrote:

> On Thu, Mar 30, 2017 at 09:45:28PM +0200, Nicolai Stange wrote:
>> diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
>> index 999066192715..545ccd46edb3 100644
>> --- a/arch/microblaze/kernel/timer.c
>> +++ b/arch/microblaze/kernel/timer.c
>> @@ -178,8 +178,10 @@ static __init int xilinx_clockevent_init(void)
>> clockevent_xilinx_timer.shift);
>> clockevent_xilinx_timer.max_delta_ns =
>> clockevent_delta2ns((u32)~0, &clockevent_xilinx_timer);
>> + clockevent_xilinx_timer.max_delta_ticks = (u32)~0;
>
> Can you take the opportunity to fix the type (unsigned long) ?

Hmm, I personally think that it'd be better to leave the u32 there as it
corresponds to the hardware's counter width?

clockevent_delta2ns()' latch argument has been of type unsigned long
from the beginning and this might indicate that at least this
driver's original author followed this line of reasoning...

OTOH, I think that u32 is equivalent to unsigned long on microblaze, so
it doesn't matter much.

Does the above convince you or do you still want the

- clockevent_xilinx_timer.max_delta_ticks = (u32)~0;
+ clockevent_xilinx_timer.max_delta_ticks = ~0UL;

change?


Thanks,

Nicolai

2017-04-16 09:46:52

by Daniel Lezcano

[permalink] [raw]
Subject: Re: [PATCH] microblaze/timer: set ->min_delta_ticks and ->max_delta_ticks

On Sun, Apr 16, 2017 at 04:47:11AM +0200, Nicolai Stange wrote:
> Hello Daniel,
>
> On Fri, Apr 07 2017, Daniel Lezcano wrote:
>
> > On Thu, Mar 30, 2017 at 09:45:28PM +0200, Nicolai Stange wrote:
> >> diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
> >> index 999066192715..545ccd46edb3 100644
> >> --- a/arch/microblaze/kernel/timer.c
> >> +++ b/arch/microblaze/kernel/timer.c
> >> @@ -178,8 +178,10 @@ static __init int xilinx_clockevent_init(void)
> >> clockevent_xilinx_timer.shift);
> >> clockevent_xilinx_timer.max_delta_ns =
> >> clockevent_delta2ns((u32)~0, &clockevent_xilinx_timer);
> >> + clockevent_xilinx_timer.max_delta_ticks = (u32)~0;
> >
> > Can you take the opportunity to fix the type (unsigned long) ?
>
> Hmm, I personally think that it'd be better to leave the u32 there as it
> corresponds to the hardware's counter width?
>
> clockevent_delta2ns()' latch argument has been of type unsigned long
> from the beginning and this might indicate that at least this
> driver's original author followed this line of reasoning...
>
> OTOH, I think that u32 is equivalent to unsigned long on microblaze, so
> it doesn't matter much.
>
> Does the above convince you or do you still want the

Yeah, I was nitpicking.

Acked-by: Daniel Lezcano <[email protected]>

--

<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog