From: "Xueming(Steven) Li" <xuemingl@nvidia.com>
To: "Xu, HailinX" <hailinx.xu@intel.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
"stable@dpdk.org" <stable@dpdk.org>,
"ktraynor@redhat.com" <ktraynor@redhat.com>,
"dmarchan@redhat.com" <dmarchan@redhat.com>
Subject: RE: [PATCH v22.11] vhost: fix missing spinlock unlock
Date: Mon, 22 Jan 2024 13:10:51 +0000 [thread overview]
Message-ID: <DM4PR12MB537306ED5C277B93FCCC6BAFA1752@DM4PR12MB5373.namprd12.prod.outlook.com> (raw)
In-Reply-To: <DM4PR12MB5373653FCF9D8F1BDF503D94A1682@DM4PR12MB5373.namprd12.prod.outlook.com>
Hi Hailin,
> -----Original Message-----
> From: Xueming(Steven) Li <xuemingl@nvidia.com>
> Sent: 1/11/2024 19:11
> To: Xu, HailinX <hailinx.xu@intel.com>
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>; stable@dpdk.org;
> ktraynor@redhat.com; dmarchan@redhat.com
> Subject: RE: [PATCH v22.11] vhost: fix missing spinlock unlock
>
> Thanks Maxime!
>
> Hailin, could you please confirm if it fixes
> https://bugs.dpdk.org/show_bug.cgi?id=1338?
The CI passed with this fix, w/o your further confirmation, I'd assume it fixed.
I'll send out 22.11 release if no objections.
>
> > -----Original Message-----
> > From: Maxime Coquelin <maxime.coquelin@redhat.com>
> > Sent: 1/11/2024 18:52
> > To: stable@dpdk.org; Xueming(Steven) Li <xuemingl@nvidia.com>;
> > ktraynor@redhat.com; dmarchan@redhat.com
> > Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> > Subject: [PATCH v22.11] vhost: fix missing spinlock unlock
> >
> > Two regressions were introduced when backporting below
> > patch:
> > b4c4e5675c85 ("vhost: fix missing lock protection in power monitor
> > API")
> >
> > First, rte_vhost_get_monitor_addr did not release the lock in the success case.
> > Then, rte_rwlock_read_lock() was converted to rte_spinlock_trylock()
> > instead of rte_spinlock_lock().
> >
> > This patch addresses both of these issues.
> >
> > Fixes: a07736eb68da ("vhost: fix missing lock protection in power
> > monitor API")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> > ---
> > lib/vhost/vhost.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index
> > 40ac350e21..9e28198528
> > 100644
> > --- a/lib/vhost/vhost.c
> > +++ b/lib/vhost/vhost.c
> > @@ -2060,6 +2060,7 @@ rte_vhost_get_monitor_addr(int vid, uint16_t
> > queue_id, {
> > struct virtio_net *dev = get_device(vid);
> > struct vhost_virtqueue *vq;
> > + int ret = 0;
> >
> > if (dev == NULL)
> > return -1;
> > @@ -2070,11 +2071,12 @@ rte_vhost_get_monitor_addr(int vid, uint16_t
> > queue_id,
> > if (vq == NULL)
> > return -1;
> >
> > - if (!rte_spinlock_trylock(&vq->access_lock))
> > - return -1;
> > + rte_spinlock_lock(&vq->access_lock);
> >
> > - if (unlikely(!vq->access_ok))
> > + if (unlikely(!vq->access_ok)) {
> > + ret = -1;
> > goto out_unlock;
> > + }
> >
> > if (vq_is_packed(dev)) {
> > struct vring_packed_desc *desc;
> > @@ -2095,12 +2097,10 @@ rte_vhost_get_monitor_addr(int vid, uint16_t
> > queue_id,
> > pmc->match = 0;
> > }
> >
> > - return 0;
> > -
> > out_unlock:
> > rte_spinlock_unlock(&vq->access_lock);
> >
> > - return -1;
> > + return ret;
> > }
> >
> >
> > --
> > 2.43.0
next prev parent reply other threads:[~2024-01-22 13:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 10:51 Maxime Coquelin
2024-01-11 11:10 ` David Marchand
2024-01-11 11:11 ` Xueming(Steven) Li
2024-01-22 13:10 ` Xueming(Steven) Li [this message]
2024-01-19 13:52 ` Xueming(Steven) Li
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=DM4PR12MB537306ED5C277B93FCCC6BAFA1752@DM4PR12MB5373.namprd12.prod.outlook.com \
--to=xuemingl@nvidia.com \
--cc=dmarchan@redhat.com \
--cc=hailinx.xu@intel.com \
--cc=ktraynor@redhat.com \
--cc=maxime.coquelin@redhat.com \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).