diff mbox

[qom-cpu,for-1.4] cpu: Unconditionalize CPUState fields

Message ID 1359127647-10675-1-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Jan. 25, 2013, 3:27 p.m. UTC
Commits fc8c5b8c41ee5ba69d7a2be63b02a08c7b0b155b (Makefile.user: Define
CONFIG_USER_ONLY for libuser/) and
dd83b06ae61cfa2dc4381ab49f365bd0995fc930 (qom: Introduce CPU class)
specifically prepared the qom/cpu.c file to be compiled differently for
softmmu and *-user. This broke as part of build system refactorings
while CPU patches were in flight, adding conditional fields
kvm_fd (8737c51c0444f832c4e97d7eb7540eae457e08e4) and
kvm_vcpu_dirty (20d695a9254c1b086a456d3b79a3c311236643ba) for softmmu.

linux-user and bsd-user would therefore get a CPUState type with
instance_size ~8 bytes shorter than expected.
Fix this by unconditionally having the fields in CPUState.

In practice, target-specific CPU types' instance_size would compensate
this, and upstream qom/cpu.c does not yet touch any affected field.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/qom/cpu.h |    2 --
 1 Datei geändert, 2 Zeilen entfernt(-)

Comments

Andreas Färber Jan. 25, 2013, 3:30 p.m. UTC | #1
Am 25.01.2013 16:27, schrieb Andreas Färber:
> Commits fc8c5b8c41ee5ba69d7a2be63b02a08c7b0b155b (Makefile.user: Define
> CONFIG_USER_ONLY for libuser/) and
> dd83b06ae61cfa2dc4381ab49f365bd0995fc930 (qom: Introduce CPU class)
> specifically prepared the qom/cpu.c file to be compiled differently for
> softmmu and *-user. This broke as part of build system refactorings
> while CPU patches were in flight, adding conditional fields
> kvm_fd (8737c51c0444f832c4e97d7eb7540eae457e08e4) and
> kvm_vcpu_dirty (20d695a9254c1b086a456d3b79a3c311236643ba) for softmmu.
> 
> linux-user and bsd-user would therefore get a CPUState type with
> instance_size ~8 bytes shorter than expected.

argh, longer of course

> Fix this by unconditionally having the fields in CPUState.
> 
> In practice, target-specific CPU types' instance_size would compensate
> this, and upstream qom/cpu.c does not yet touch any affected field.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  include/qom/cpu.h |    2 --
>  1 Datei geändert, 2 Zeilen entfernt(-)
> 
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 773caf9..2333781 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -89,10 +89,8 @@ struct CPUState {
>      bool stop;
>      bool stopped;
>  
> -#if !defined(CONFIG_USER_ONLY)
>      int kvm_fd;
>      bool kvm_vcpu_dirty;
> -#endif
>      struct KVMState *kvm_state;
>      struct kvm_run *kvm_run;
>  
>
Paolo Bonzini Jan. 28, 2013, 2 p.m. UTC | #2
Il 25/01/2013 16:27, Andreas Färber ha scritto:
> Commits fc8c5b8c41ee5ba69d7a2be63b02a08c7b0b155b (Makefile.user: Define
> CONFIG_USER_ONLY for libuser/) and
> dd83b06ae61cfa2dc4381ab49f365bd0995fc930 (qom: Introduce CPU class)
> specifically prepared the qom/cpu.c file to be compiled differently for
> softmmu and *-user. This broke as part of build system refactorings
> while CPU patches were in flight, adding conditional fields
> kvm_fd (8737c51c0444f832c4e97d7eb7540eae457e08e4) and
> kvm_vcpu_dirty (20d695a9254c1b086a456d3b79a3c311236643ba) for softmmu.
> 
> linux-user and bsd-user would therefore get a CPUState type with
> instance_size ~8 bytes shorter than expected.
> Fix this by unconditionally having the fields in CPUState.
> 
> In practice, target-specific CPU types' instance_size would compensate
> this, and upstream qom/cpu.c does not yet touch any affected field.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  include/qom/cpu.h |    2 --
>  1 Datei geändert, 2 Zeilen entfernt(-)
> 
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 773caf9..2333781 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -89,10 +89,8 @@ struct CPUState {
>      bool stop;
>      bool stopped;
>  
> -#if !defined(CONFIG_USER_ONLY)
>      int kvm_fd;
>      bool kvm_vcpu_dirty;
> -#endif
>      struct KVMState *kvm_state;
>      struct kvm_run *kvm_run;
>  
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Andreas Färber Jan. 28, 2013, 3:30 p.m. UTC | #3
Am 28.01.2013 15:00, schrieb Paolo Bonzini:
> Il 25/01/2013 16:27, Andreas Färber ha scritto:
>> Commits fc8c5b8c41ee5ba69d7a2be63b02a08c7b0b155b (Makefile.user: Define
>> CONFIG_USER_ONLY for libuser/) and
>> dd83b06ae61cfa2dc4381ab49f365bd0995fc930 (qom: Introduce CPU class)
>> specifically prepared the qom/cpu.c file to be compiled differently for
>> softmmu and *-user. This broke as part of build system refactorings
>> while CPU patches were in flight, adding conditional fields
>> kvm_fd (8737c51c0444f832c4e97d7eb7540eae457e08e4) and
>> kvm_vcpu_dirty (20d695a9254c1b086a456d3b79a3c311236643ba) for softmmu.
>>
>> linux-user and bsd-user would therefore get a CPUState type with
>> instance_size ~8 bytes shorter than expected.
>> Fix this by unconditionally having the fields in CPUState.
>>
>> In practice, target-specific CPU types' instance_size would compensate
>> this, and upstream qom/cpu.c does not yet touch any affected field.
>>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
> 
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Thanks, applied to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

Andreas
diff mbox

Patch

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 773caf9..2333781 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -89,10 +89,8 @@  struct CPUState {
     bool stop;
     bool stopped;
 
-#if !defined(CONFIG_USER_ONLY)
     int kvm_fd;
     bool kvm_vcpu_dirty;
-#endif
     struct KVMState *kvm_state;
     struct kvm_run *kvm_run;