[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-3.1-testing] x86: Move get_page/put_page out of header file, and only print on
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1196962152 0 # Node ID 9a7655b7cdc2eb7dece5be4d1cf02bd713b23fbd # Parent 485e163385c4f261e71e99467c377d6b6732b4f3 x86: Move get_page/put_page out of header file, and only print on get_page() failure if the domain is not dying. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> xen-unstable changeset: 16492:8e3d42fdb8e784b947fbd998d9a6df0ebf771718 xen-unstable date: Tue Dec 04 09:56:10 2007 +0000 --- xen/arch/x86/mm.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ xen/include/asm-x86/mm.h | 51 +---------------------------------------------- 2 files changed, 51 insertions(+), 49 deletions(-) diff -r 485e163385c4 -r 9a7655b7cdc2 xen/arch/x86/mm.c --- a/xen/arch/x86/mm.c Thu Dec 06 17:03:17 2007 +0000 +++ b/xen/arch/x86/mm.c Thu Dec 06 17:29:12 2007 +0000 @@ -1563,6 +1563,55 @@ static int mod_l4_entry(struct domain *d #endif +void put_page(struct page_info *page) +{ + u32 nx, x, y = page->count_info; + + do { + x = y; + nx = x - 1; + } + while ( unlikely((y = cmpxchg(&page->count_info, x, nx)) != x) ); + + if ( unlikely((nx & PGC_count_mask) == 0) ) + free_domheap_page(page); +} + + +int get_page(struct page_info *page, struct domain *domain) +{ + u32 x, nx, y = page->count_info; + u32 d, nd = page->u.inuse._domain; + u32 _domain = pickle_domptr(domain); + + do { + x = y; + nx = x + 1; + d = nd; + if ( unlikely((x & PGC_count_mask) == 0) || /* Not allocated? */ + unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */ + unlikely(d != _domain) ) /* Wrong owner? */ + { + if ( !_shadow_mode_refcounts(domain) && !domain->is_dying ) + gdprintk(XENLOG_INFO, + "Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%" + PRtype_info "\n", + page_to_mfn(page), domain, unpickle_domptr(d), + x, page->u.inuse.type_info); + return 0; + } + __asm__ __volatile__( + LOCK_PREFIX "cmpxchg8b %3" + : "=d" (nd), "=a" (y), "=c" (d), + "=m" (*(volatile u64 *)(&page->count_info)) + : "0" (d), "1" (x), "c" (d), "b" (nx) ); + } + while ( unlikely(nd != d) || unlikely(y != x) ); + + return 1; +} + + int alloc_page_type(struct page_info *page, unsigned long type) { struct domain *owner = page_get_owner(page); diff -r 485e163385c4 -r 9a7655b7cdc2 xen/include/asm-x86/mm.h --- a/xen/include/asm-x86/mm.h Thu Dec 06 17:03:17 2007 +0000 +++ b/xen/include/asm-x86/mm.h Thu Dec 06 17:29:12 2007 +0000 @@ -148,55 +148,8 @@ void free_page_type(struct page_info *pa void free_page_type(struct page_info *page, unsigned long type); int _shadow_mode_refcounts(struct domain *d); -static inline void put_page(struct page_info *page) -{ - u32 nx, x, y = page->count_info; - - do { - x = y; - nx = x - 1; - } - while ( unlikely((y = cmpxchg(&page->count_info, x, nx)) != x) ); - - if ( unlikely((nx & PGC_count_mask) == 0) ) - free_domheap_page(page); -} - - -static inline int get_page(struct page_info *page, - struct domain *domain) -{ - u32 x, nx, y = page->count_info; - u32 d, nd = page->u.inuse._domain; - u32 _domain = pickle_domptr(domain); - - do { - x = y; - nx = x + 1; - d = nd; - if ( unlikely((x & PGC_count_mask) == 0) || /* Not allocated? */ - unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */ - unlikely(d != _domain) ) /* Wrong owner? */ - { - if ( !_shadow_mode_refcounts(domain) ) - gdprintk(XENLOG_INFO, - "Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%" - PRtype_info "\n", - page_to_mfn(page), domain, unpickle_domptr(d), - x, page->u.inuse.type_info); - return 0; - } - __asm__ __volatile__( - LOCK_PREFIX "cmpxchg8b %3" - : "=d" (nd), "=a" (y), "=c" (d), - "=m" (*(volatile u64 *)(&page->count_info)) - : "0" (d), "1" (x), "c" (d), "b" (nx) ); - } - while ( unlikely(nd != d) || unlikely(y != x) ); - - return 1; -} - +void put_page(struct page_info *page); +int get_page(struct page_info *page, struct domain *domain); void put_page_type(struct page_info *page); int get_page_type(struct page_info *page, unsigned long type); int get_page_from_l1e(l1_pgentry_t l1e, struct domain *d); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |