All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Jay Zhou <jianjay.zhou@huawei.com>
Cc: qemu-devel@nongnu.org, weidong.huang@huawei.com, mst@redhat.com,
	wangxinxin.wang@huawei.com, arei.gonglei@huawei.com,
	liuzhe13@huawei.com
Subject: Re: [Qemu-devel] [PATCH v5 3/4] vhost: fix memslot limit check
Date: Wed, 10 Jan 2018 14:16:38 +0100	[thread overview]
Message-ID: <20180110141638.27d11941@redhat.com> (raw)
In-Reply-To: <1515516013-16604-2-git-send-email-jianjay.zhou@huawei.com>

On Wed, 10 Jan 2018 00:40:12 +0800
Jay Zhou <jianjay.zhou@huawei.com> wrote:

> Since used_memslots will be updated to the actual value after
> registering memory listener for the first time, move the
> memslots limit checking to the right place.
> 
> Signed-off-by: Jay Zhou <jianjay.zhou@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/virtio/vhost.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index e4290ce..69b3599 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1251,13 +1251,6 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
>          goto fail;
>      }
>  
> -    if (used_memslots > hdev->vhost_ops->vhost_backend_memslots_limit(hdev)) {
> -        error_report("vhost backend memory slots limit is less"
> -                " than current number of present memory slots");
> -        r = -1;
> -        goto fail;
> -    }
> -
>      r = hdev->vhost_ops->vhost_set_owner(hdev);
>      if (r < 0) {
>          VHOST_OPS_DEBUG("vhost_set_owner failed");
> @@ -1339,6 +1332,18 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
>      hdev->memory_changed = false;
>      memory_listener_register(&hdev->memory_listener, &address_space_memory);
>      QLIST_INSERT_HEAD(&vhost_devices, hdev, entry);
> +
> +    if (used_memslots > hdev->vhost_ops->vhost_backend_memslots_limit(hdev)) {
> +        error_report("vhost backend memory slots limit is less"
> +                " than current number of present memory slots");
> +        r = -1;
> +        if (busyloop_timeout) {
> +            goto fail_busyloop;
> +        } else {
> +            goto fail;
> +        }
> +    }
> +
>      return 0;
>  
>  fail_busyloop:

  reply	other threads:[~2018-01-10 13:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 16:40 [Qemu-devel] [PATCH v5 2/4][RFC] tap: do not close fd if only vhost failed to initialize Jay Zhou
2018-01-09 16:40 ` [Qemu-devel] [PATCH v5 3/4] vhost: fix memslot limit check Jay Zhou
2018-01-10 13:16   ` Igor Mammedov [this message]
2018-01-09 16:40 ` [Qemu-devel] [PATCH v5 4/4] vhost: used_memslots refactoring Jay Zhou
2018-01-10  4:18 ` [Qemu-devel] [PATCH v5 2/4][RFC] tap: do not close fd if only vhost failed to initialize Zhoujian (jay)
2018-01-10  6:01   ` Jason Wang
2018-01-10  7:39     ` Zhoujian (jay)
2018-01-11  3:34       ` Jason Wang
2018-01-11  3:54         ` Zhoujian (jay)
2018-01-11 10:30           ` Jason Wang
2018-01-11 12:31             ` Zhoujian (jay)

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=20180110141638.27d11941@redhat.com \
    --to=imammedo@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=jianjay.zhou@huawei.com \
    --cc=liuzhe13@huawei.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wangxinxin.wang@huawei.com \
    --cc=weidong.huang@huawei.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 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.