public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: "Eugenio Pérez" <eperezma@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	"Michael S. Tsirkin" <mst@redhat.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, Jason Wang <jasowang@redhat.com>
Subject: Re: [PATCH] vdpa: Avoid duplicate call to vp_vdpa get_status
Date: Fri, 5 Nov 2021 09:32:53 +0100	[thread overview]
Message-ID: <20211105083253.y4mikalhbfwmcuhp@steredhat> (raw)
In-Reply-To: <20211104195833.2089796-1-eperezma@redhat.com>

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>


      parent reply	other threads:[~2021-11-05  8:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=20211105083253.y4mikalhbfwmcuhp@steredhat \
    --to=sgarzare@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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