Skip to contentSkip to conversation

Question: ARM: local timers: add num_possible_cpus() in local_timer_register()

DISCUSSION Steve zhan 3 participants 5 messages Jan 14, 2013

lore
Share & tools
lore

Steve zhan

author
#0 lore raw

Hi Marc,

Do you think we should add num_possible_cpus() in
local_timer_register() function, When core number is

Quoted 1 line

1, then reutrn TRUE? Enable the local timer only if

we have more than one CPU, if the current config is SMP and setup_max_cpus >= 1, but if smp_init_cpus in platform code have set cpu possible value to One(that maybe read number from scu or other hardware), then percpu_timer_setup in smp_prepare_cpus have no chance to be called.

For local timer, because local_timer_register have
return 1, that will miss global timer register.

Could you pls check it?

Regards,
Steve.

#1 lore raw
Quoted 12 lines · Steve zhan

Hi Marc,

Do you think we should add num_possible_cpus() in
local_timer_register() function, When core number is

Quoted 1 line

1, then reutrn TRUE? Enable the local timer only if

we have more than one CPU, if the current config is SMP and setup_max_cpus >= 1, but if smp_init_cpus in platform code have set cpu possible value to One(that maybe read number from scu or other hardware), then percpu_timer_setup in smp_prepare_cpus have no chance to be called.

Quoted 2 lines

For local timer, because local_timer_register have
return 1, that will miss global timer register.

What about platforms where all they have are the local timers and no global timer?

#2 lore raw
In reply to Steve zhan

On 14/01/13 13:33, Steve zhan wrote:

Hi Steve,

Quoted 10 lines

Do you think we should add num_possible_cpus() in
local_timer_register() function, When core number is

Quoted 1 line

1, then reutrn TRUE? Enable the local timer only if

we have more than one CPU, if the current config is SMP and setup_max_cpus >= 1, but if smp_init_cpus in platform code have set cpu possible value to One(that maybe read number from scu or other hardware), then percpu_timer_setup in smp_prepare_cpus have no chance to be called.

Quoted 4 lines

For local timer, because local_timer_register have
return 1, that will miss global timer register.

Could you pls check it?

I'm not sure I understand your question.

We only enable the use of the SMP local timers infrastructure if we're SMP and we have more that one CPU. If you only have one CPU up and running, then you can still use your CPU local timer as a global timer.

What would we gain by using the local timer infrastructure when we're not running on SMP hardware?

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
author
#3 lore raw

Hi,
Russel, Marc,
2013/1/14 Marc Zyngier <[email protected]>:

Quoted 25 lines · Steve zhan

Hi Steve,

Quoted 10 lines

Do you think we should add num_possible_cpus() in
local_timer_register() function, When core number is

Quoted 1 line

1, then reutrn TRUE? Enable the local timer only if

we have more than one CPU, if the current config is SMP and setup_max_cpus >= 1, but if smp_init_cpus in platform code have set cpu possible value to One(that maybe read number from scu or other hardware), then percpu_timer_setup in smp_prepare_cpus have no chance to be called.

Quoted 4 lines

For local timer, because local_timer_register have
return 1, that will miss global timer register.

Could you pls check it?

I'm not sure I understand your question.

We only enable the use of the SMP local timers infrastructure if we're SMP and we have more that one CPU. If you only have one CPU up and running, then you can still use your CPU local timer as a global timer.

Quoted 7 lines

What would we gain by using the local timer infrastructure when we're not running on SMP hardware?

        M.

--
Jazz is not dead. It just smells funny...

For these code:

        err = local_timer_register(&arch_timer_ops);
        if (err) {
                /*
                 * We couldn't register as a local timer (could be
                 * because we're on a UP platform, or because some
                 * other local timer is already present...). Try as a
                 * global timer instead.
                 */
                arch_timer_global_evt.cpumask = cpumask_of(0);
                err = arch_timer_setup(&arch_timer_global_evt);
        }

if err == 0, we have no register global arch timer, but platform code platsmp.c will set
cpu possible number to one, that let percpu_timer_setup in smp_prepare_cpus have no
chance to call becaue ncores = num_possible_cpus() is one. Is this right?

Signature · 1 line
Steve Zhan
#4 lore raw
Quoted 49 lines · steve.zhan

Hi,
Russel, Marc,
2013/1/14 Marc Zyngier <[email protected]>:

Quoted 25 lines · Steve zhan

Hi Steve,

Quoted 10 lines

Do you think we should add num_possible_cpus() in
local_timer_register() function, When core number is

Quoted 1 line

1, then reutrn TRUE? Enable the local timer only if

we have more than one CPU, if the current config is SMP and setup_max_cpus >= 1, but if smp_init_cpus in platform code have set cpu possible value to One(that maybe read number from scu or other hardware), then percpu_timer_setup in smp_prepare_cpus have no chance to be called.

Quoted 4 lines

For local timer, because local_timer_register have
return 1, that will miss global timer register.

Could you pls check it?

I'm not sure I understand your question.

We only enable the use of the SMP local timers infrastructure if we're SMP and we have more that one CPU. If you only have one CPU up and running, then you can still use your CPU local timer as a global timer.

Quoted 7 lines

What would we gain by using the local timer infrastructure when we're not running on SMP hardware?

        M.

--
Jazz is not dead. It just smells funny...

For these code:

        err = local_timer_register(&arch_timer_ops);
        if (err) {
                /*
                 * We couldn't register as a local timer (could be
                 * because we're on a UP platform, or because some
                 * other local timer is already present...). Try as a
                 * global timer instead.
                 */
                arch_timer_global_evt.cpumask = cpumask_of(0);
                err = arch_timer_setup(&arch_timer_global_evt);
        }
Quoted 6 lines

if err == 0, we have no register global arch timer, but platform code platsmp.c will set
cpu possible number to one, that let percpu_timer_setup in smp_prepare_cpus have no
chance to call becaue ncores = num_possible_cpus() is one. Is this right?

Ah, I get it now. Yes, this is a problem. Mark Rutland's patch series actually fixes this issue entirely though. You may want to check it out.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...