• Mike Christie's avatar
    vhost: Use virtqueue mutex for swapping worker · 34cf9ba5
    Mike Christie authored
    __vhost_vq_attach_worker uses the vhost_dev mutex to serialize the
    swapping of a virtqueue's worker. This was done for simplicity because
    we are already holding that mutex.
    
    In the next patches where the worker can be killed while in use, we need
    finer grained locking because some drivers will hold the vhost_dev mutex
    while flushing. However in the SIGKILL handler in the next patches, we
    will need to be able to swap workers (set current one to NULL), kill
    queued works and stop new flushes while flushes are in progress.
    
    To prepare us, this has us use the virtqueue mutex for swapping workers
    instead of the vhost_dev one.
    Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
    Message-Id: <20240316004707.45557-7-michael.christie@oracle.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    34cf9ba5
vhost.c 69.8 KB