From: Cornelia Huck <cohuck@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
qemu-s390x <qemu-s390x@nongnu.org>,
Halil Pasic <pasic@linux.vnet.ibm.com>,
Alexander Graf <agraf@suse.de>,
Richard Henderson <rth@twiddle.net>,
Thomas Huth <thuth@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] s390x/migration: use zero flag parameter
Date: Wed, 22 Nov 2017 15:43:09 +0100 [thread overview]
Message-ID: <20171122154309.27027346.cohuck@redhat.com> (raw)
In-Reply-To: <20171122142627.73170-2-borntraeger@de.ibm.com>
On Wed, 22 Nov 2017 15:26:26 +0100
Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> valgrind pointed out that we call KVM_S390_GET_IRQ_STATE with an
> undefined value for flags. Right now this is unused, but we
> better play safe.
> The same is true for SET_IRQ_STATE. While QEMU is now fixed in
> that regard, we should make sure to not use the flag and pad
> fields in the kernel. A corresponding kernel documentation patch
> will be submitted later.
I'd reword this a bit; it is confusing to read changelogs describing a
then-future change which already happened. (I assume that we will do
the kernel sanitizing for 4.15?)
"valgrind pointed out that we call KVM_S390_GET_IRQ_STATE with an
undefined value for flags. Kernels prior to 4.15 did not use that
field, and later kernels ignore it for compatibility reasons, but we
better play safe.
The same is true for SET_IRQ_STATE. We should make sure to not use the
flag field, either."
[I do not see a 'pad' field in the structure; that is a bug in the
kernel documentation.]
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> target/s390x/kvm.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
> index 343fcec..76065ec 100644
> --- a/target/s390x/kvm.c
> +++ b/target/s390x/kvm.c
> @@ -2069,7 +2069,10 @@ int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state)
>
> void kvm_s390_vcpu_interrupt_pre_save(S390CPU *cpu)
> {
> - struct kvm_s390_irq_state irq_state;
> + struct kvm_s390_irq_state irq_state = {
> + .buf = (uint64_t) cpu->irqstate,
> + .len = VCPU_IRQ_BUF_SIZE,
> + };
> CPUState *cs = CPU(cpu);
> int32_t bytes;
>
> @@ -2077,9 +2080,6 @@ void kvm_s390_vcpu_interrupt_pre_save(S390CPU *cpu)
> return;
> }
>
> - irq_state.buf = (uint64_t) cpu->irqstate;
> - irq_state.len = VCPU_IRQ_BUF_SIZE;
> -
> bytes = kvm_vcpu_ioctl(cs, KVM_S390_GET_IRQ_STATE, &irq_state);
> if (bytes < 0) {
> cpu->irqstate_saved_size = 0;
> @@ -2093,7 +2093,10 @@ void kvm_s390_vcpu_interrupt_pre_save(S390CPU *cpu)
> int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu)
> {
> CPUState *cs = CPU(cpu);
> - struct kvm_s390_irq_state irq_state;
> + struct kvm_s390_irq_state irq_state = {
> + .buf = (uint64_t) cpu->irqstate,
> + .len = cpu->irqstate_saved_size,
> + };
> int r;
>
> if (cpu->irqstate_saved_size == 0) {
> @@ -2104,9 +2107,6 @@ int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu)
> return -ENOSYS;
> }
>
> - irq_state.buf = (uint64_t) cpu->irqstate;
> - irq_state.len = cpu->irqstate_saved_size;
> -
> r = kvm_vcpu_ioctl(cs, KVM_S390_SET_IRQ_STATE, &irq_state);
> if (r) {
> error_report("Setting interrupt state failed %d", r);
Patch looks good.
next prev parent reply other threads:[~2017-11-22 14:43 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-22 14:26 [Qemu-devel] [PATCH 0/2] s390x fixes (post 2.11) Christian Borntraeger
2017-11-22 14:26 ` [Qemu-devel] [PATCH 1/2] s390x/migration: use zero flag parameter Christian Borntraeger
2017-11-22 14:37 ` Thomas Huth
2017-11-22 14:49 ` Cornelia Huck
2017-11-22 14:43 ` Cornelia Huck [this message]
2017-11-22 14:50 ` Christian Borntraeger
2017-11-22 14:26 ` [Qemu-devel] [PATCH 2/2] pc-bios/s390-ccw: zero out bss section Christian Borntraeger
2017-11-22 14:45 ` Cornelia Huck
2017-11-22 16:36 ` Thomas Huth
2017-11-23 7:32 ` Richard Henderson
2017-11-22 14:46 ` [Qemu-devel] [PATCH 0/2] s390x fixes (post 2.11) Cornelia Huck
2017-11-22 14:54 ` no-reply
2017-11-22 15:07 ` Christian Borntraeger
2017-11-22 15:45 ` Cornelia Huck
-- strict thread matches above, loose matches on Subject: below --
2017-11-20 12:35 [Qemu-devel] [PATCH/RFC 0/2] valgrind fallout for s390x/kvm Christian Borntraeger
2017-11-20 12:35 ` [Qemu-devel] [PATCH 1/2] s390x/migration: use zero flag parameter Christian Borntraeger
2017-11-20 12:57 ` Cornelia Huck
2017-11-20 13:03 ` Christian Borntraeger
2017-11-20 13:01 ` Thomas Huth
2017-11-20 13:02 ` Christian Borntraeger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171122154309.27027346.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=pasic@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.