All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/ethdev Bug 1582] virtio: reader/writer lock mismatch
Date: Sat, 16 Nov 2024 01:01:44 +0000	[thread overview]
Message-ID: <bug-1582-3@http.bugs.dpdk.org/> (raw)

[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]

https://bugs.dpdk.org/show_bug.cgi?id=1582

            Bug ID: 1582
           Summary: virtio: reader/writer lock mismatch
           Product: DPDK
           Version: 24.11
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: major
          Priority: Normal
         Component: ethdev
          Assignee: dev@dpdk.org
          Reporter: stephen@networkplumber.org
  Target Milestone: ---

The code virtio_dev_rx_async_submit has mismatch between locking the
access_lock for write, and then releases it with read_unlock.  This could cause
all sorts of deadlock depending on the implementation of rwlock.

static __rte_always_inline uint32_t
virtio_dev_rx_async_submit(struct virtio_net *dev, struct vhost_virtqueue *vq,
        struct rte_mbuf **pkts, uint32_t count, int16_t dma_id, uint16_t
vchan_id)
{
        uint32_t nb_tx = 0;

        VHOST_DATA_LOG(dev->ifname, DEBUG, "%s", __func__);

        if (unlikely(!dma_copy_track[dma_id].vchans ||
                               
!dma_copy_track[dma_id].vchans[vchan_id].pkts_cmpl_flag_addr)) {
                VHOST_DATA_LOG(dev->ifname, ERR,
                        "%s: invalid channel %d:%u.",
                         __func__, dma_id, vchan_id);
                return 0;
        }

        rte_rwlock_write_lock(&vq->access_lock);

        if (unlikely(!vq->enabled || !vq->async))
                goto out_access_unlock;

        vhost_user_iotlb_rd_lock(vq);

        if (unlikely(!vq->access_ok)) {
                vhost_user_iotlb_rd_unlock(vq);
                rte_rwlock_read_unlock(&vq->access_lock);  <<<<<<<< HERE

                virtio_dev_vring_translate(dev, vq);
                goto out_no_unlock;
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

[-- Attachment #2: Type: text/html, Size: 3799 bytes --]

             reply	other threads:[~2024-11-16  1:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-16  1:01 bugzilla [this message]
2025-03-26 14:10 ` [DPDK/ethdev Bug 1582] virtio: reader/writer lock mismatch bugzilla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1582-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.