Skip to contentSkip to conversation

ARM: dts: stm32: Enable high resolution timer

PATCH In review Benjamin Gaignard 3 participants 9 messages Sep 27, 2019 – Oct 14, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dts: stm32: Enable high resolution timer

Adding always-on makes arm arch_timer claim to be an high resolution timer. That is possible because power mode won't stop clocking the timer.

---
 arch/arm/boot/dts/stm32mp157c.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/stm32mp157c.dtsi +1 -0
index 9b11654a0a39..74f64745d60d 100644
@@ -50,6 +50,7 @@
 			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
 		interrupt-parent = <&intc>;
+		always-on;
 	};
 
 	clocks {
Signature · 1 line
2.15.0
#1 lore raw
Quoted 2 lines · Benjamin Gaignard

Adding always-on makes arm arch_timer claim to be an high resolution timer. That is possible because power mode won't stop clocking the timer.

The "always-on" is not about the clock. It is about the comparator. The clock itself is *guaranteed* to always tick. If it didn't, that'd be an integration bug, and a pretty bad one.

What you're claiming here is that your CPU never enters a low-power mode? Ever? I find this very hard to believe.

Furthermore, claiming that always-on is the way to force the arch-timer to be an hrtimer is factually wrong. This is what happens *if* this is the only timer in the system. The only case this is true is for virtual machines. Anything else has a global timer somewhere that will allow the arch timers to be used as an hrtimer.

I'm pretty sure you too have a global timer somewhere in your system. Enable it, and enjoy hrtimers without having to lie about the properties of your system! ;-)

        M.
Quoted 19 lines
---
 arch/arm/boot/dts/stm32mp157c.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/stm32mp157c.dtsi +1 -0
index 9b11654a0a39..74f64745d60d 100644
@@ -50,6 +50,7 @@
 			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
 			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
 		interrupt-parent = <&intc>;
+		always-on;
 	};
 
 	clocks {
Signature · 1 line
Jazz is not dead. It just smells funny...
#2 lore raw
Quoted 18 lines · Marc Zyngier
Quoted 3 lines · Benjamin Gaignard

Adding always-on makes arm arch_timer claim to be an high resolution timer.
That is possible because power mode won't stop clocking the timer.

The "always-on" is not about the clock. It is about the comparator. The clock itself is *guaranteed* to always tick. If it didn't, that'd be an integration bug, and a pretty bad one.

What you're claiming here is that your CPU never enters a low-power mode? Ever? I find this very hard to believe.

Furthermore, claiming that always-on is the way to force the arch-timer to be an hrtimer is factually wrong. This is what happens *if* this is the only timer in the system. The only case this is true is for virtual machines. Anything else has a global timer somewhere that will allow the arch timers to be used as an hrtimer.

Quoted 3 lines

I'm pretty sure you too have a global timer somewhere in your system. Enable it, and enjoy hrtimers without having to lie about the properties of your system! ;-)

Hi Marc,

This SoC doesn't have any other global timer. Use arch_time is the only we have to provide hrtimer on this system.

Benjamin

Quoted 25 lines

        M.

Quoted 21 lines

---
 arch/arm/boot/dts/stm32mp157c.dtsi | 1 +

 1 file changed, 1 insertion(+)
arch/arm/boot/dts/stm32mp157c.dtsi +0 -0
index 9b11654a0a39..74f64745d60d 100644
@@ -50,6 +50,7 @@

                  <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
                  <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
         interrupt-parent = <&intc>;
+        always-on;
     };

     clocks {

#3 lore raw
Quoted 19 lines · Benjamin GAIGNARD
Quoted 18 lines · Marc Zyngier
Quoted 3 lines · Benjamin Gaignard

Adding always-on makes arm arch_timer claim to be an high resolution timer.
That is possible because power mode won't stop clocking the timer.

The "always-on" is not about the clock. It is about the comparator. The clock itself is *guaranteed* to always tick. If it didn't, that'd be an integration bug, and a pretty bad one.

What you're claiming here is that your CPU never enters a low-power mode? Ever? I find this very hard to believe.

Furthermore, claiming that always-on is the way to force the arch-timer to be an hrtimer is factually wrong. This is what happens *if* this is the only timer in the system. The only case this is true is for virtual machines. Anything else has a global timer somewhere that will allow the arch timers to be used as an hrtimer.

Quoted 8 lines
Quoted 3 lines

I'm pretty sure you too have a global timer somewhere in your system. Enable it, and enjoy hrtimers without having to lie about the properties of your system! ;-)

Hi Marc,

This SoC doesn't have any other global timer. Use arch_time is the only we have to provide hrtimer on this system.

And you don't have any form of power management either? What happens when your CPU goes into idle? If your system does any form of power management *and* doesn't have a separate timer, it is remarkably broken.

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#4 lore raw
Quoted 27 lines · Marc Zyngier
Quoted 26 lines · Benjamin GAIGNARD
Quoted 24 lines · Marc Zyngier
Quoted 3 lines · Benjamin Gaignard

Adding always-on makes arm arch_timer claim to be an high resolution timer.
That is possible because power mode won't stop clocking the timer.

The "always-on" is not about the clock. It is about the comparator. The clock itself is *guaranteed* to always tick. If it didn't, that'd be
an integration bug, and a pretty bad one.

What you're claiming here is that your CPU never enters a low-power mode?
Ever? I find this very hard to believe.

Furthermore, claiming that always-on is the way to force the arch-timer to be an hrtimer is factually wrong. This is what happens *if* this is the only timer in the system. The only case this is true is for virtual machines. Anything else has a global timer somewhere that will allow the arch timers to be used as an hrtimer.

I'm pretty sure you too have a global timer somewhere in your system. Enable it, and enjoy hrtimers without having to lie about the properties
of your system! ;-)

