diff mbox

xen/arm: Clean up identify processor call for secondary cpus

Message ID 1374766150-534-1-git-send-email-julien.grall@linaro.org
State Superseded, archived
Headers show

Commit Message

Julien Grall July 25, 2013, 3:29 p.m. UTC
The smp_processor_id() is set at the beginning of start_secondary. We don't
need to compute ourself the offset of the cpu data.
---
 xen/arch/arm/smpboot.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Julien Grall July 25, 2013, 3:36 p.m. UTC | #1
On 07/25/2013 04:29 PM, Julien Grall wrote:
> The smp_processor_id() is set at the beginning of start_secondary. We don't
> need to compute ourself the offset of the cpu data.

I forgot the signed-off-by.

Signed-off-by: Julien Grall <julien.grall@linaro.org>

> ---
>  xen/arch/arm/smpboot.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 5895178..872cc25 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -137,15 +137,12 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
>                                 unsigned long fdt_paddr,
>                                 unsigned long cpuid)
>  {
> -    struct cpuinfo_arm *c = cpu_data + cpuid;
> -
>      memset(get_cpu_info(), 0, sizeof (struct cpu_info));
>  
>      /* TODO: handle boards where CPUIDs are not contiguous */
>      set_processor_id(cpuid);
>  
> -    *c = boot_cpu_data;
> -    identify_cpu(c);
> +    identify_cpu(&current_cpu_data);
>  
>      init_traps();
>  
>
Ian Campbell July 29, 2013, 8:57 a.m. UTC | #2
On Thu, 2013-07-25 at 16:29 +0100, Julien Grall wrote:
> The smp_processor_id() is set at the beginning of start_secondary. We don't
> need to compute ourself the offset of the cpu data.
> ---
>  xen/arch/arm/smpboot.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
> index 5895178..872cc25 100644
> --- a/xen/arch/arm/smpboot.c
> +++ b/xen/arch/arm/smpboot.c
> @@ -137,15 +137,12 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
>                                 unsigned long fdt_paddr,
>                                 unsigned long cpuid)
>  {
> -    struct cpuinfo_arm *c = cpu_data + cpuid;
> -
>      memset(get_cpu_info(), 0, sizeof (struct cpu_info));
>  
>      /* TODO: handle boards where CPUIDs are not contiguous */
>      set_processor_id(cpuid);
>  
> -    *c = boot_cpu_data;

This step defaults everything to the boot cpu's settings. You could
argue that this isn't necessary iff identify_cpu always reinitialises
everything but it doesn't belong in this change IMHO.

I think the defaulting behaviour is fine BTW, even if we don't currently
make use of it today.

Ian.

> -    identify_cpu(c);
> +    identify_cpu(&current_cpu_data);
>  
>      init_traps();
>
Julien Grall July 29, 2013, 11:05 a.m. UTC | #3
On 07/29/2013 09:57 AM, Ian Campbell wrote:
> On Thu, 2013-07-25 at 16:29 +0100, Julien Grall wrote:
>> The smp_processor_id() is set at the beginning of start_secondary. We don't
>> need to compute ourself the offset of the cpu data.
>> ---
>>  xen/arch/arm/smpboot.c |    5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
>> index 5895178..872cc25 100644
>> --- a/xen/arch/arm/smpboot.c
>> +++ b/xen/arch/arm/smpboot.c
>> @@ -137,15 +137,12 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
>>                                 unsigned long fdt_paddr,
>>                                 unsigned long cpuid)
>>  {
>> -    struct cpuinfo_arm *c = cpu_data + cpuid;
>> -
>>      memset(get_cpu_info(), 0, sizeof (struct cpu_info));
>>  
>>      /* TODO: handle boards where CPUIDs are not contiguous */
>>      set_processor_id(cpuid);
>>  
>> -    *c = boot_cpu_data;
> 
> This step defaults everything to the boot cpu's settings. You could
> argue that this isn't necessary iff identify_cpu always reinitialises
> everything but it doesn't belong in this change IMHO.
> 
> I think the defaulting behaviour is fine BTW, even if we don't currently
> make use of it today.

I will remove this line from the patch.
diff mbox

Patch

diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index 5895178..872cc25 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -137,15 +137,12 @@  void __cpuinit start_secondary(unsigned long boot_phys_offset,
                                unsigned long fdt_paddr,
                                unsigned long cpuid)
 {
-    struct cpuinfo_arm *c = cpu_data + cpuid;
-
     memset(get_cpu_info(), 0, sizeof (struct cpu_info));
 
     /* TODO: handle boards where CPUIDs are not contiguous */
     set_processor_id(cpuid);
 
-    *c = boot_cpu_data;
-    identify_cpu(c);
+    identify_cpu(&current_cpu_data);
 
     init_traps();