ia64/xen-unstable
changeset 18422:4ddd63b4be9b
[IA64] fix XENMEM_add_to_physmap with XENMAPSPACE_mfn
In case of XENMEM_add_to_physmap with XENMAPSPACE_mfn,
it triggers BUG_ON(). In fact it breaks some assumptions.
Update BUG_ON() conditions.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
In case of XENMEM_add_to_physmap with XENMAPSPACE_mfn,
it triggers BUG_ON(). In fact it breaks some assumptions.
Update BUG_ON() conditions.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author | Isaku Yamahata <yamahata@valinux.co.jp> |
---|---|
date | Fri Sep 12 14:32:45 2008 +0900 (2008-09-12) |
parents | d0a544d8a3f3 |
children | ec8eaab557d8 |
files | xen/arch/ia64/xen/mm.c |
line diff
1.1 --- a/xen/arch/ia64/xen/mm.c Mon Sep 01 16:59:43 2008 +0900 1.2 +++ b/xen/arch/ia64/xen/mm.c Fri Sep 12 14:32:45 2008 +0900 1.3 @@ -1227,7 +1227,7 @@ static void 1.4 adjust_page_count_info(struct page_info* page) 1.5 { 1.6 struct domain* d = page_get_owner(page); 1.7 - BUG_ON((page->count_info & PGC_count_mask) != 1); 1.8 + BUG_ON((page->count_info & PGC_count_mask) < 1); 1.9 if (d != NULL) { 1.10 int ret = get_page(page, d); 1.11 BUG_ON(ret == 0); 1.12 @@ -1272,6 +1272,7 @@ domain_put_page(struct domain* d, unsign 1.13 // 1.14 // guest_remove_page(): owner = d, count_info = 1 1.15 // memory_exchange(): owner = NULL, count_info = 1 1.16 + // XENMEM_add_to_physmap: ower = d, count_info >= 1 1.17 adjust_page_count_info(page); 1.18 } 1.19 } 1.20 @@ -2422,6 +2423,16 @@ steal_page(struct domain *d, struct page 1.21 return 0; 1.22 } 1.23 1.24 +static void 1.25 +__guest_physmap_add_page(struct domain *d, unsigned long gpfn, 1.26 + unsigned long mfn) 1.27 +{ 1.28 + set_gpfn_from_mfn(mfn, gpfn); 1.29 + smp_mb(); 1.30 + assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn, 1.31 + ASSIGN_writable | ASSIGN_pgc_allocated); 1.32 +} 1.33 + 1.34 int 1.35 guest_physmap_add_page(struct domain *d, unsigned long gpfn, 1.36 unsigned long mfn, unsigned int page_order) 1.37 @@ -2431,10 +2442,7 @@ guest_physmap_add_page(struct domain *d, 1.38 for (i = 0; i < (1UL << page_order); i++) { 1.39 BUG_ON(!mfn_valid(mfn)); 1.40 BUG_ON(mfn_to_page(mfn)->count_info != (PGC_allocated | 1)); 1.41 - set_gpfn_from_mfn(mfn, gpfn); 1.42 - smp_mb(); 1.43 - assign_domain_page_replace(d, gpfn << PAGE_SHIFT, mfn, 1.44 - ASSIGN_writable | ASSIGN_pgc_allocated); 1.45 + __guest_physmap_add_page(d, gpfn, mfn); 1.46 mfn++; 1.47 gpfn++; 1.48 } 1.49 @@ -2894,7 +2902,9 @@ arch_memory_op(int op, XEN_GUEST_HANDLE( 1.50 guest_physmap_remove_page(d, gpfn, mfn, 0); 1.51 1.52 /* Map at new location. */ 1.53 - guest_physmap_add_page(d, xatp.gpfn, mfn, 0); 1.54 + /* Here page->count_info = PGC_allocated | N where N >= 1*/ 1.55 + __guest_physmap_add_page(d, xatp.gpfn, mfn); 1.56 + page = NULL; /* prevent put_page() */ 1.57 1.58 out: 1.59 domain_unlock(d);