Quoted 8 lines
Quoted 4 lines

Hi Marc,

This SoC doesn't have any other global timer. Use arch_time is the only we have to provide hrtimer on this system.

And you don't have any form of power management either? What happens when your CPU goes into idle? If your system does any form of power management *and* doesn't have a separate timer, it is remarkably broken.

Even in low-power modes this timer is always powered and clocked so it is working fine.

Quoted 2 lines

        M.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw
Quoted 33 lines · Benjamin GAIGNARD
Quoted 32 lines · Marc Zyngier
Quoted 30 lines · Benjamin GAIGNARD
Quoted 20 lines · Marc Zyngier
Quoted 3 lines · Benjamin Gaignard

Adding always-on makes arm arch_timer claim to be an high resolution timer.
That is possible because power mode won't stop clocking the timer.

The "always-on" is not about the clock. It is about the comparator. The clock itself is *guaranteed* to always tick. If it didn't, that'd be
an integration bug, and a pretty bad one.

What you're claiming here is that your CPU never enters a low-power mode?
Ever? I find this very hard to believe.

Furthermore, claiming that always-on is the way to force the arch-timer to be an hrtimer is factually wrong. This is what happens *if* this is the only timer in the system. The only case this is true is for virtual machines. Anything else has a global timer somewhere that will allow the arch timers to be used as an hrtimer.

Quoted 4 lines

I'm pretty sure you too have a global timer somewhere in your system. Enable it, and enjoy hrtimers without having to lie about the properties
of your system! ;-)

Hi Marc,

This SoC doesn't have any other global timer. Use arch_time is the only we have to provide hrtimer on this system.

Quoted 6 lines
Quoted 3 lines

And you don't have any form of power management either? What happens when your CPU goes into idle? If your system does any form of power management *and* doesn't have a separate timer, it is remarkably broken.

Even in low-power modes this timer is always powered and clocked so it is working fine.

You're missing the point again. It is not about the clock, but the comparator that is internal to the CPU, and not functional when the CPU is in its lowest power mode. See also the verbiage in [1] (44.3 STGEN functional description), which indicates that the clock source actually dies in low-power mode (going against the architecture which mandates it to be always-on).

Also, coming back to your earlier assertion ("This SoC doesn't have any other global timer"): The documentation at [1] shows at least 17 timers that could be used and avoid this dirty hack.

So for what it is worth, NAK to this patch.

        M.

[1] https://www.st.com/resource/en/reference_manual/dm00366355.pdf

Signature · 1 line
Jazz is not dead. It just smells funny...
#6 lore raw
Quoted 57 lines · Marc Zyngier
Quoted 37 lines · Benjamin GAIGNARD
Quoted 36 lines · Marc Zyngier
Quoted 34 lines · Benjamin GAIGNARD
Quoted 23 lines · Marc Zyngier
Quoted 3 lines · Benjamin Gaignard

Adding always-on makes arm arch_timer claim to be an high resolution timer.
That is possible because power mode won't stop clocking the timer.

The "always-on" is not about the clock. It is about the comparator. The clock itself is *guaranteed* to always tick. If it didn't, that'd be
an integration bug, and a pretty bad one.

What you're claiming here is that your CPU never enters a low-power mode?
Ever? I find this very hard to believe.

Furthermore, claiming that always-on is the way to force the arch-timer
to be an hrtimer is factually wrong. This is what happens *if* this is
the only timer in the system. The only case this is true is for virtual
machines. Anything else has a global timer somewhere that will allow the arch timers to be used as an hrtimer.

