From: Peter Xu <peterx@redhat.com>
To: Prasad Pandit <ppandit@redhat.com>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
Jason Wang <jasowang@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
mcoqueli@redhat.com, Prasad Pandit <pjp@fedoraproject.org>
Subject: Re: [PATCH 1/2] vhost-user: add a write-read lock
Date: Thu, 11 Jul 2024 11:41:46 -0400 [thread overview]
Message-ID: <Zo_9OlX0pV0paFj7@x1n> (raw)
In-Reply-To: <20240711131424.181615-2-ppandit@redhat.com>
On Thu, Jul 11, 2024 at 06:44:23PM +0530, Prasad Pandit wrote:
> From: Prasad Pandit <pjp@fedoraproject.org>
>
> QEMU threads use vhost_user_write/read calls to send
> and receive messages from a vhost-user device. When multiple
> threads communicate with the same vhost-user device, they can
> receive each other's messages, resulting in an erroneous state.
>
> vhost_user_read_header:
> 700871,700871: Failed to read msg header. Flags 0x0 instead of 0x5.
> vhost_device_iotlb_miss:
> 700871,700871: Fail to update device iotlb
> vhost_user_postcopy_end:
> 700871,700900: Failed to receive reply to postcopy_end
> vhost_user_read_header:
> 700871,700871: Failed to read msg header. Flags 0x0 instead of 0x5.
>
> Here fault thread seems to end the postcopy migration while
> another thread is starting the vhost-user device.
>
> Add a rw lock to hold for one vhost_user_write/read cycle
> and avoid such race conditions.
>
> Suggested-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
> ---
> hw/virtio/vhost-user.c | 423 +++++++++++++++++++--------------
> include/hw/virtio/vhost-user.h | 3 +
I apologize if I suggested WITH_QEMU_LOCK_GUARD when we talked.. I don't
remember which one I suggested, but in this case IIUC it'll be much easier
to review if you use the other sister function QEMU_LOCK_GUARD()
instead.. That should make the diff much, much less.
--
Peter Xu
next prev parent reply other threads:[~2024-07-11 15:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 13:14 [PATCH 0/2] Postcopy migration and vhost-user errors Prasad Pandit
2024-07-11 13:14 ` [PATCH 1/2] vhost-user: add a write-read lock Prasad Pandit
2024-07-11 14:39 ` Michael S. Tsirkin
2024-07-15 10:57 ` Prasad Pandit
2024-07-11 15:41 ` Peter Xu [this message]
2024-07-15 8:14 ` Prasad Pandit
2024-07-15 13:27 ` Peter Xu
2024-07-16 10:19 ` Prasad Pandit
2024-07-20 19:41 ` Michael S. Tsirkin
2024-07-23 4:58 ` Prasad Pandit
2024-07-11 13:14 ` [PATCH 2/2] vhost: fail device start if iotlb update fails Prasad Pandit
2024-07-11 15:38 ` [PATCH 0/2] Postcopy migration and vhost-user errors Peter Xu
2024-07-15 10:14 ` Prasad Pandit
2024-07-15 13:39 ` Peter Xu
2024-07-16 10:14 ` Prasad Pandit
2024-07-16 22:02 ` Peter Xu
2024-07-17 8:55 ` Michael S. Tsirkin
2024-07-17 13:33 ` Peter Xu
2024-07-17 13:40 ` Michael S. Tsirkin
2024-07-17 13:47 ` Peter Xu
2024-07-20 19:41 ` Michael S. Tsirkin
2024-07-23 5:03 ` Prasad Pandit
2024-07-23 17:52 ` Peter Xu
2024-07-23 17:57 ` Prasad Pandit
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=Zo_9OlX0pV0paFj7@x1n \
--to=peterx@redhat.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=mcoqueli@redhat.com \
--cc=mst@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=ppandit@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.