From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
"Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>
Subject: [RFC PATCH 6/8]: Ballooning changes
Date: Wed, 15 Aug 2012 18:05:41 -0700 [thread overview]
Message-ID: <20120815180541.2fddead9@mantra.us.oracle.com> (raw)
---
drivers/xen/balloon.c | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 31ab82f..57960a1 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -358,10 +358,18 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
BUG_ON(!xen_feature(XENFEAT_auto_translated_physmap) &&
phys_to_machine_mapping_valid(pfn));
- set_phys_to_machine(pfn, frame_list[i]);
-
+ if (!xen_pvh_domain()) {
+ set_phys_to_machine(pfn, frame_list[i]);
+ } else {
+ pte_t *ptep;
+ unsigned int level;
+ void *addr = __va(pfn << PAGE_SHIFT);
+ ptep = lookup_address((unsigned long)addr, &level);
+ set_pte(ptep, pfn_pte(pfn, PAGE_KERNEL));
+ }
/* Link back into the page tables if not highmem. */
- if (xen_pv_domain() && !PageHighMem(page)) {
+ if (xen_pv_domain() && !PageHighMem(page) &&
+ !xen_pvh_domain()) {
int ret;
ret = HYPERVISOR_update_va_mapping(
(unsigned long)__va(pfn << PAGE_SHIFT),
@@ -417,7 +425,14 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
scrub_page(page);
- if (xen_pv_domain() && !PageHighMem(page)) {
+ if (xen_pvh_domain() && !PageHighMem(page)) {
+ unsigned int level;
+ pte_t *ptep;
+ void *addr = __va(pfn << PAGE_SHIFT);
+ ptep = lookup_address((unsigned long)addr, &level);
+ set_pte(ptep, __pte(0));
+
+ } else if (xen_pv_domain() && !PageHighMem(page)) {
ret = HYPERVISOR_update_va_mapping(
(unsigned long)__va(pfn << PAGE_SHIFT),
__pte_ma(0), 0);
@@ -433,7 +448,8 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
/* No more mappings: invalidate P2M and add to balloon. */
for (i = 0; i < nr_pages; i++) {
pfn = mfn_to_pfn(frame_list[i]);
- __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
+ if (!xen_pvh_domain())
+ __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
balloon_append(pfn_to_page(pfn));
}
--
1.7.2.3
next reply other threads:[~2012-08-16 1:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 1:05 Mukesh Rathor [this message]
2012-08-16 14:13 ` [RFC PATCH 6/8]: Ballooning changes Stefano Stabellini
2012-08-17 9:46 ` Ian Campbell
2012-09-13 16:33 ` 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=20120815180541.2fddead9@mantra.us.oracle.com \
--to=mukesh.rathor@oracle.com \
--cc=Xen-devel@lists.xensource.com \
--cc=konrad.wilk@oracle.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).