Quoted 4 lines

I'm pretty sure you too have a global timer somewhere in your system. Enable it, and enjoy hrtimers without having to lie about the properties
of your system! ;-)

Hi Marc,

This SoC doesn't have any other global timer. Use arch_time is the only
we have to provide hrtimer on this system.

Quoted 8 lines
Quoted 5 lines

And you don't have any form of power management either? What happens when
your CPU goes into idle? If your system does any form of power management
*and* doesn't have a separate timer, it is remarkably broken.

Even in low-power modes this timer is always powered and clocked so it is working fine.

You're missing the point again. It is not about the clock, but the comparator
that is internal to the CPU, and not functional when the CPU is in its lowest
power mode. See also the verbiage in [1] (44.3 STGEN functional description),
which indicates that the clock source actually dies in low-power mode (going
against the architecture which mandates it to be always-on).

Quoted 7 lines

Also, coming back to your earlier assertion ("This SoC doesn't have any other
global timer"): The documentation at [1] shows at least 17 timers that could
be used and avoid this dirty hack.

So for what it is worth, NAK to this patch.

Hi Marc,

I have listen your remarks and propose another way to solve this issue:

https://lkml.org/lkml/2019/10/9/690

Thanks,

Benjamin

Quoted 4 lines

        M.

[1] https://www.st.com/resource/en/reference_manual/dm00366355.pdf

#7 lore raw
Quoted 64 lines · Benjamin GAIGNARD
Quoted 63 lines · Marc Zyngier
Quoted 37 lines · Benjamin GAIGNARD
Quoted 36 lines · Marc Zyngier
Quoted 34 lines · Benjamin GAIGNARD
Quoted 23 lines · Marc Zyngier
Quoted 3 lines · Benjamin Gaignard

Adding always-on makes arm arch_timer claim to be an high resolution timer.
That is possible because power mode won't stop clocking the timer.

The "always-on" is not about the clock. It is about the comparator. The clock itself is *guaranteed* to always tick. If it didn't, that'd be
an integration bug, and a pretty bad one.

What you're claiming here is that your CPU never enters a low-power mode?
Ever? I find this very hard to believe.

Furthermore, claiming that always-on is the way to force the arch-timer
to be an hrtimer is factually wrong. This is what happens *if* this is
the only timer in the system. The only case this is true is for virtual
machines. Anything else has a global timer somewhere that will allow the arch timers to be used as an hrtimer.

Quoted 4 lines

I'm pretty sure you too have a global timer somewhere in your system. Enable it, and enjoy hrtimers without having to lie about the properties
of your system! ;-)

Hi Marc,

This SoC doesn't have any other global timer. Use arch_time is the only
we have to provide hrtimer on this system.

Quoted 8 lines
Quoted 5 lines

And you don't have any form of power management either? What happens when
your CPU goes into idle? If your system does any form of power management
*and* doesn't have a separate timer, it is remarkably broken.

Even in low-power modes this timer is always powered and clocked so it is working fine.

You're missing the point again. It is not about the clock, but the comparator
that is internal to the CPU, and not functional when the CPU is in its lowest
power mode. See also the verbiage in [1] (44.3 STGEN functional description),
which indicates that the clock source actually dies in low-power mode (going
against the architecture which mandates it to be always-on).

Also, coming back to your earlier assertion ("This SoC doesn't have any other
global timer"): The documentation at [1] shows at least 17 timers that could
be used and avoid this dirty hack.

Quoted 8 lines
Quoted 1 line

So for what it is worth, NAK to this patch.

Hi Marc,

I have listen your remarks and propose another way to solve this issue:

https://lkml.org/lkml/2019/10/9/690

I don't think you have. You're just trying to move the same dirty hack to another place instead of properly describing your hardware, and Thomas has pointed you in the same direction.

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#8 lore raw
In reply to Benjamin GAIGNARD

On Fri, Sep 27, 2019 at 12:44:55PM +0000, Benjamin GAIGNARD wrote:

[...]

Quoted 4 lines

Even in low-power modes this timer is always powered and clocked so it is working fine.

Is that tested ? I see only cpu_{on,off} available on this platform with PSCI v0.1. Did you add cpu_suspend, idle-states and then gave it a spin ? Or do you have some other idle driver with which this is tested ?

Also I don't understand how "always-on" is linked to hrtimer. Always on timers are just selected to be broadcast timer without sacrificing(simply keeping) a cpu to be always active for broadcast purposes.

--
Regards,
Sudeep