Il mar 17 giu 2025, 18:02 Annie Li <annie.li@oracle.com> ha scritto:

Hello Paolo,

On 6/16/2025 5:11 PM, Paolo Bonzini wrote:


Il lun 16 giu 2025, 21:00 Annie Li <annie.li@oracle.com> ha scritto:
> My understanding of the qemu document is that it's OK to run one
> helper per QEMU or even per host, but multiple disks shouldn't share
> the same socket since it is possible that multiple commands may be
> sent concurrently.
>> Maybe QEMU has some internal lock that does the right thing and
>> serializes requests?

Multiple disks can share the socket, the serialization of requests is handled with a mutex in scsi/pr-manager-helper.c.

Thanks a lot for the clarification.

I was only focusing on the qemu-pr-helper source code, haven't checked pr-manager-helper yet, will definitely take a look.

Hi Annie

that's the part of QEMU that talks to the helper process.

Looks the following document is misleading,
https://www.qemu.org/docs/master/interop/pr-helper.html
Since there is a mutex handling the requests from multiple disk over one socket, I suppose the statement "It is invalid to send multiple commands concurrently on the same socket." can be removed

No, I don't think it should be removed: the mutex is exactly what makes QEMU obey that statement. Remember that the documentation is written for everyone that needs to implement a qemu-pr-helper replacement (say one that does persistent reservations using a shared database), or a client that may not be QEMU (ok in practice it will be).

Paolo