From: Daniel Kiper <daniel.kiper@oracle.com>
To: carsten@schiers.de, darren.s.shepherd@gmail.com,
david.vrabel@citrix.com, ian.campbell@citrix.com,
ian.jackson@eu.citrix.com, james-xen@dingwall.me.uk,
konrad.wilk@oracle.com, linux-kernel@vger.kernel.org,
xen-devel@lists.xensource.com
Cc: Daniel Kiper <daniel.kiper@oracle.com>
Subject: [PATCH v2 1/2] xen/balloon: Notify a host about a guest memory size limit
Date: Mon, 29 Apr 2013 13:37:47 +0200 [thread overview]
Message-ID: <1367235468-8360-2-git-send-email-daniel.kiper@oracle.com> (raw)
In-Reply-To: <1367235468-8360-1-git-send-email-daniel.kiper@oracle.com>
Notify a host about a guest memory size limit.
Idea of this patch was discussed with Ian Campbell and Ian Jackson.
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
drivers/xen/balloon.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index a56776d..856661f 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -65,6 +65,7 @@
#include <xen/balloon.h>
#include <xen/features.h>
#include <xen/page.h>
+#include <xen/xenbus.h>
/*
* balloon_process() state:
@@ -586,6 +587,9 @@ static void __init balloon_add_region(unsigned long start_pfn,
static int __init balloon_init(void)
{
int i;
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+ int rc;
+#endif
if (!xen_domain())
return -ENODEV;
@@ -621,6 +625,27 @@ static int __init balloon_init(void)
balloon_add_region(PFN_UP(xen_extra_mem[i].start),
PFN_DOWN(xen_extra_mem[i].size));
+#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+ /*
+ * Notify a host about our memory size limit.
+ *
+ * The guest-max value is in KiB, so MAX_DOMAIN_PAGES should
+ * be converted respectively. PAGE_SHIFT converts pages to bytes,
+ * hence PAGE_SHIFT - 10.
+ */
+ rc = xenbus_printf(XBT_NIL, "memory", "guest-max", "%lu",
+ MAX_DOMAIN_PAGES << (PAGE_SHIFT - 10));
+
+ if (rc < 0)
+ pr_info("xen/balloon: Memory hotplug may not be supported "
+ "in some environments: %i\n", rc);
+#else
+ xenbus_printf(XBT_NIL, "memory", "guest-max", "%lu",
+ (balloon_stats.current_pages +
+ balloon_stats.balloon_low +
+ balloon_stats.balloon_high) << (PAGE_SHIFT - 10));
+#endif
+
return 0;
}
--
1.7.10.4
next prev parent reply other threads:[~2013-04-29 11:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 11:37 [PATCH v2 0/2] xen/balloon: Extension and fix Daniel Kiper
2013-04-29 11:37 ` Daniel Kiper [this message]
2013-04-29 14:35 ` [PATCH v2 1/2] xen/balloon: Notify a host about a guest memory size limit Ian Campbell
2013-04-30 12:40 ` Daniel Kiper
2013-04-29 11:37 ` [PATCH v2 2/2] xen/balloon: Enforce various limits on target Daniel Kiper
2013-04-29 14:44 ` Ian Campbell
2013-04-30 12:59 ` Daniel Kiper
2013-04-30 13:44 ` Ian Campbell
2013-04-30 18:58 ` Daniel Kiper
2013-05-02 11:34 ` Stefano Stabellini
2013-05-02 18:04 ` Konrad Rzeszutek Wilk
2013-05-03 8:15 ` [Xen-devel] " Ian Campbell
2013-05-03 13:00 ` Daniel Kiper
2013-05-03 13:21 ` Ian Campbell
2013-05-03 13:47 ` Daniel Kiper
2013-05-03 14:11 ` Ian Campbell
2013-05-03 15:47 ` Daniel Kiper
2013-05-03 16:00 ` Ian Campbell
2013-05-03 8:04 ` Ian Campbell
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=1367235468-8360-2-git-send-email-daniel.kiper@oracle.com \
--to=daniel.kiper@oracle.com \
--cc=carsten@schiers.de \
--cc=darren.s.shepherd@gmail.com \
--cc=david.vrabel@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=james-xen@dingwall.me.uk \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.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
Powered by JetHome