virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
@ 2023-05-04 13:50 Dragos Tatulea via Virtualization
  2023-05-04 17:08 ` Feng Liu via Virtualization
  2023-05-04 17:47 ` Feng Liu via Virtualization
  0 siblings, 2 replies; 11+ messages in thread
From: Dragos Tatulea via Virtualization @ 2023-05-04 13:50 UTC (permalink / raw)
  To: Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Xie Yongji
  Cc: linux-kernel, Gal Pressman, virtualization

The referenced patch calls set_vq_affinity without checking if the op is
valid. This patch adds the check.

Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")
Reviewed-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
---
 drivers/virtio/virtio_vdpa.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
index eb6aee8c06b2..989e2d7184ce 100644
--- a/drivers/virtio/virtio_vdpa.c
+++ b/drivers/virtio/virtio_vdpa.c
@@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
 			err = PTR_ERR(vqs[i]);
 			goto err_setup_vq;
 		}
-		ops->set_vq_affinity(vdpa, i, &masks[i]);
+
+		if (ops->set_vq_affinity)
+			ops->set_vq_affinity(vdpa, i, &masks[i]);
 	}
 
 	cb.callback = virtio_vdpa_config_cb;
-- 
2.40.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-04 13:50 [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity Dragos Tatulea via Virtualization
@ 2023-05-04 17:08 ` Feng Liu via Virtualization
  2023-05-04 17:19   ` Dragos Tatulea via Virtualization
  2023-05-04 18:51   ` Michael S. Tsirkin
  2023-05-04 17:47 ` Feng Liu via Virtualization
  1 sibling, 2 replies; 11+ messages in thread
From: Feng Liu via Virtualization @ 2023-05-04 17:08 UTC (permalink / raw)
  To: Dragos Tatulea, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
	Xie Yongji
  Cc: Gal Pressman, linux-kernel, virtualization



On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
> External email: Use caution opening links or attachments
> 
> 
> The referenced patch calls set_vq_affinity without checking if the op is
> valid. This patch adds the check.
> 
> Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")
> Reviewed-by: Gal Pressman <gal@nvidia.com>
> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> ---
>   drivers/virtio/virtio_vdpa.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> index eb6aee8c06b2..989e2d7184ce 100644
> --- a/drivers/virtio/virtio_vdpa.c
> +++ b/drivers/virtio/virtio_vdpa.c
> @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
>                          err = PTR_ERR(vqs[i]);
>                          goto err_setup_vq;
>                  }
> -               ops->set_vq_affinity(vdpa, i, &masks[i]);
> +
> +               if (ops->set_vq_affinity)
> +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
if ops->set_vq_affinity is NULL, should give an error code to err, and 
return err

>          }
> 
>          cb.callback = virtio_vdpa_config_cb;
> --
> 2.40.1
> 
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-04 17:08 ` Feng Liu via Virtualization
@ 2023-05-04 17:19   ` Dragos Tatulea via Virtualization
  2023-05-04 17:46     ` Feng Liu via Virtualization
  2023-05-04 18:51   ` Michael S. Tsirkin
  1 sibling, 1 reply; 11+ messages in thread
From: Dragos Tatulea via Virtualization @ 2023-05-04 17:19 UTC (permalink / raw)
  To: Feng Liu, xieyongji@bytedance.com, mst@redhat.com,
	jasowang@redhat.com, xuanzhuo@linux.alibaba.com
  Cc: Gal Pressman, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org

On Thu, 2023-05-04 at 13:08 -0400, Feng Liu wrote:
> 
> 
> On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
> > External email: Use caution opening links or attachments
> > 
> > 
> > The referenced patch calls set_vq_affinity without checking if the op is
> > valid. This patch adds the check.
> > 
> > Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading
> > mechanism")
> > Reviewed-by: Gal Pressman <gal@nvidia.com>
> > Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> > ---
> >   drivers/virtio/virtio_vdpa.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> > index eb6aee8c06b2..989e2d7184ce 100644
> > --- a/drivers/virtio/virtio_vdpa.c
> > +++ b/drivers/virtio/virtio_vdpa.c
> > @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device
> > *vdev, unsigned int nvqs,
> >                          err = PTR_ERR(vqs[i]);
> >                          goto err_setup_vq;
> >                  }
> > -               ops->set_vq_affinity(vdpa, i, &masks[i]);
> > +
> > +               if (ops->set_vq_affinity)
> > +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
> if ops->set_vq_affinity is NULL, should give an error code to err, and 
> return err
> 
I don't think so: the set_vq_affinity is marked as optional.

