* [Qemu-devel] [PATCH] target-i386: kvm: do not initialize padding fields
@ 2018-10-18 12:33 Paolo Bonzini
2018-10-18 13:03 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2018-10-18 12:33 UTC (permalink / raw)
To: qemu-devel
The exception.pad field is going to be renamed to pending in an upcoming header
file update. Remove the unnecessary initialization.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
| 5 +----
target/i386/kvm.c | 2 --
2 files changed, 1 insertion(+), 6 deletions(-)
--git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
index 7a7acf9e47..dabfcf7c39 100644
--- a/linux-headers/asm-x86/kvm.h
+++ b/linux-headers/asm-x86/kvm.h
@@ -300,10 +300,7 @@ struct kvm_vcpu_events {
__u8 injected;
__u8 nr;
__u8 has_error_code;
- union {
- __u8 pad;
- __u8 pending;
- }
+ __u8 pending;
__u32 error_code;
} exception;
struct {
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 6e5f951f4f..74193b1b9d 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -2696,7 +2696,6 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
events.exception.nr = env->exception_injected;
events.exception.has_error_code = env->has_error_code;
events.exception.error_code = env->error_code;
- events.exception.pad = 0;
events.interrupt.injected = (env->interrupt_injected >= 0);
events.interrupt.nr = env->interrupt_injected;
@@ -2705,7 +2704,6 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
events.nmi.injected = env->nmi_injected;
events.nmi.pending = env->nmi_pending;
events.nmi.masked = !!(env->hflags2 & HF2_NMI_MASK);
- events.nmi.pad = 0;
events.sipi_vector = env->sipi_vector;
events.flags = 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-i386: kvm: do not initialize padding fields
2018-10-18 12:33 [Qemu-devel] [PATCH] target-i386: kvm: do not initialize padding fields Paolo Bonzini
@ 2018-10-18 13:03 ` Peter Maydell
2018-10-18 14:30 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2018-10-18 13:03 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: QEMU Developers
On 18 October 2018 at 13:33, Paolo Bonzini <pbonzini@redhat.com> wrote:
> The exception.pad field is going to be renamed to pending in an upcoming header
> file update. Remove the unnecessary initialization.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> linux-headers/asm-x86/kvm.h | 5 +----
> target/i386/kvm.c | 2 --
> 2 files changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
> index 7a7acf9e47..dabfcf7c39 100644
> --- a/linux-headers/asm-x86/kvm.h
> +++ b/linux-headers/asm-x86/kvm.h
> @@ -300,10 +300,7 @@ struct kvm_vcpu_events {
> __u8 injected;
> __u8 nr;
> __u8 has_error_code;
> - union {
> - __u8 pad;
> - __u8 pending;
> - }
> + __u8 pending;
> __u32 error_code;
> } exception;
> struct {
Do we need to include this hand-edited update to the linux-headers/
in this patch, or could we just drop the initializations, and leave
the header itself to be changed by some future update ?
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 6e5f951f4f..74193b1b9d 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -2696,7 +2696,6 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
> events.exception.nr = env->exception_injected;
> events.exception.has_error_code = env->has_error_code;
> events.exception.error_code = env->error_code;
> - events.exception.pad = 0;
>
> events.interrupt.injected = (env->interrupt_injected >= 0);
> events.interrupt.nr = env->interrupt_injected;
> @@ -2705,7 +2704,6 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int level)
> events.nmi.injected = env->nmi_injected;
> events.nmi.pending = env->nmi_pending;
> events.nmi.masked = !!(env->hflags2 & HF2_NMI_MASK);
> - events.nmi.pad = 0;
>
> events.sipi_vector = env->sipi_vector;
> events.flags = 0;
You could also mention in the commit message:
* these initializers were added by commit 7e680753cfa2
in order to suppress a valgrind warning
* they were rendered unnecessary by the later commit 076796f8fd27f4d,
which added the "= {}" initializer to the declaration of "events",
thus zero-initializing the whole struct (and so this patch does
not change behaviour at all)
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-i386: kvm: do not initialize padding fields
2018-10-18 13:03 ` Peter Maydell
@ 2018-10-18 14:30 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2018-10-18 14:30 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
On 18/10/2018 15:03, Peter Maydell wrote:
> * these initializers were added by commit 7e680753cfa2
> in order to suppress a valgrind warning
> * they were rendered unnecessary by the later commit 076796f8fd27f4d,
> which added the "= {}" initializer to the declaration of "events",
> thus zero-initializing the whole struct (and so this patch does
> not change behaviour at all)
Will do, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-18 14:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 12:33 [Qemu-devel] [PATCH] target-i386: kvm: do not initialize padding fields Paolo Bonzini
2018-10-18 13:03 ` Peter Maydell
2018-10-18 14:30 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.