* [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status
@ 2021-11-04 19:58 Eugenio Pérez
2021-11-05 2:48 ` Jason Wang
2021-11-05 8:32 ` Stefano Garzarella
0 siblings, 2 replies; 5+ messages in thread
From: Eugenio Pérez @ 2021-11-04 19:58 UTC (permalink / raw)
To: linux-kernel; +Cc: Michael S. Tsirkin, kvm, virtualization, netdev, Jason Wang
It has no sense to call get_status twice, since we already have a
variable for that.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
drivers/vhost/vdpa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 01c59ce7e250..10676ea0348b 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
status_old = ops->get_status(vdpa);
/*
* Userspace shouldn't remove status bits unless reset the
* status to 0.
*/
- if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
+ if (status != 0 && (status_old & ~status) != 0)
return -EINVAL;
if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
for (i = 0; i < nvqs; i++)
vhost_vdpa_unsetup_vq_irq(v, i);
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status
2021-11-04 19:58 [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status Eugenio Pérez
@ 2021-11-05 2:48 ` Jason Wang
2021-11-05 8:32 ` Stefano Garzarella
1 sibling, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-11-05 2:48 UTC (permalink / raw)
To: Eugenio Pérez
Cc: linux-kernel, Michael S. Tsirkin, kvm, virtualization, netdev
On Fri, Nov 5, 2021 at 3:58 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> It has no sense to call get_status twice, since we already have a
> variable for that.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/vhost/vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 01c59ce7e250..10676ea0348b 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
> status_old = ops->get_status(vdpa);
>
> /*
> * Userspace shouldn't remove status bits unless reset the
> * status to 0.
> */
> - if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
> + if (status != 0 && (status_old & ~status) != 0)
> return -EINVAL;
>
> if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
> for (i = 0; i < nvqs; i++)
> vhost_vdpa_unsetup_vq_irq(v, i);
>
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status
@ 2021-11-05 2:48 ` Jason Wang
0 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2021-11-05 2:48 UTC (permalink / raw)
To: Eugenio Pérez
Cc: netdev, virtualization, linux-kernel, kvm, Michael S. Tsirkin
On Fri, Nov 5, 2021 at 3:58 AM Eugenio Pérez <eperezma@redhat.com> wrote:
>
> It has no sense to call get_status twice, since we already have a
> variable for that.
>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/vhost/vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 01c59ce7e250..10676ea0348b 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
> status_old = ops->get_status(vdpa);
>
> /*
> * Userspace shouldn't remove status bits unless reset the
> * status to 0.
> */
> - if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
> + if (status != 0 && (status_old & ~status) != 0)
> return -EINVAL;
>
> if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
> for (i = 0; i < nvqs; i++)
> vhost_vdpa_unsetup_vq_irq(v, i);
>
> --
> 2.27.0
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status
2021-11-04 19:58 [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status Eugenio Pérez
@ 2021-11-05 8:32 ` Stefano Garzarella
2021-11-05 8:32 ` Stefano Garzarella
1 sibling, 0 replies; 5+ messages in thread
From: Stefano Garzarella @ 2021-11-05 8:32 UTC (permalink / raw)
To: Eugenio Pérez
Cc: linux-kernel, Michael S. Tsirkin, kvm, virtualization, netdev,
Jason Wang
On Thu, Nov 04, 2021 at 08:58:33PM +0100, Eugenio Pérez wrote:
>It has no sense to call get_status twice, since we already have a
>variable for that.
>
>Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>---
> drivers/vhost/vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
>index 01c59ce7e250..10676ea0348b 100644
>--- a/drivers/vhost/vdpa.c
>+++ b/drivers/vhost/vdpa.c
>@@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
> status_old = ops->get_status(vdpa);
>
> /*
> * Userspace shouldn't remove status bits unless reset the
> * status to 0.
> */
>- if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
>+ if (status != 0 && (status_old & ~status) != 0)
> return -EINVAL;
>
> if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
> for (i = 0; i < nvqs; i++)
> vhost_vdpa_unsetup_vq_irq(v, i);
>
>--
>2.27.0
>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status
@ 2021-11-05 8:32 ` Stefano Garzarella
0 siblings, 0 replies; 5+ messages in thread
From: Stefano Garzarella @ 2021-11-05 8:32 UTC (permalink / raw)
To: Eugenio Pérez
Cc: kvm, Michael S. Tsirkin, netdev, linux-kernel, virtualization
On Thu, Nov 04, 2021 at 08:58:33PM +0100, Eugenio Pérez wrote:
>It has no sense to call get_status twice, since we already have a
>variable for that.
>
>Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>---
> drivers/vhost/vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
>index 01c59ce7e250..10676ea0348b 100644
>--- a/drivers/vhost/vdpa.c
>+++ b/drivers/vhost/vdpa.c
>@@ -167,13 +167,13 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp)
> status_old = ops->get_status(vdpa);
>
> /*
> * Userspace shouldn't remove status bits unless reset the
> * status to 0.
> */
>- if (status != 0 && (ops->get_status(vdpa) & ~status) != 0)
>+ if (status != 0 && (status_old & ~status) != 0)
> return -EINVAL;
>
> if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK))
> for (i = 0; i < nvqs; i++)
> vhost_vdpa_unsetup_vq_irq(v, i);
>
>--
>2.27.0
>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-11-05 8:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 19:58 [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status Eugenio Pérez
2021-11-05 2:48 ` Jason Wang
2021-11-05 2:48 ` Jason Wang
2021-11-05 8:32 ` Stefano Garzarella
2021-11-05 8:32 ` Stefano Garzarella
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.