> >          }
> > 
> >          cb.callback = virtio_vdpa_config_cb;
> > --
> > 2.40.1
> > 


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-04 17:19   ` Dragos Tatulea via Virtualization
@ 2023-05-04 17:46     ` Feng Liu via Virtualization
  0 siblings, 0 replies; 11+ messages in thread
From: Feng Liu via Virtualization @ 2023-05-04 17:46 UTC (permalink / raw)
  To: Dragos Tatulea, xieyongji@bytedance.com, mst@redhat.com,
	jasowang@redhat.com, xuanzhuo@linux.alibaba.com
  Cc: Gal Pressman, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org



On 2023-05-04 p.m.1:19, Dragos Tatulea wrote:
> On Thu, 2023-05-04 at 13:08 -0400, Feng Liu wrote:
>>
>>
>> On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> The referenced patch calls set_vq_affinity without checking if the op is
>>> valid. This patch adds the check.
>>>
>>> Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading
>>> mechanism")
>>> Reviewed-by: Gal Pressman <gal@nvidia.com>
>>> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
>>> ---
>>>    drivers/virtio/virtio_vdpa.c | 4 +++-
>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
>>> index eb6aee8c06b2..989e2d7184ce 100644
>>> --- a/drivers/virtio/virtio_vdpa.c
>>> +++ b/drivers/virtio/virtio_vdpa.c
>>> @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device
>>> *vdev, unsigned int nvqs,
>>>                           err = PTR_ERR(vqs[i]);
>>>                           goto err_setup_vq;
>>>                   }
>>> -               ops->set_vq_affinity(vdpa, i, &masks[i]);
>>> +
>>> +               if (ops->set_vq_affinity)
>>> +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
>> if ops->set_vq_affinity is NULL, should give an error code to err, and
>> return err
>>
> I don't think so: the set_vq_affinity is marked as optional.
> 
Yes, I see
>>>           }
>>>
>>>           cb.callback = virtio_vdpa_config_cb;
>>> --
>>> 2.40.1
>>>
> 
> 
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-04 13:50 [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity Dragos Tatulea via Virtualization
  2023-05-04 17:08 ` Feng Liu via Virtualization
@ 2023-05-04 17:47 ` Feng Liu via Virtualization
  1 sibling, 0 replies; 11+ messages in thread
From: Feng Liu via Virtualization @ 2023-05-04 17:47 UTC (permalink / raw)
  To: Dragos Tatulea, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
	Xie Yongji
  Cc: Gal Pressman, linux-kernel, virtualization



On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
> External email: Use caution opening links or attachments
> 
> 
> The referenced patch calls set_vq_affinity without checking if the op is
> valid. This patch adds the check.
> 
> Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")
> Reviewed-by: Gal Pressman <gal@nvidia.com>
> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> ---
Reviewed-by: Feng Liu <feliu@nvidia.com>

>   drivers/virtio/virtio_vdpa.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> index eb6aee8c06b2..989e2d7184ce 100644
> --- a/drivers/virtio/virtio_vdpa.c
> +++ b/drivers/virtio/virtio_vdpa.c
> @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
>                          err = PTR_ERR(vqs[i]);
>                          goto err_setup_vq;
>                  }
> -               ops->set_vq_affinity(vdpa, i, &masks[i]);
> +
> +               if (ops->set_vq_affinity)
> +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
>          }
> 
>          cb.callback = virtio_vdpa_config_cb;
> --
> 2.40.1
> 
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-04 17:08 ` Feng Liu via Virtualization
  2023-05-04 17:19   ` Dragos Tatulea via Virtualization
@ 2023-05-04 18:51   ` Michael S. Tsirkin
  2023-05-04 22:47     ` Feng Liu via Virtualization
  2023-05-12 12:51     ` Dragos Tatulea
  1 sibling, 2 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2023-05-04 18:51 UTC (permalink / raw)
  To: Feng Liu
  Cc: Xuan Zhuo, linux-kernel, virtualization, Xie Yongji, Gal Pressman

On Thu, May 04, 2023 at 01:08:54PM -0400, Feng Liu wrote:
> 
> 
> On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
> > External email: Use caution opening links or attachments
> > 
> > 
> > The referenced patch calls set_vq_affinity without checking if the op is
> > valid. This patch adds the check.
> > 
> > Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")
> > Reviewed-by: Gal Pressman <gal@nvidia.com>
> > Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> > ---
> >   drivers/virtio/virtio_vdpa.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> > index eb6aee8c06b2..989e2d7184ce 100644
> > --- a/drivers/virtio/virtio_vdpa.c
> > +++ b/drivers/virtio/virtio_vdpa.c
> > @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
> >                          err = PTR_ERR(vqs[i]);
> >                          goto err_setup_vq;
> >                  }
> > -               ops->set_vq_affinity(vdpa, i, &masks[i]);
> > +
> > +               if (ops->set_vq_affinity)
> > +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
> if ops->set_vq_affinity is NULL, should give an error code to err, and
> return err

Given we ignore return code, hardly seems like a critical thing to do.
Is it really important? affinity is an optimization isn't it?

> >          }
> > 
> >          cb.callback = virtio_vdpa_config_cb;
> > --
> > 2.40.1
> > 

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-04 18:51   ` Michael S. Tsirkin
@ 2023-05-04 22:47     ` Feng Liu via Virtualization
  2023-05-12 12:51     ` Dragos Tatulea
  1 sibling, 0 replies; 11+ messages in thread
