* [PATCH v2 1/5] vhost: fix missing virtqueue lock protection
[not found] <20220324124638.32672-1-maxime.coquelin@redhat.com>
@ 2022-03-24 12:46 ` Maxime Coquelin
2022-03-28 8:07 ` David Marchand
0 siblings, 1 reply; 3+ messages in thread
From: Maxime Coquelin @ 2022-03-24 12:46 UTC (permalink / raw)
To: dev, chenbo.xia, david.marchand, i.maximets; +Cc: Maxime Coquelin, stable
This patch ensures virtqueue metadata are not being
modified while rte_vhost_vring_call() is executed.
Fixes: 6c299bb7322f ("vhost: introduce vring call API")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
lib/vhost/vhost.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index bc88148347..2f96a28dac 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -1291,11 +1291,15 @@ rte_vhost_vring_call(int vid, uint16_t vring_idx)
if (!vq)
return -1;
+ rte_spinlock_lock(&vq->access_lock);
+
if (vq_is_packed(dev))
vhost_vring_call_packed(dev, vq);
else
vhost_vring_call_split(dev, vq);
+ rte_spinlock_unlock(&vq->access_lock);
+
return 0;
}
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/5] vhost: fix missing virtqueue lock protection
2022-03-24 12:46 ` [PATCH v2 1/5] vhost: fix missing virtqueue lock protection Maxime Coquelin
@ 2022-03-28 8:07 ` David Marchand
2022-03-28 14:59 ` Maxime Coquelin
0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2022-03-28 8:07 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: dev, Xia, Chenbo, Ilya Maximets, dpdk stable
On Thu, Mar 24, 2022 at 1:46 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> This patch ensures virtqueue metadata are not being
> modified while rte_vhost_vring_call() is executed.
>
> Fixes: 6c299bb7322f ("vhost: introduce vring call API")
> Cc: stable@dpdk.org
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> lib/vhost/vhost.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
> index bc88148347..2f96a28dac 100644
> --- a/lib/vhost/vhost.c
> +++ b/lib/vhost/vhost.c
> @@ -1291,11 +1291,15 @@ rte_vhost_vring_call(int vid, uint16_t vring_idx)
> if (!vq)
> return -1;
>
> + rte_spinlock_lock(&vq->access_lock);
> +
> if (vq_is_packed(dev))
> vhost_vring_call_packed(dev, vq);
> else
> vhost_vring_call_split(dev, vq);
>
> + rte_spinlock_unlock(&vq->access_lock);
> +
> return 0;
> }
>
Reviewed-by: David Marchand <david.marchand@redhat.com>
You can probably merge quickly this fix regardless of the rest of the
stats series.
It would help me with a series of mine that annotates vhost locks.
--
David Marchand
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/5] vhost: fix missing virtqueue lock protection
2022-03-28 8:07 ` David Marchand
@ 2022-03-28 14:59 ` Maxime Coquelin
0 siblings, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2022-03-28 14:59 UTC (permalink / raw)
To: David Marchand; +Cc: dev, Xia, Chenbo, Ilya Maximets, dpdk stable
On 3/28/22 10:07, David Marchand wrote:
> On Thu, Mar 24, 2022 at 1:46 PM Maxime Coquelin
> <maxime.coquelin@redhat.com> wrote:
>>
>> This patch ensures virtqueue metadata are not being
>> modified while rte_vhost_vring_call() is executed.
>>
>> Fixes: 6c299bb7322f ("vhost: introduce vring call API")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>> ---
>> lib/vhost/vhost.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
>> index bc88148347..2f96a28dac 100644
>> --- a/lib/vhost/vhost.c
>> +++ b/lib/vhost/vhost.c
>> @@ -1291,11 +1291,15 @@ rte_vhost_vring_call(int vid, uint16_t vring_idx)
>> if (!vq)
>> return -1;
>>
>> + rte_spinlock_lock(&vq->access_lock);
>> +
>> if (vq_is_packed(dev))
>> vhost_vring_call_packed(dev, vq);
>> else
>> vhost_vring_call_split(dev, vq);
>>
>> + rte_spinlock_unlock(&vq->access_lock);
>> +
>> return 0;
>> }
>>
>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
>
> You can probably merge quickly this fix regardless of the rest of the
> stats series.
> It would help me with a series of mine that annotates vhost locks.
>
>
Thanks for the review.
Applied this single patch to next-virtio tree.
Maxime
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-28 14:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20220324124638.32672-1-maxime.coquelin@redhat.com>
2022-03-24 12:46 ` [PATCH v2 1/5] vhost: fix missing virtqueue lock protection Maxime Coquelin
2022-03-28 8:07 ` David Marchand
2022-03-28 14:59 ` Maxime Coquelin
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).