qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH for-2.4 v3 3/3] vhost: fail backend intialization if memslots number is more than its supported limit
Date: Thu, 30 Jul 2015 12:11:59 +0200	[thread overview]
Message-ID: <1438251119-285996-4-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1438251119-285996-1-git-send-email-imammedo@redhat.com>

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/virtio/vhost.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index bcbad48..48fbac1 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -985,6 +985,12 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
     hdev->started = false;
     hdev->memory_changed = false;
     memory_listener_register(&hdev->memory_listener, &address_space_memory);
+    if (!vhost_has_free_slot()) {
+        fprintf(stderr, "vhost backend memory slots limit is less"
+                " than current number of present memory slots\n");
+        vhost_dev_cleanup(hdev);
+        return -1;
+    }
     return 0;
 fail_vq:
     while (--i >= 0) {
-- 
1.8.3.1

  parent reply	other threads:[~2015-07-30 10:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 10:11 [Qemu-devel] [PATCH for-2.4 v3 0/3] vhost: check if vhost has capacity for hotplugged memory Igor Mammedov
2015-07-30 10:11 ` [Qemu-devel] [PATCH for-2.4 v3 1/3] vhost: add vhost_has_free_slot() interface Igor Mammedov
2015-07-30 15:28   ` Michael S. Tsirkin
2015-07-30 15:45     ` Igor Mammedov
2015-07-30 15:51       ` Michael S. Tsirkin
2015-07-30 10:11 ` [Qemu-devel] [PATCH for-2.4 v3 2/3] pc-dimm: add vhost slots limit check before commiting to hotplug Igor Mammedov
2015-07-30 10:11 ` Igor Mammedov [this message]
2015-07-30 15:29   ` [Qemu-devel] [PATCH for-2.4 v3 3/3] vhost: fail backend intialization if memslots number is more than its supported limit Michael S. Tsirkin

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=1438251119-285996-4-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).