From: Feng Liu via Virtualization @ 2023-05-04 22:47 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Xuan Zhuo, linux-kernel, virtualization, Xie Yongji, Gal Pressman



On 2023-05-04 p.m.2:51, Michael S. Tsirkin wrote:
> External email: Use caution opening links or attachments
> 
> 
> On Thu, May 04, 2023 at 01:08:54PM -0400, Feng Liu wrote:
>>
>>
>> On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
>>> External email: Use caution opening links or attachments
>>>
>>>
>>> The referenced patch calls set_vq_affinity without checking if the op is
>>> valid. This patch adds the check.
>>>
>>> Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading mechanism")
>>> Reviewed-by: Gal Pressman <gal@nvidia.com>
>>> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
>>> ---
>>>    drivers/virtio/virtio_vdpa.c | 4 +++-
>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
>>> index eb6aee8c06b2..989e2d7184ce 100644
>>> --- a/drivers/virtio/virtio_vdpa.c
>>> +++ b/drivers/virtio/virtio_vdpa.c
>>> @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs,
>>>                           err = PTR_ERR(vqs[i]);
>>>                           goto err_setup_vq;
>>>                   }
>>> -               ops->set_vq_affinity(vdpa, i, &masks[i]);
>>> +
>>> +               if (ops->set_vq_affinity)
>>> +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
>> if ops->set_vq_affinity is NULL, should give an error code to err, and
>> return err
> 
> Given we ignore return code, hardly seems like a critical thing to do.
> Is it really important? affinity is an optimization isn't it?
> 
Yes, it is an optimization, got it.

>>>           }
>>>
>>>           cb.callback = virtio_vdpa_config_cb;
>>> --
>>> 2.40.1
>>>
> 
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-04 18:51   ` Michael S. Tsirkin
  2023-05-04 22:47     ` Feng Liu via Virtualization
@ 2023-05-12 12:51     ` Dragos Tatulea
  2023-05-12 13:30       ` Michael S. Tsirkin
  1 sibling, 1 reply; 11+ messages in thread
From: Dragos Tatulea @ 2023-05-12 12:51 UTC (permalink / raw)
  To: Feng Liu, mst@redhat.com
  Cc: xuanzhuo@linux.alibaba.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	xieyongji@bytedance.com, Gal Pressman

On Thu, 2023-05-04 at 14:51 -0400, Michael S. Tsirkin wrote:
> On Thu, May 04, 2023 at 01:08:54PM -0400, Feng Liu wrote:
> > 
> > 
> > On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
> > > External email: Use caution opening links or attachments
> > > 
> > > 
> > > The referenced patch calls set_vq_affinity without checking if the op is
> > > valid. This patch adds the check.
> > > 
> > > Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading
> > > mechanism")
> > > Reviewed-by: Gal Pressman <gal@nvidia.com>
> > > Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> > > ---
> > >   drivers/virtio/virtio_vdpa.c | 4 +++-
> > >   1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> > > index eb6aee8c06b2..989e2d7184ce 100644
> > > --- a/drivers/virtio/virtio_vdpa.c
> > > +++ b/drivers/virtio/virtio_vdpa.c
> > > @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device
> > > *vdev, unsigned int nvqs,
> > >                          err = PTR_ERR(vqs[i]);
> > >                          goto err_setup_vq;
> > >                  }
> > > -               ops->set_vq_affinity(vdpa, i, &masks[i]);
> > > +
> > > +               if (ops->set_vq_affinity)
> > > +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
> > if ops->set_vq_affinity is NULL, should give an error code to err, and
> > return err
> 
> Given we ignore return code, hardly seems like a critical thing to do.
> Is it really important? affinity is an optimization isn't it?
> 
> > > 
set_vq_affinity is optional so it's not an error if the op is not implemented.

