From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C646745D18; Sat, 16 Nov 2024 02:01:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A9E23402BB; Sat, 16 Nov 2024 02:01:45 +0100 (CET) Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178]) by mails.dpdk.org (Postfix) with ESMTP id 1BE99402A7 for ; Sat, 16 Nov 2024 02:01:44 +0100 (CET) Received: by inbox.dpdk.org (Postfix, from userid 33) id 10F4E45D1A; Sat, 16 Nov 2024 02:01:44 +0100 (CET) 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 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: DPDK X-Bugzilla-Component: ethdev X-Bugzilla-Version: 24.11 X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: stephen@networkplumber.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: dev@dpdk.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: multipart/alternative; boundary=17317189030.D2A0D6E15.1511163 Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --17317189030.D2A0D6E15.1511163 Date: Sat, 16 Nov 2024 02:01:43 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All https://bugs.dpdk.org/show_bug.cgi?id=3D1582 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 c= ause 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 =3D 0; VHOST_DATA_LOG(dev->ifname, DEBUG, "%s", __func__); if (unlikely(!dma_copy_track[dma_id].vchans || =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 !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; } --=20 You are receiving this mail because: You are the assignee for the bug.= --17317189030.D2A0D6E15.1511163 Date: Sat, 16 Nov 2024 02:01:43 +0100 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All
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_submi=
t has mismatch between locking the
access_lock for write, and then releases it with read_unlock.  This could c=
ause
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 =3D 0;

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

        if (unlikely(!dma_copy_track[dma_id].vchans ||
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20
!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);  <<&=
lt;<<<<< HERE

                virtio_dev_vring_translate(dev, vq);
                goto out_no_unlock;
        }
          


You are receiving this mail because:
  • You are the assignee for the bug.
=20=20=20=20=20=20=20=20=20=20
= --17317189030.D2A0D6E15.1511163--