Re: [PATCH 1/2] vhost-user: add a write-read lock

2024-07-22 Thread Prasad Pandit
On Sun, 21 Jul 2024 at 01:11, Michael S. Tsirkin wrote: > So it's not a rw lock. It's just a mutex. > Lock should be named after what they protect, not > after where they are held. > In this case, this ensures only 1 request is > outstanding at a time. > So vhost_user_request_reply_lock Okay, wil

Re: [PATCH 1/2] vhost-user: add a write-read lock

2024-07-20 Thread Michael S. Tsirkin
On Thu, Jul 11, 2024 at 06:44:23PM +0530, Prasad Pandit wrote: > From: Prasad Pandit > > 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 messa

Re: [PATCH 1/2] vhost-user: add a write-read lock

2024-07-16 Thread Prasad Pandit
On Mon, 15 Jul 2024 at 18:57, Peter Xu wrote: > I think it shouldn't be a major deal in most cases, if the extended cycles > only cover a bunch of instructions. In special case we can still use > WITH_QEMU_LOCK_GUARD, but I'd start with the simple first and only switch > if necessary. * Okay, wil

Re: [PATCH 1/2] vhost-user: add a write-read lock

2024-07-15 Thread Peter Xu
On Mon, Jul 15, 2024 at 01:44:00PM +0530, Prasad Pandit wrote: > On Thu, 11 Jul 2024 at 21:12, Peter Xu wrote: > > 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 ot

Re: [PATCH 1/2] vhost-user: add a write-read lock

2024-07-15 Thread Prasad Pandit
On Thu, 11 Jul 2024 at 20:11, Michael S. Tsirkin wrote: > Could you supply a Fixes tag here? What commit introduced the race? 'postcopy_end' message was added by: -> https://github.com/qemu/qemu/commit/46343570c06e63b4499f619011df80f91349cd49 Not sure if its race condition also began with it.

Re: [PATCH 1/2] vhost-user: add a write-read lock

2024-07-15 Thread Prasad Pandit
On Thu, 11 Jul 2024 at 21:12, Peter Xu wrote: > 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

Re: [PATCH 1/2] vhost-user: add a write-read lock

2024-07-11 Thread Peter Xu
On Thu, Jul 11, 2024 at 06:44:23PM +0530, Prasad Pandit wrote: > From: Prasad Pandit > > 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 messa

Re: [PATCH 1/2] vhost-user: add a write-read lock

2024-07-11 Thread Michael S. Tsirkin
On Thu, Jul 11, 2024 at 06:44:23PM +0530, Prasad Pandit wrote: > From: Prasad Pandit > > 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 messa

[PATCH 1/2] vhost-user: add a write-read lock

2024-07-11 Thread Prasad Pandit
From: Prasad Pandit 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,70