Skip to content

Commit 7ca26ef

Browse files
mcoquelinmstsirkin
authored andcommitted
vduse: Use proper spinlock for IRQ injection
The IRQ injection work used spin_lock_irq() to protect the scheduling of the softirq, but spin_lock_bh() should be used. With spin_lock_irq(), we noticed delay of more than 6 seconds between the time a NAPI polling work is scheduled and the time it is executed. Fixes: c8a6153 ("vduse: Introduce VDUSE - vDPA Device in Userspace") Cc: xieyongji@bytedance.com Suggested-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> Message-Id: <20230705114505.63274-1-maxime.coquelin@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Xie Yongji <xieyongji@bytedance.com>
1 parent f46c1e1 commit 7ca26ef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/vdpa/vdpa_user/vduse_dev.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -935,21 +935,21 @@ static void vduse_dev_irq_inject(struct work_struct *work)
935935
{
936936
struct vduse_dev *dev = container_of(work, struct vduse_dev, inject);
937937

938-
spin_lock_irq(&dev->irq_lock);
938+
spin_lock_bh(&dev->irq_lock);
939939
if (dev->config_cb.callback)
940940
dev->config_cb.callback(dev->config_cb.private);
941-
spin_unlock_irq(&dev->irq_lock);
941+
spin_unlock_bh(&dev->irq_lock);
942942
}
943943

944944
static void vduse_vq_irq_inject(struct work_struct *work)
945945
{
946946
struct vduse_virtqueue *vq = container_of(work,
947947
struct vduse_virtqueue, inject);
948948

949-
spin_lock_irq(&vq->irq_lock);
949+
spin_lock_bh(&vq->irq_lock);
950950
if (vq->ready && vq->cb.callback)
951951
vq->cb.callback(vq->cb.private);
952-
spin_unlock_irq(&vq->irq_lock);
952+
spin_unlock_bh(&vq->irq_lock);
953953
}
954954

955955
static bool vduse_vq_signal_irqfd(struct vduse_virtqueue *vq)

0 commit comments

Comments
 (0)