Hello Paolo,

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


Il lun 16 giu 2025, 21:00 Annie Li <annie...@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.

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?

Thanks

Annie


    > I'll dig the qemu-pr-helper source code. Any thoughts are welcome :)

    In libvirt, the socket parameter is configured with '-k' option in
    qemuProcessStartManagedPRDaemon,

         if (!(cmd = virCommandNewArgList(prHelperPath,
                                          "-k", socketPath,
                                          NULL)))
    and qemu-pr-helper creates socket by the following,
             saddr = (SocketAddress){
                 .type = SOCKET_ADDRESS_TYPE_UNIX,
                 .u.q_unix.path = socket_path,
             };
             server_ioc = qio_channel_socket_new();
    The 'socket_path' is a global pointer and points to the socketPath
    parameter configured with '-k'(see above in libvirt). Later,
    qemu-pr-helper reads out requests from the socket channel. However, I
    don't see the helper specifically processes PR commands sent
    concurrently by multiple disks. If multiple disks share the same
    socket,
    there is certainly an issue as what is described in the qemu
    document.
    I'm wondering if I've missed something here?

    Thanks

    Annie

    > Thanks
    >
    > Annie
    >
    >>
    >> Michal
    >>
    >>>> Due to this limitation above, only one persistent reservation
    disk is
    >>>> allowed as managed in theory. However, libvirt doesn't throw
    out any
    >>>> error or warning when the VM is booted up with multiple managed
    >>>> persistent reservation disks. I am wondering if I've missed
    something
    >>>> here?
    >>>>
    >>>> For unmanaged persistent reservation disks, libvirt doesn't
    start the
    >>>> pr-helper program for them. It is user's responsibility to
    start this
    >>>> program with customized socket file per disk, but the complexity
    >>>> increases with numbers of persistent reservation disks,
    especially in
    >>>> the case of hotplug/hotunplog. Is there any plan to support
    multiple
    >>>> managed persistent reservation disks with separate
    pr-helper/socket
    >>>> file?
    >>>>
    >>>> Any suggestions/clarifications are greatly appreciated.
    >>>>
    >>>> Thanks
    >>>>
    >>>> Annie
    >>>>

Reply via email to