virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Xie Yongji <xieyongji@bytedance.com>,
	mst@redhat.com, stefanha@redhat.com, sgarzare@redhat.com,
	parav@nvidia.com, bob.liu@oracle.com, hch@infradead.org,
	rdunlap@infradead.org, willy@infradead.org,
	viro@zeniv.linux.org.uk, axboe@kernel.dk, bcrl@kvack.org,
	corbet@lwn.net, mika.penttila@nextfour.com,
	dan.carpenter@oracle.com
Cc: linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v5 03/11] vhost-vdpa: protect concurrent access to vhost device iotlb
Date: Tue, 23 Mar 2021 11:02:09 +0800	[thread overview]
Message-ID: <38a2ae38-ebf7-3e3b-3439-d95a6f49b48b@redhat.com> (raw)
In-Reply-To: <20210315053721.189-4-xieyongji@bytedance.com>


在 2021/3/15 下午1:37, Xie Yongji 写道:
> Use vhost_dev->mutex to protect vhost device iotlb from
> concurrent access.
>
> Fixes: 4c8cf318("vhost: introduce vDPA-based backend")
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>


Acked-by: Jason Wang <jasowang@redhat.com>

Please cc stable for next version.

Thanks


> ---
>   drivers/vhost/vdpa.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index cb14c66eb2ec..3f7175c2ac24 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -719,9 +719,11 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev,
>   	const struct vdpa_config_ops *ops = vdpa->config;
>   	int r = 0;
>   
> +	mutex_lock(&dev->mutex);
> +
>   	r = vhost_dev_check_owner(dev);
>   	if (r)
> -		return r;
> +		goto unlock;
>   
>   	switch (msg->type) {
>   	case VHOST_IOTLB_UPDATE:
> @@ -742,6 +744,8 @@ static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev,
>   		r = -EINVAL;
>   		break;
>   	}
> +unlock:
> +	mutex_unlock(&dev->mutex);
>   
>   	return r;
>   }

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

  parent reply	other threads:[~2021-03-23  3:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210315053721.189-1-xieyongji@bytedance.com>
     [not found] ` <20210315053721.189-2-xieyongji@bytedance.com>
2021-03-15  9:08   ` [PATCH v5 01/11] file: Export __receive_fd() to modules Christoph Hellwig
     [not found]     ` <CACycT3vrHOExXj6v8ULvUzdLcRkdzS5=TNK6=g4+RWEdN-nOJw@mail.gmail.com>
2021-03-25  8:23       ` Christoph Hellwig
     [not found] ` <20210315053721.189-7-xieyongji@bytedance.com>
2021-03-23  3:09   ` [PATCH v5 06/11] vdpa: factor out vhost_vdpa_pa_map() Jason Wang
     [not found] ` <20210315053721.189-8-xieyongji@bytedance.com>
2021-03-23  3:13   ` [PATCH v5 07/11] vdpa: Support transferring virtual addressing during DMA mapping Jason Wang
     [not found] ` <20210315053721.189-9-xieyongji@bytedance.com>
2021-03-24  3:54   ` [PATCH v5 08/11] vduse: Implement an MMU-based IOMMU driver Jason Wang
     [not found]     ` <CACycT3v_-G6ju-poofXEzYt8QPKWNFHwsS7t=KTLgs-=g+iPQQ@mail.gmail.com>
2021-03-25  4:52       ` Jason Wang
     [not found]         ` <CACycT3uS870yy04rw7KBk==sioi+VNunxVz6BQH-Lmxk6m-VSg@mail.gmail.com>
2021-03-26  4:26           ` Jason Wang
     [not found]             ` <CACycT3v6Lj61fafztOuzBNFLs2TbKeqrNLXkzv5RK6-h-iTnvA@mail.gmail.com>
2021-03-26  6:16               ` Jason Wang
     [not found]                 ` <CACycT3t+2MC9rQ7iWdWQ4=O3ojCXHvHZ-M7y7AjXoXYZUiAOzQ@mail.gmail.com>
2021-03-26  7:36                   ` Jason Wang
     [not found] ` <20210315053721.189-10-xieyongji@bytedance.com>
2021-03-24  4:43   ` [PATCH v5 09/11] vduse: Introduce VDUSE - vDPA Device in Userspace Jason Wang
     [not found]     ` <CACycT3u5hEO8=JVkbHmKXYMManiZ1VedyS6O+7M8Rzbk1ftC7A@mail.gmail.com>
2021-03-25  6:30       ` Jason Wang
     [not found] ` <20210315053721.189-11-xieyongji@bytedance.com>
2021-03-24  4:45   ` [PATCH v5 10/11] vduse: Add config interrupt support Jason Wang
     [not found] ` <20210315053721.189-4-xieyongji@bytedance.com>
2021-03-23  3:02   ` Jason Wang [this message]
2021-03-25 11:08   ` [PATCH v5 03/11] vhost-vdpa: protect concurrent access to vhost device iotlb Stefano Garzarella

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=38a2ae38-ebf7-3e3b-3439-d95a6f49b48b@redhat.com \
    --to=jasowang@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=bcrl@kvack.org \
    --cc=bob.liu@oracle.com \
    --cc=corbet@lwn.net \
    --cc=dan.carpenter@oracle.com \
    --cc=hch@infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mika.penttila@nextfour.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=parav@nvidia.com \
    --cc=rdunlap@infradead.org \
    --cc=sgarzare@redhat.com \
    --cc=stefanha@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=willy@infradead.org \
    --cc=xieyongji@bytedance.com \
    /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).