From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xensource.com
Cc: olaf@aepfle.de, George.Dunlap@eu.citrix.com,
andres@gridcentric.ca, tim@xen.org, keir.xen@gmail.com,
adin@gridcentric.ca
Subject: [PATCH 1 of 3] Improvements over API change for p2m lookups
Date: Tue, 08 Nov 2011 16:42:24 -0500 [thread overview]
Message-ID: <a0c55cc5d696294a899c.1320788544@xdev.gridcentric.ca> (raw)
In-Reply-To: <patchbomb.1320788543@xdev.gridcentric.ca>
xen/arch/x86/hvm/hvm.c | 3 +--
xen/arch/x86/mm/p2m.c | 8 ++++----
xen/common/grant_table.c | 2 +-
xen/common/memory.c | 6 +++++-
4 files changed, 11 insertions(+), 8 deletions(-)
Ranging from the cosmetic to actual bug fixing.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
diff -r 390d6dc6c34b -r a0c55cc5d696 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1791,8 +1791,7 @@ int hvm_virtual_to_linear_addr(
return 0;
}
-/* We leave this function holding a lock on the p2m entry and a ref
- * on the mapped mfn */
+/* We leave this function holding a lock on the p2m entry */
static void *__hvm_map_guest_frame(unsigned long gfn, bool_t writable)
{
unsigned long mfn;
diff -r 390d6dc6c34b -r a0c55cc5d696 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -349,21 +349,21 @@ void p2m_teardown(struct p2m_domain *p2m
if (p2m == NULL)
return;
+ p2m_lock(p2m);
+
#ifdef __x86_64__
for ( gfn=0; gfn < p2m->max_mapped_pfn; gfn++ )
{
- mfn = get_gfn_query(d, gfn, &t);
+ p2m_access_t a;
+ mfn = p2m->get_entry(p2m, gfn, &t, &a, p2m_query, NULL);
if ( mfn_valid(mfn) && (t == p2m_ram_shared) )
{
ASSERT(!p2m_is_nestedp2m(p2m));
BUG_ON(mem_sharing_unshare_page(d, gfn, MEM_SHARING_DESTROY_GFN));
}
- put_gfn(d, gfn);
}
#endif
- p2m_lock(p2m);
-
p2m->phys_table = pagetable_null();
while ( (pg = page_list_remove_head(&p2m->pages)) )
diff -r 390d6dc6c34b -r a0c55cc5d696 xen/common/grant_table.c
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -470,7 +470,7 @@ __gnttab_map_grant_ref(
struct domain *ld, *rd, *owner;
struct vcpu *led;
int handle;
- unsigned long gfn = INVALID_GFN;
+ unsigned long gfn = INVALID_GFN;
unsigned long frame = 0, nr_gets = 0;
struct page_info *pg;
int rc = GNTST_okay;
diff -r 390d6dc6c34b -r a0c55cc5d696 xen/common/memory.c
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -270,7 +270,7 @@ static long memory_exchange(XEN_GUEST_HA
PAGE_LIST_HEAD(out_chunk_list);
unsigned long in_chunk_order, out_chunk_order;
xen_pfn_t gpfn, gmfn, mfn;
- unsigned long i, j, k;
+ unsigned long i, j, k = 0; /* gcc ... */
unsigned int memflags = 0;
long rc = 0;
struct domain *d;
@@ -496,8 +496,12 @@ static long memory_exchange(XEN_GUEST_HA
fail:
/* Reassign any input pages we managed to steal. */
while ( (page = page_list_remove_head(&in_chunk_list)) )
+ {
+ put_gfn(d, gmfn + k--);
if ( assign_pages(d, page, 0, MEMF_no_refcount) )
BUG();
+ }
+
dying:
rcu_unlock_domain(d);
/* Free any output pages we managed to allocate. */
next prev parent reply other threads:[~2011-11-08 21:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 21:42 [PATCH 0 of 3] p2m synchronization second part Andres Lagar-Cavilla
2011-11-08 21:42 ` Andres Lagar-Cavilla [this message]
2011-11-10 12:48 ` [PATCH 1 of 3] Improvements over API change for p2m lookups Tim Deegan
2011-11-08 21:42 ` [PATCH 2 of 3] Make p2m lookups fully synchronized wrt modifications Andres Lagar-Cavilla
2011-11-10 12:53 ` Tim Deegan
2011-11-14 18:03 ` Andres Lagar-Cavilla
2011-11-24 11:35 ` Tim Deegan
2011-11-24 16:41 ` Andres Lagar-Cavilla
2011-12-01 13:59 ` Tim Deegan
2011-12-02 16:33 ` Andres Lagar-Cavilla
2011-12-02 17:38 ` Tim Deegan
2011-11-08 21:42 ` [PATCH 3 of 3] Make p2m critical sections hold a ref on the underlying mfn Andres Lagar-Cavilla
2011-11-10 13:17 ` Tim Deegan
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=a0c55cc5d696294a899c.1320788544@xdev.gridcentric.ca \
--to=andres@lagarcavilla.org \
--cc=George.Dunlap@eu.citrix.com \
--cc=adin@gridcentric.ca \
--cc=andres@gridcentric.ca \
--cc=keir.xen@gmail.com \
--cc=olaf@aepfle.de \
--cc=tim@xen.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 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.