[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] target/i386/kvm.c: Don't mark cpuid_data as QEM
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH] target/i386/kvm.c: Don't mark cpuid_data as QEMU_PACKED |
Date: |
Mon, 10 Dec 2018 09:24:02 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 |
On 12/10/18 5:46 AM, Peter Maydell wrote:
> clang complains about taking the address of a packed
> member of a struct:
>
> target/i386/kvm.c:1245:27: warning: taking address of packed member 'cpuid'
> of class or structure '' may result in an unaligned pointer value
> [-Waddress-of-packed-member]
> c = cpuid_find_entry(&cpuid_data.cpuid, 1, 0);
> ^~~~~~~~~~~~~~~~
> target/i386/kvm.c:1297:31: warning: taking address of packed member 'cpuid'
> of class or structure '' may result in an unaligned pointer value
> [-Waddress-of-packed-member]
> c = cpuid_find_entry(&cpuid_data.cpuid, kvm_base, 0);
> ^~~~~~~~~~~~~~~~
>
> The kernel's definitions of struct kvm_cpuid2 and struct
> kvm_cpuid_entry2 are carefully set up with padding fields
> so that there is no between-struct padding anyway, so
> the QEMU_PACKED annotation is unnecessary and might result
> in the compiler generating worse code. Drop it, and instead
> assert at build time that there is no stray padding.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> target/i386/kvm.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <address@hidden>
r~