Is there anything else that needs to be done for this fix?

Thanks,
Dragos

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-12 12:51     ` Dragos Tatulea
@ 2023-05-12 13:30       ` Michael S. Tsirkin
  2023-05-12 23:55         ` Shannon Nelson via Virtualization
  0 siblings, 1 reply; 11+ messages in thread
From: Michael S. Tsirkin @ 2023-05-12 13:30 UTC (permalink / raw)
  To: Dragos Tatulea
  Cc: xuanzhuo@linux.alibaba.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	xieyongji@bytedance.com, Gal Pressman

On Fri, May 12, 2023 at 12:51:21PM +0000, Dragos Tatulea wrote:
> On Thu, 2023-05-04 at 14:51 -0400, Michael S. Tsirkin wrote:
> > On Thu, May 04, 2023 at 01:08:54PM -0400, Feng Liu wrote:
> > > 
> > > 
> > > On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
> > > > External email: Use caution opening links or attachments
> > > > 
> > > > 
> > > > The referenced patch calls set_vq_affinity without checking if the op is
> > > > valid. This patch adds the check.
> > > > 
> > > > Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading
> > > > mechanism")
> > > > Reviewed-by: Gal Pressman <gal@nvidia.com>
> > > > Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> > > > ---
> > > >   drivers/virtio/virtio_vdpa.c | 4 +++-
> > > >   1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> > > > index eb6aee8c06b2..989e2d7184ce 100644
> > > > --- a/drivers/virtio/virtio_vdpa.c
> > > > +++ b/drivers/virtio/virtio_vdpa.c
> > > > @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device
> > > > *vdev, unsigned int nvqs,
> > > >                          err = PTR_ERR(vqs[i]);
> > > >                          goto err_setup_vq;
> > > >                  }
> > > > -               ops->set_vq_affinity(vdpa, i, &masks[i]);
> > > > +
> > > > +               if (ops->set_vq_affinity)
> > > > +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
> > > if ops->set_vq_affinity is NULL, should give an error code to err, and
> > > return err
> > 
> > Given we ignore return code, hardly seems like a critical thing to do.
> > Is it really important? affinity is an optimization isn't it?
> > 
> > > > 
> set_vq_affinity is optional so it's not an error if the op is not implemented.
> 
> Is there anything else that needs to be done for this fix?
> 
> Thanks,
> Dragos
> 

no, it's queued already.

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-12 13:30       ` Michael S. Tsirkin
@ 2023-05-12 23:55         ` Shannon Nelson via Virtualization
  2023-06-02 12:21           ` Michael S. Tsirkin
  0 siblings, 1 reply; 11+ messages in thread
From: Shannon Nelson via Virtualization @ 2023-05-12 23:55 UTC (permalink / raw)
  To: virtualization, Michael S. Tsirkin

On 5/12/23 6:30 AM, Michael S. Tsirkin wrote:
> 
> On Fri, May 12, 2023 at 12:51:21PM +0000, Dragos Tatulea wrote:
>> On Thu, 2023-05-04 at 14:51 -0400, Michael S. Tsirkin wrote:
>>> On Thu, May 04, 2023 at 01:08:54PM -0400, Feng Liu wrote:
>>>>
>>>>
>>>> On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
>>>>> External email: Use caution opening links or attachments
>>>>>
>>>>>
>>>>> The referenced patch calls set_vq_affinity without checking if the op is
>>>>> valid. This patch adds the check.
>>>>>
>>>>> Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading
>>>>> mechanism")
>>>>> Reviewed-by: Gal Pressman <gal@nvidia.com>
>>>>> Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
>>>>> ---
>>>>>    drivers/virtio/virtio_vdpa.c | 4 +++-
>>>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
>>>>> index eb6aee8c06b2..989e2d7184ce 100644
>>>>> --- a/drivers/virtio/virtio_vdpa.c
>>>>> +++ b/drivers/virtio/virtio_vdpa.c
>>>>> @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device
>>>>> *vdev, unsigned int nvqs,
>>>>>                           err = PTR_ERR(vqs[i]);
>>>>>                           goto err_setup_vq;
>>>>>                   }
>>>>> -               ops->set_vq_affinity(vdpa, i, &masks[i]);
>>>>> +
>>>>> +               if (ops->set_vq_affinity)
>>>>> +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
>>>> if ops->set_vq_affinity is NULL, should give an error code to err, and
>>>> return err
>>>
>>> Given we ignore return code, hardly seems like a critical thing to do.
>>> Is it really important? affinity is an optimization isn't it?
>>>
>>>>>
>> set_vq_affinity is optional so it's not an error if the op is not implemented.
>>
>> Is there anything else that needs to be done for this fix?
>>
>> Thanks,
>> Dragos
>>
> 
> no, it's queued already.

