From: Paolo Bonzini <pbonzini@redhat.com>
To: Halil Pasic <pasic@linux.vnet.ibm.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] commit virtio: recalculate vq->inuse after migration might cause last_avail_idx vs. used_idx failure
Date: Thu, 15 Dec 2016 14:37:08 +0100 [thread overview]
Message-ID: <04b36158-a381-298f-1d81-d1bd18f3cec7@redhat.com> (raw)
In-Reply-To: <b2ad9903-95b4-bf08-f314-c2b250cebb0a@linux.vnet.ibm.com>
On 15/12/2016 12:32, Halil Pasic wrote:
> static inline uint16_t vring_avail_idx(VirtQueue *vq)
> {
> hwaddr pa;
> pa = vq->vring.avail + offsetof(VRingAvail, idx);
> vq->shadow_avail_idx = virtio_lduw_phys(vq->vdev, pa);
>
> we should have an endiannes handling here before assigning shadow_avail_idx I guess
>
> return vq->shadow_avail_idx;
> }
Endianness is already handled:
static inline uint16_t virtio_lduw_phys(VirtIODevice *vdev, hwaddr pa)
{
if (virtio_access_is_big_endian(vdev)) {
return lduw_be_phys(&address_space_memory, pa);
}
return lduw_le_phys(&address_space_memory, pa);
}
> I will meditate a bit more on this and probably create a patch to fix it.
>
> What make me wonder is that according to the reports live migration usually
> works (ca 1% fails)...
What is the backtrace of the vring_avail_idx call? If your device is
virtio 1.0, and vdev->guest_features has not been initialized correctly,
you might incorrectly treat LE virtio 1.0 data as BE virtio 0.9 data:
if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
/* Devices conforming to VIRTIO 1.0 or later are always LE. */
return false;
}
return true;
Thanks,
Paolo
next prev parent reply other threads:[~2016-12-15 13:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 19:12 [Qemu-devel] commit virtio: recalculate vq->inuse after migration might cause last_avail_idx vs. used_idx failure Halil Pasic
2016-12-15 8:24 ` Stefan Hajnoczi
2016-12-15 10:52 ` Dr. David Alan Gilbert
2016-12-15 11:32 ` Halil Pasic
2016-12-15 11:38 ` Dr. David Alan Gilbert
2016-12-15 13:37 ` Paolo Bonzini [this message]
2016-12-15 16:16 ` Halil Pasic
2016-12-15 14:06 ` Stefan Hajnoczi
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=04b36158-a381-298f-1d81-d1bd18f3cec7@redhat.com \
--to=pbonzini@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=dgilbert@redhat.com \
--cc=pasic@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).