xen: arm: wait 1000ms for a CPU to come up, instead of forever
PATCH 1/1 xen: arm: wait 1000ms for a CPU to come up, instead of forever
Otherwise continue without it, which is preferable to the current infinite hang.
Slightly tweak the grammar of a comment in the same function.
--- xen/arch/arm/smpboot.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
xen/arch/arm/smpboot.c +24 -2
@@ -357,6 +357,7 @@ int __init cpu_up_send_sgi(int cpu)int __cpu_up (unsigned int cpu) {int rc; +s_time_t deadline;printk ("Bringing up CPU%d\n" , cpu);
@@ -369,7 +370,7 @@ int __cpu_up(unsigned int cpu)/* Tell the remote CPU which stack to boot on. */ init_data.stack = idle_vcpu[cpu]->arch.stack; -/* Tell the remote CPU what is it's logical CPU ID */ +/* Tell the remote CPU what its logical CPU ID is. */ init_data.cpuid = cpu;/* Open the gate for this CPU */
@@ -386,12 +387,33 @@ int __cpu_up(unsigned int cpu)return rc; } -while ( !cpu_online (cpu) ) + deadline =NOW () +MILLISECS (1000 ); + +while ( !cpu_online (cpu) &&NOW () < deadline ) {cpu_relax ();process_pending_softirqs (); } +/* +* Nuke start of day info before checking one last time if the CPU +* actually came online. +* +* Doesn't completely avoid the posibility of it trying to +* progress with another CPUs stack etc, but better than nothing, +* hopefully. +*/ + init_data.stack =NULL ; + init_data.cpuid = ~0 ; + smp_up_cpu =MPIDR_INVALID ; +clean_dcache (smp_up_cpu); + +if ( !cpu_online (cpu) ) + { +printk ("CPU%d never came online\n" , cpu); +return -EIO ; + } +return 0 ; }
Signature · 1 line
1.7.10.4
Hi Ian,
Quoted 2 lines · Ian Campbell
Otherwise continue without it, which is preferable to the current infinite hang.
Nice!
Quoted 29 lines
Slightly tweak the grammar of a comment in the same function.
Signed-off-by Ian Campbell <[email protected]>--- xen/arch/arm/smpboot.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)xen/arch/arm/smpboot.c +2
-1@@ -357,6 +357,7 @@ int __init cpu_up_send_sgi(int cpu)int __cpu_up (unsigned int cpu) {int rc; +s_time_t deadline;printk ("Bringing up CPU%d\n" , cpu);@@ -369,7 +370,7 @@ int __cpu_up(unsigned int cpu)/* Tell the remote CPU which stack to boot on. */ init_data.stack = idle_vcpu[cpu]->arch.stack; -/* Tell the remote CPU what is it's logical CPU ID */ +/* Tell the remote CPU what its logical CPU ID is. */ init_data.cpuid = cpu;/* Open the gate for this CPU */
xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 390
Quoted 5 lines
xen/arch/arm/smpboot.c +1
-1@@ -386,12 +387,33 @@ int __cpu_up(unsigned int cpu)return rc; } -while ( !cpu_online (cpu) ) + deadline =NOW () +MILLISECS (1000 );
Most of cpu_up callbacks are waiting for the CPU to come back. I guess this deadline is for the time to initialize the CPU for Xen? If so, maybe you can add a comment for it.
Also, any reason for 1s?
xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 402
Quoted 12 lines
xen/arch/arm/smpboot.c +7
-0+ +while ( !cpu_online (cpu) &&NOW () < deadline ) {cpu_relax ();process_pending_softirqs (); } +/* +* Nuke start of day info before checking one last time if the CPU +* actually came online. +* +* Doesn't completely avoid the posibility of it trying to
possibility
xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 409
Quoted 7 lines
xen/arch/arm/smpboot.c +7
-0+* progress with another CPUs stack etc, but better than nothing, +* hopefully. +*/ + init_data.stack =NULL ; + init_data.cpuid = ~0 ; + smp_up_cpu =MPIDR_INVALID ; +clean_dcache (smp_up_cpu);
I don't understand why you need to do this. Is it for pure clean up? If so, please explain it in the commit message.
Regards,
Signature · 1 line
Julien Grall
Quoted 40 lines · Julien Grall
Hi Ian,
Quoted 2 lines · Ian Campbell
Otherwise continue without it, which is preferable to the current infinite hang.
Nice!
Quoted 32 lines
Slightly tweak the grammar of a comment in the same function.
Signed-off-by Ian Campbell <[email protected]>--- xen/arch/arm/smpboot.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)xen/arch/arm/smpboot.c +2
-1@@ -357,6 +357,7 @@ int __init cpu_up_send_sgi(int cpu)int __cpu_up (unsigned int cpu) {int rc; +s_time_t deadline;printk ("Bringing up CPU%d\n" , cpu);@@ -369,7 +370,7 @@ int __cpu_up(unsigned int cpu)/* Tell the remote CPU which stack to boot on. */ init_data.stack = idle_vcpu[cpu]->arch.stack; -/* Tell the remote CPU what is it's logical CPU ID */ +/* Tell the remote CPU what its logical CPU ID is. */ init_data.cpuid = cpu;/* Open the gate for this CPU */ @@ -386,12 +387,33 @@ int __cpu_up(unsigned int cpu)return rc; }
Quoted 4 lines
xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 390
Quoted 2 lines
xen/arch/arm/smpboot.c +1
-1-while ( !cpu_online (cpu) ) + deadline =NOW () +MILLISECS (1000 );Most of
cpu_upcallbacks are waiting for the CPU to come back.
Where do you mean exactly?
Quoted 3 lines
I guess
this deadline is for the time to initialize the CPU for Xen? If so, maybe you can add a comment for it.
I would have thought it was evident from the patch that it is how long we will wait for cpu_online(cpu) to become true. Does that really need explaining in prose?
Quoted 1 line
Also, any reason for 1s?
Anything taking longer than that is pretty broken IMHO. It also happens to be the Linux time out.
Quoted 21 lines
Quoted 10 lines
xen/arch/arm/smpboot.c +4
-0+ +while ( !cpu_online (cpu) &&NOW () < deadline ) {cpu_relax ();process_pending_softirqs (); } +/* +* Nuke start of day info before checking one last time if the CPU xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 409
Quoted 10 lines
xen/arch/arm/smpboot.c +10
-0+* actually came online. +* +* Doesn't completely avoid the posibility of it trying to +* progress with another CPUs stack etc, but better than nothing, +* hopefully. +*/ + init_data.stack =NULL ; + init_data.cpuid = ~0 ; + smp_up_cpu =MPIDR_INVALID ; +clean_dcache (smp_up_cpu);
Quoted 2 lines
I don't understand why you need to do this. Is it for pure clean up? If so, please explain it in the commit message.
Is the comment right above it not sufficient explanation? I can insert at the end of the first paragraph "If it is not online it may still be trying and may show up later" is that would help.
Ian.
Quoted 41 lines · Ian Campbell
Quoted 40 lines · Julien Grall
Hi Ian,
Quoted 2 lines · Ian Campbell
Otherwise continue without it, which is preferable to the current infinite hang.
Nice!
Quoted 32 lines
Slightly tweak the grammar of a comment in the same function.
Signed-off-by Ian Campbell <[email protected]>--- xen/arch/arm/smpboot.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)xen/arch/arm/smpboot.c +2
-1@@ -357,6 +357,7 @@ int __init cpu_up_send_sgi(int cpu)int __cpu_up (unsigned int cpu) {int rc; +s_time_t deadline;printk ("Bringing up CPU%d\n" , cpu);@@ -369,7 +370,7 @@ int __cpu_up(unsigned int cpu)/* Tell the remote CPU which stack to boot on. */ init_data.stack = idle_vcpu[cpu]->arch.stack; -/* Tell the remote CPU what is it's logical CPU ID */ +/* Tell the remote CPU what its logical CPU ID is. */ init_data.cpuid = cpu;/* Open the gate for this CPU */ @@ -386,12 +387,33 @@ int __cpu_up(unsigned int cpu)return rc; }
Quoted 6 lines
Quoted 4 lines
xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 390
Quoted 2 lines
xen/arch/arm/smpboot.c +1
-1-while ( !cpu_online (cpu) ) + deadline =NOW () +MILLISECS (1000 );Most of
cpu_upcallbacks are waiting for the CPU to come back.Where do you mean exactly?
See for instance exynos5_cpu_power_up.
Quoted 7 lines
Quoted 3 lines
I guess
this deadline is for the time to initialize the CPU for Xen? If so, maybe you can add a comment for it.I would have thought it was evident from the patch that it is how long we will wait for
cpu_online(cpu)to become true. Does that really need explaining in prose?
I was just checking because I found 1s a bit too much.
Quoted 4 lines
Quoted 1 line
Also, any reason for 1s?
Anything taking longer than that is pretty broken IMHO. It also happens to be the Linux time out.
Ok.
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
xen/arch/arm/smpboot.c +14
-0+ +while ( !cpu_online (cpu) &&NOW () < deadline ) {cpu_relax ();process_pending_softirqs (); } +/* +* Nuke start of day info before checking one last time if the CPU +* actually came online. +* +* Doesn't completely avoid the posibility of it trying to +* progress with another CPUs stack etc, but better than nothing, +* hopefully. +*/ + init_data.stack =NULL ; + init_data.cpuid = ~0 ; + smp_up_cpu =MPIDR_INVALID ; +clean_dcache (smp_up_cpu);
Quoted 6 lines
Quoted 2 lines
I don't understand why you need to do this. Is it for pure clean up? If so, please explain it in the commit message.
Is the comment right above it not sufficient explanation? I can insert at the end of the first paragraph "If it is not online it may still be trying and may show up later" is that would help.
It's more clear for me with "If it is not online ...".
For the second paragraph, I would say "It doesn't completely avoid ...".
Also I was wondering if there is any possibility to turn off the cpu if it doesn't come online?
Regards,
Signature · 1 line
Julien Grall
Quoted 42 lines · Julien Grall
Quoted 41 lines · Ian Campbell
Quoted 40 lines · Julien Grall
Hi Ian,
Quoted 2 lines · Ian Campbell
Otherwise continue without it, which is preferable to the current infinite hang.
Nice!
Quoted 32 lines
Slightly tweak the grammar of a comment in the same function.
Signed-off-by Ian Campbell <[email protected]>--- xen/arch/arm/smpboot.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)xen/arch/arm/smpboot.c +2
-1@@ -357,6 +357,7 @@ int __init cpu_up_send_sgi(int cpu)int __cpu_up (unsigned int cpu) {int rc; +s_time_t deadline;printk ("Bringing up CPU%d\n" , cpu);@@ -369,7 +370,7 @@ int __cpu_up(unsigned int cpu)/* Tell the remote CPU which stack to boot on. */ init_data.stack = idle_vcpu[cpu]->arch.stack; -/* Tell the remote CPU what is it's logical CPU ID */ +/* Tell the remote CPU what its logical CPU ID is. */ init_data.cpuid = cpu;/* Open the gate for this CPU */ @@ -386,12 +387,33 @@ int __cpu_up(unsigned int cpu)return rc; }
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 390
Quoted 2 lines
xen/arch/arm/smpboot.c +1
-1-while ( !cpu_online (cpu) ) + deadline =NOW () +MILLISECS (1000 );Most of
cpu_upcallbacks are waiting for the CPU to come back.Where do you mean exactly?
See for instance
exynos5_cpu_power_up.
Appears to be waiting the h/w to acknowledge that the CPU power is on, which is no guarantee that it is going to actually boot, or even make it to Xen code.
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
xen/arch/arm/smpboot.c +4
-0+ +while ( !cpu_online (cpu) &&NOW () < deadline ) {cpu_relax ();process_pending_softirqs (); } +/* +* Nuke start of day info before checking one last time if the CPU xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 409
Quoted 10 lines
xen/arch/arm/smpboot.c +10
-0+* actually came online. +* +* Doesn't completely avoid the posibility of it trying to +* progress with another CPUs stack etc, but better than nothing, +* hopefully. +*/ + init_data.stack =NULL ; + init_data.cpuid = ~0 ; + smp_up_cpu =MPIDR_INVALID ; +clean_dcache (smp_up_cpu);I don't understand why you need to do this. Is it for pure clean up? If so, please explain it in the commit message.
Quoted 7 lines
Quoted 3 lines
Is the comment right above it not sufficient explanation? I can insert at the end of the first paragraph "If it is not online it may still be trying and may show up later" is that would help.
It's more clear for me with "If it is not online ...".
For the second paragraph, I would say "It doesn't completely avoid ...".
OK, I'll make both changes.
Quoted 2 lines
Also I was wondering if there is any possibility to turn off the cpu if it doesn't come online?
PSCI has a cpu_off, and there will be arch specific mechanisms. Whether they will work under the circumstances is hard to say. In any case that is out of scope for this patch.
Ian.
Julien Grall
Reviewed-byQuoted 7 lines · Ian Campbell
Quoted 3 lines
Quoted 1 line
Where do you mean exactly?
See for instance
exynos5_cpu_power_up.Appears to be waiting the h/w to acknowledge that the CPU power is on, which is no guarantee that it is going to actually boot, or even make it to Xen code.
Right. This is what I was trying to say.
Quoted 33 lines
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
xen/arch/arm/smpboot.c +4
-0+ +while ( !cpu_online (cpu) &&NOW () < deadline ) {cpu_relax ();process_pending_softirqs (); } +/* +* Nuke start of day info before checking one last time if the CPU xen/arch/arm/smpboot.c int __cpu_up(unsigned int cpu) · line 409
Quoted 10 lines
xen/arch/arm/smpboot.c +10
-0+* actually came online. +* +* Doesn't completely avoid the posibility of it trying to +* progress with another CPUs stack etc, but better than nothing, +* hopefully. +*/ + init_data.stack =NULL ; + init_data.cpuid = ~0 ; + smp_up_cpu =MPIDR_INVALID ; +clean_dcache (smp_up_cpu);I don't understand why you need to do this. Is it for pure clean up? If so, please explain it in the commit message.
Quoted 7 lines
Quoted 3 lines
Is the comment right above it not sufficient explanation? I can insert at the end of the first paragraph "If it is not online it may still be trying and may show up later" is that would help.
It's more clear for me with "If it is not online ...".
For the second paragraph, I would say "It doesn't completely avoid ...".
Quoted 8 lines
OK, I'll make both changes.
Quoted 2 lines
Also I was wondering if there is any possibility to turn off the cpu if it doesn't come online?
PSCI has a
cpu_off, and there will be arch specific mechanisms. Whether they will work under the circumstances is hard to say. In any case that is out of scope for this patch.
True. I will give a look later when I will have time.
With the change in the comment:
Regards,
Signature · 1 line
Julien Grall