Are these queued into a repo that is accessible?  I haven't seen 
activity in the vhost.git where I would have expected it.  After 
stumbling over and debugging this same problem, I was happy to see it 
fixed, and I'd like to pull from a repo that has the current updates.

Thanks,
sln
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity
  2023-05-12 23:55         ` Shannon Nelson via Virtualization
@ 2023-06-02 12:21           ` Michael S. Tsirkin
  0 siblings, 0 replies; 11+ messages in thread
From: Michael S. Tsirkin @ 2023-06-02 12:21 UTC (permalink / raw)
  To: Shannon Nelson; +Cc: virtualization

On Fri, May 12, 2023 at 04:55:38PM -0700, Shannon Nelson wrote:
> On 5/12/23 6:30 AM, Michael S. Tsirkin wrote:
> > 
> > On Fri, May 12, 2023 at 12:51:21PM +0000, Dragos Tatulea wrote:
> > > On Thu, 2023-05-04 at 14:51 -0400, Michael S. Tsirkin wrote:
> > > > On Thu, May 04, 2023 at 01:08:54PM -0400, Feng Liu wrote:
> > > > > 
> > > > > 
> > > > > On 2023-05-04 a.m.9:50, Dragos Tatulea wrote:
> > > > > > External email: Use caution opening links or attachments
> > > > > > 
> > > > > > 
> > > > > > The referenced patch calls set_vq_affinity without checking if the op is
> > > > > > valid. This patch adds the check.
> > > > > > 
> > > > > > Fixes: 3dad56823b53 ("virtio-vdpa: Support interrupt affinity spreading
> > > > > > mechanism")
> > > > > > Reviewed-by: Gal Pressman <gal@nvidia.com>
> > > > > > Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
> > > > > > ---
> > > > > >    drivers/virtio/virtio_vdpa.c | 4 +++-
> > > > > >    1 file changed, 3 insertions(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
> > > > > > index eb6aee8c06b2..989e2d7184ce 100644
> > > > > > --- a/drivers/virtio/virtio_vdpa.c
> > > > > > +++ b/drivers/virtio/virtio_vdpa.c
> > > > > > @@ -385,7 +385,9 @@ static int virtio_vdpa_find_vqs(struct virtio_device
> > > > > > *vdev, unsigned int nvqs,
> > > > > >                           err = PTR_ERR(vqs[i]);
> > > > > >                           goto err_setup_vq;
> > > > > >                   }
> > > > > > -               ops->set_vq_affinity(vdpa, i, &masks[i]);
> > > > > > +
> > > > > > +               if (ops->set_vq_affinity)
> > > > > > +                       ops->set_vq_affinity(vdpa, i, &masks[i]);
> > > > > if ops->set_vq_affinity is NULL, should give an error code to err, and
> > > > > return err
> > > > 
> > > > Given we ignore return code, hardly seems like a critical thing to do.
> > > > Is it really important? affinity is an optimization isn't it?
> > > > 
> > > > > > 
> > > set_vq_affinity is optional so it's not an error if the op is not implemented.
> > > 
> > > Is there anything else that needs to be done for this fix?
> > > 
> > > Thanks,
> > > Dragos
> > > 
> > 
> > no, it's queued already.
> 
> Are these queued into a repo that is accessible?  I haven't seen activity in
> the vhost.git where I would have expected it.  After stumbling over and
> debugging this same problem, I was happy to see it fixed, and I'd like to
> pull from a repo that has the current updates.
> 
> Thanks,
> sln

Pushed to next now.

-- 
MST

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-06-02 12:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04 13:50 [PATCH] virtio-vdpa: Fix unchecked call to NULL set_vq_affinity Dragos Tatulea via Virtualization
2023-05-04 17:08 ` Feng Liu via Virtualization
2023-05-04 17:19   ` Dragos Tatulea via Virtualization
2023-05-04 17:46     ` Feng Liu via Virtualization
2023-05-04 18:51   ` Michael S. Tsirkin
2023-05-04 22:47     ` Feng Liu via Virtualization
2023-05-12 12:51     ` Dragos Tatulea
2023-05-12 13:30       ` Michael S. Tsirkin
2023-05-12 23:55         ` Shannon Nelson via Virtualization
2023-06-02 12:21           ` Michael S. Tsirkin
2023-05-04 17:47 ` Feng Liu via Virtualization

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).