diff mbox

[06/20] xen: Simplify halting of first CPU

Message ID 1358242058-1404-7-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Jan. 15, 2013, 9:27 a.m. UTC
Use the global first_cpu variable to halt the CPU rather than using a
local first_cpu initialized from qemu_get_cpu(0).

This will allow to change qemu_get_cpu() return type to CPUState
despite use of the CPU_COMMON halted field in the reset handler.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 xen-all.c |    4 +---
 1 Datei geändert, 1 Zeile hinzugefügt(+), 3 Zeilen entfernt(-)

Comments

Stefano Stabellini Jan. 15, 2013, 11:03 a.m. UTC | #1
On Tue, 15 Jan 2013, Andreas Färber wrote:
> Use the global first_cpu variable to halt the CPU rather than using a
> local first_cpu initialized from qemu_get_cpu(0).
> 
> This will allow to change qemu_get_cpu() return type to CPUState
> despite use of the CPU_COMMON halted field in the reset handler.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

>  xen-all.c |    4 +---
>  1 Datei geändert, 1 Zeile hinzugefügt(+), 3 Zeilen entfernt(-)
> 
> diff --git a/xen-all.c b/xen-all.c
> index 19bcfd1..110f958 100644
> --- a/xen-all.c
> +++ b/xen-all.c
> @@ -585,9 +585,7 @@ static void xen_reset_vcpu(void *opaque)
>  
>  void xen_vcpu_init(void)
>  {
> -    CPUArchState *first_cpu;
> -
> -    if ((first_cpu = qemu_get_cpu(0))) {
> +    if (first_cpu != NULL) {
>          qemu_register_reset(xen_reset_vcpu, first_cpu);
>          xen_reset_vcpu(first_cpu);
>      }
> -- 
> 1.7.10.4
> 
>
Andreas Färber Jan. 15, 2013, 2:46 p.m. UTC | #2
Am 15.01.2013 12:03, schrieb Stefano Stabellini:
> On Tue, 15 Jan 2013, Andreas Färber wrote:
>> Use the global first_cpu variable to halt the CPU rather than using a
>> local first_cpu initialized from qemu_get_cpu(0).
>>
>> This will allow to change qemu_get_cpu() return type to CPUState
>> despite use of the CPU_COMMON halted field in the reset handler.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
> 
> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Thanks, but this is already in a pull... I did not see you on IRC
shortly before I applied this as base for the x86 -cpu check/enforce
patches, but we had talked about this change being okay before.

Cheers,
Andreas

>>  xen-all.c |    4 +---
>>  1 Datei geändert, 1 Zeile hinzugefügt(+), 3 Zeilen entfernt(-)
>>
>> diff --git a/xen-all.c b/xen-all.c
>> index 19bcfd1..110f958 100644
>> --- a/xen-all.c
>> +++ b/xen-all.c
>> @@ -585,9 +585,7 @@ static void xen_reset_vcpu(void *opaque)
>>  
>>  void xen_vcpu_init(void)
>>  {
>> -    CPUArchState *first_cpu;
>> -
>> -    if ((first_cpu = qemu_get_cpu(0))) {
>> +    if (first_cpu != NULL) {
>>          qemu_register_reset(xen_reset_vcpu, first_cpu);
>>          xen_reset_vcpu(first_cpu);
>>      }
>> -- 
>> 1.7.10.4
Stefano Stabellini Jan. 15, 2013, 3:44 p.m. UTC | #3
On Tue, 15 Jan 2013, Andreas Färber wrote:
> Am 15.01.2013 12:03, schrieb Stefano Stabellini:
> > On Tue, 15 Jan 2013, Andreas Färber wrote:
> >> Use the global first_cpu variable to halt the CPU rather than using a
> >> local first_cpu initialized from qemu_get_cpu(0).
> >>
> >> This will allow to change qemu_get_cpu() return type to CPUState
> >> despite use of the CPU_COMMON halted field in the reset handler.
> >>
> >> Signed-off-by: Andreas Färber <afaerber@suse.de>
> > 
> > Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> 
> Thanks, but this is already in a pull... I did not see you on IRC
> shortly before I applied this as base for the x86 -cpu check/enforce
> patches, but we had talked about this change being okay before.

Sure, no problems
diff mbox

Patch

diff --git a/xen-all.c b/xen-all.c
index 19bcfd1..110f958 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -585,9 +585,7 @@  static void xen_reset_vcpu(void *opaque)
 
 void xen_vcpu_init(void)
 {
-    CPUArchState *first_cpu;
-
-    if ((first_cpu = qemu_get_cpu(0))) {
+    if (first_cpu != NULL) {
         qemu_register_reset(xen_reset_vcpu, first_cpu);
         xen_reset_vcpu(first_cpu);
     }