diff mbox

Delays, clocks, timers, hrtimers, etc

Message ID 20150211184515.GB11190@codeaurora.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Stephen Boyd Feb. 11, 2015, 6:45 p.m. UTC
On 02/11, Mason wrote:
> Mason wrote:
> 
> 
> Also, you wrote "I don't see any problem with the TWD dropping the
> dependency on SMP." Would something as simple as this be acceptable?
> (Most probably NOT; there are a lot of smp* occurrences in smp_twd.c
> even the file name.) What is the rationale for the dependency?
> 
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index a34698d..47b02c8 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -1565,7 +1565,6 @@ config HAVE_ARM_ARCH_TIMER
>  config HAVE_ARM_TWD
>         bool
> -       depends on SMP
>         select CLKSRC_OF if OF
>         help
>           This options enables support for the ARM timer and watchdog unit
> 

Hmm it looks like we would also need to add this to the patch. It
looks like a holdover from when the local timer APIs were around.
Back then twd_local_timer_common_register() would fail if
is_smp() was false or setup_max_cpus was 0. Now it will just
register a clockevent that may or may not be used depending on
what other clockevents are in the system and the ratings of those
other clockevents.

----8<----

Comments

Mason Feb. 11, 2015, 9:58 p.m. UTC | #1
Stephen Boyd wrote:

> Mason wrote:
>
>> Also, you wrote "I don't see any problem with the TWD dropping the
>> dependency on SMP." Would something as simple as this be acceptable?
>> (Most probably NOT; there are a lot of smp* occurrences in smp_twd.c
>> even the file name.) What is the rationale for the dependency?
>>
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index a34698d..47b02c8 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -1565,7 +1565,6 @@ config HAVE_ARM_ARCH_TIMER
>>   config HAVE_ARM_TWD
>>          bool
>> -       depends on SMP
>>          select CLKSRC_OF if OF
>>          help
>>            This options enables support for the ARM timer and watchdog unit
>>
>
> Hmm it looks like we would also need to add this to the patch. It
> looks like a holdover from when the local timer APIs were around.
> Back then twd_local_timer_common_register() would fail if
> is_smp() was false or setup_max_cpus was 0. Now it will just
> register a clockevent that may or may not be used depending on
> what other clockevents are in the system and the ratings of those
> other clockevents.
>
> ----8<----
> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
> index 172c6a05d27f..e8f6d241881f 100644
> --- a/arch/arm/kernel/smp_twd.c
> +++ b/arch/arm/kernel/smp_twd.c
> @@ -23,7 +23,6 @@
>   #include <linux/of_irq.h>
>   #include <linux/of_address.h>
>
> -#include <asm/smp_plat.h>
>   #include <asm/smp_twd.h>
>
>   /* set up by the platform code */
> @@ -388,9 +387,6 @@ static void __init twd_local_timer_of_register(struct device_node *np)
>   {
>   	int err;
>
> -	if (!is_smp() || !setup_max_cpus)
> -		return;
> -
>   	twd_ppi = irq_of_parse_and_map(np, 0);
>   	if (!twd_ppi) {
>   		err = -EINVAL;

Looking at the difference between OF and !OF registration functions
in smp_twd.c

!OF
   if (twd_base || twd_evt) return -EBUSY;
   assign twd_ppi and twd_base
   twd_local_timer_common_register(NULL)

OF
   if (!is_smp() || !setup_max_cpus) return; // TO BE DELETED
   assign twd_ppi and twd_base
   twd_local_timer_common_register(np)

I suppose OF guarantees that the init code is called only once?
(Hence the !OF guard code would be unnecessary.)

Regards.

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd Feb. 11, 2015, 11:26 p.m. UTC | #2
On 02/11, Mason wrote:
> 
> Looking at the difference between OF and !OF registration functions
> in smp_twd.c
> 
> !OF
>   if (twd_base || twd_evt) return -EBUSY;
>   assign twd_ppi and twd_base
>   twd_local_timer_common_register(NULL)
> 
> OF
>   if (!is_smp() || !setup_max_cpus) return; // TO BE DELETED
>   assign twd_ppi and twd_base
>   twd_local_timer_common_register(np)
> 
> I suppose OF guarantees that the init code is called only once?

It's called as many times as there's a match with the
corresponding CLOCKSOURCE_OF_DECLARE. In practice that's once.

> (Hence the !OF guard code would be unnecessary.)
> 

The other difference is that OF based registration needs to use
OF functions for irqs and ioremap whereas the non-OF code relies
on the irqs being provided before hand and the ioremap done
without OF functions.
diff mbox

Patch

diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 172c6a05d27f..e8f6d241881f 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -23,7 +23,6 @@ 
 #include <linux/of_irq.h>
 #include <linux/of_address.h>
 
-#include <asm/smp_plat.h>
 #include <asm/smp_twd.h>
 
 /* set up by the platform code */
@@ -388,9 +387,6 @@  static void __init twd_local_timer_of_register(struct device_node *np)
 {
 	int err;
 
-	if (!is_smp() || !setup_max_cpus)
-		return;
-
 	twd_ppi = irq_of_parse_and_map(np, 0);
 	if (!twd_ppi) {
 		err = -EINVAL;