From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
samuel.thibault@ens-lyon.org, wei.liu2@citrix.com
Subject: [PATCH v3 08/19] mini-os: get maximum memory size from hypervisor
Date: Thu, 11 Aug 2016 11:18:11 +0200 [thread overview]
Message-ID: <1470907102-14656-9-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1470907102-14656-1-git-send-email-jgross@suse.com>
Add support for obtaining the maximum memory size from the hypervisor.
This will make it possible to support ballooning.
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
V2: Moved new stuff to balloon.c
---
balloon.c | 22 ++++++++++++++++++++++
include/balloon.h | 6 ++++++
mm.c | 2 ++
3 files changed, 30 insertions(+)
diff --git a/balloon.c b/balloon.c
index f9cf23b..1ec113d 100644
--- a/balloon.c
+++ b/balloon.c
@@ -21,4 +21,26 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <mini-os/os.h>
#include <mini-os/balloon.h>
+#include <mini-os/lib.h>
+#include <xen/xen.h>
+#include <xen/memory.h>
+
+unsigned long nr_max_pages;
+
+void get_max_pages(void)
+{
+ long ret;
+ domid_t domid = DOMID_SELF;
+
+ ret = HYPERVISOR_memory_op(XENMEM_maximum_reservation, &domid);
+ if ( ret < 0 )
+ {
+ printk("Could not get maximum pfn\n");
+ return;
+ }
+
+ nr_max_pages = ret;
+ printk("Maximum memory size: %ld pages\n", nr_max_pages);
+}
diff --git a/include/balloon.h b/include/balloon.h
index 9756a3f..cd79017 100644
--- a/include/balloon.h
+++ b/include/balloon.h
@@ -26,7 +26,13 @@
#ifdef CONFIG_BALLOON
+extern unsigned long nr_max_pages;
+
+void get_max_pages(void);
+
#else /* CONFIG_BALLOON */
+static inline void get_max_pages(void) { }
+
#endif /* CONFIG_BALLOON */
#endif /* _BALLOON_H_ */
diff --git a/mm.c b/mm.c
index 8cf3210..6d82f2a 100644
--- a/mm.c
+++ b/mm.c
@@ -38,6 +38,7 @@
#include <mini-os/hypervisor.h>
#include <xen/memory.h>
#include <mini-os/mm.h>
+#include <mini-os/balloon.h>
#include <mini-os/types.h>
#include <mini-os/lib.h>
#include <mini-os/xmalloc.h>
@@ -361,6 +362,7 @@ void init_mm(void)
printk("MM: Init\n");
+ get_max_pages();
arch_init_mm(&start_pfn, &max_pfn);
/*
* now we can initialise the page allocator
--
2.6.6
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-11 9:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 9:18 [PATCH v3 00/19] mini-os: support of auto-ballooning Juergen Gross
2016-08-11 9:18 ` [PATCH v3 01/19] mini-os: correct first free pfn Juergen Gross
2016-08-11 9:18 ` [PATCH v3 02/19] mini-os: remove unused alloc_contig_pages() function Juergen Gross
2016-08-11 9:18 ` [PATCH v3 03/19] mini-os: remove MM_DEBUG code Juergen Gross
2016-08-11 9:18 ` [PATCH v3 04/19] mini-os: add description of x86 memory usage Juergen Gross
2016-08-11 9:18 ` [PATCH v3 05/19] mini-os: add nr_free_pages counter Juergen Gross
2016-08-11 9:18 ` [PATCH v3 06/19] mini-os: let memory allocation fail if no free page available Juergen Gross
2016-08-11 9:18 ` [PATCH v3 07/19] mini-os: add ballooning config item Juergen Gross
2016-08-11 9:18 ` Juergen Gross [this message]
2016-08-11 9:18 ` [PATCH v3 09/19] mini-os: modify virtual memory layout for support of ballooning Juergen Gross
2016-08-11 9:18 ` [PATCH v3 10/19] mini-os: remove unused mem_test() function Juergen Gross
2016-08-11 9:18 ` [PATCH v3 11/19] mini-os: add checks for out of memory Juergen Gross
2016-08-11 9:18 ` [PATCH v3 12/19] mini-os: don't allocate new pages for level 1 p2m tree Juergen Gross
2016-08-11 9:18 ` [PATCH v3 13/19] mini-os: add function to map one frame Juergen Gross
2016-08-11 9:18 ` [PATCH v3 14/19] mini-os: move p2m related macros to header file Juergen Gross
2016-08-11 9:18 ` [PATCH v3 15/19] mini-os: remap p2m list in case of ballooning Juergen Gross
2016-08-11 9:18 ` [PATCH v3 16/19] mini-os: map page allocator's bitmap to virtual kernel area for ballooning Juergen Gross
2016-08-11 9:40 ` Samuel Thibault
2016-08-11 10:19 ` Juergen Gross
2016-08-11 10:21 ` Wei Liu
2016-08-11 10:26 ` Juergen Gross
2016-08-11 10:21 ` Samuel Thibault
2016-08-11 9:18 ` [PATCH v3 17/19] mini-os: add support for ballooning up Juergen Gross
2016-08-11 9:18 ` [PATCH v3 18/19] mini-os: balloon up in case of oom Juergen Gross
2016-08-11 9:18 ` [PATCH v3 19/19] mini-os: repair build system Juergen Gross
2016-08-11 15:11 ` Wei Liu
2016-08-11 19:50 ` Samuel Thibault
2016-08-11 12:13 ` [Minios-devel] [PATCH v3 00/19] mini-os: support of auto-ballooning Wei Liu
2016-08-12 11:42 ` Wei Liu
2016-08-12 12:48 ` Wei Liu
2016-08-12 13:04 ` Samuel Thibault
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=1470907102-14656-9-git-send-email-jgross@suse.com \
--to=jgross@suse.com \
--cc=minios-devel@lists.xenproject.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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).