[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Rename generic_page_range as apply_to_page_range, export the symbol
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID bd108ccc38a021ba40462b1bb01e50ce80f0631f # Parent 401624a17ef7442f38b28a0cedc129a91da5d67e Rename generic_page_range as apply_to_page_range, export the symbol to GPL modules. Rename pte_page parameter to pmd_page (following the Linux idiom). apply_to_pte_range() should take the pte spinlock. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 401624a17ef7 -r bd108ccc38a0 linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c --- a/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c Thu Mar 23 13:45:21 2006 +++ b/linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c Thu Mar 23 14:30:00 2006 @@ -32,13 +32,13 @@ #endif static int direct_remap_area_pte_fn(pte_t *pte, - struct page *pte_page, + struct page *pmd_page, unsigned long address, void *data) { mmu_update_t **v = (mmu_update_t **)data; - (*v)->ptr = ((u64)pfn_to_mfn(page_to_pfn(pte_page)) << + (*v)->ptr = ((u64)pfn_to_mfn(page_to_pfn(pmd_page)) << PAGE_SHIFT) | ((unsigned long)pte & ~PAGE_MASK); (*v)++; @@ -67,9 +67,9 @@ for (i = 0; i < size; i += PAGE_SIZE) { if ((v - u) == (PAGE_SIZE / sizeof(mmu_update_t))) { /* Fill in the PTE pointers. */ - rc = generic_page_range(mm, start_address, - address - start_address, - direct_remap_area_pte_fn, &w); + rc = apply_to_page_range(mm, start_address, + address - start_address, + direct_remap_area_pte_fn, &w); if (rc) goto out; w = u; @@ -93,8 +93,9 @@ if (v != u) { /* get the ptep's filled in */ - rc = generic_page_range(mm, start_address, address - start_address, - direct_remap_area_pte_fn, &w); + rc = apply_to_page_range(mm, start_address, + address - start_address, + direct_remap_area_pte_fn, &w); if (rc) goto out; rc = -EFAULT; @@ -142,11 +143,11 @@ EXPORT_SYMBOL(direct_kernel_remap_pfn_range); static int lookup_pte_fn( - pte_t *pte, struct page *pte_page, unsigned long addr, void *data) + pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) { uint64_t *ptep = (uint64_t *)data; if (ptep) - *ptep = ((uint64_t)pfn_to_mfn(page_to_pfn(pte_page)) << + *ptep = ((uint64_t)pfn_to_mfn(page_to_pfn(pmd_page)) << PAGE_SHIFT) | ((unsigned long)pte & ~PAGE_MASK); return 0; } @@ -155,13 +156,14 @@ unsigned long address, uint64_t *ptep) { - return generic_page_range(mm, address, PAGE_SIZE, lookup_pte_fn, ptep); + return apply_to_page_range(mm, address, PAGE_SIZE, + lookup_pte_fn, ptep); } EXPORT_SYMBOL(create_lookup_pte_addr); static int noop_fn( - pte_t *pte, struct page *pte_page, unsigned long addr, void *data) + pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) { return 0; } @@ -170,7 +172,7 @@ unsigned long address, unsigned long size) { - return generic_page_range(mm, address, size, noop_fn, NULL); + return apply_to_page_range(mm, address, size, noop_fn, NULL); } EXPORT_SYMBOL(touch_pte_range); diff -r 401624a17ef7 -r bd108ccc38a0 linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Thu Mar 23 13:45:21 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c Thu Mar 23 14:30:00 2006 @@ -517,7 +517,7 @@ } static int dealloc_pte_fn( - pte_t *pte, struct page *pte_page, unsigned long addr, void *data) + pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) { unsigned long mfn = pte_mfn(*pte); int ret; @@ -547,8 +547,8 @@ scrub_pages(vstart, 1 << order); balloon_lock(flags); - ret = generic_page_range( - &init_mm, vstart, PAGE_SIZE << order, dealloc_pte_fn, NULL); + ret = apply_to_page_range(&init_mm, vstart, + PAGE_SIZE << order, dealloc_pte_fn, NULL); BUG_ON(ret); current_pages -= 1UL << order; totalram_pages = current_pages; diff -r 401624a17ef7 -r bd108ccc38a0 linux-2.6-xen-sparse/drivers/xen/core/gnttab.c --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Thu Mar 23 13:45:21 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Thu Mar 23 14:30:00 2006 @@ -360,7 +360,7 @@ } #ifndef __ia64__ -static int map_pte_fn(pte_t *pte, struct page *pte_page, +static int map_pte_fn(pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) { unsigned long **frames = (unsigned long **)data; @@ -370,7 +370,7 @@ return 0; } -static int unmap_pte_fn(pte_t *pte, struct page *pte_page, +static int unmap_pte_fn(pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) { @@ -384,6 +384,7 @@ { gnttab_setup_table_t setup; unsigned long frames[NR_GRANT_FRAMES]; + int rc; #ifndef __ia64__ void *pframes = frames; struct vm_struct *area; @@ -393,8 +394,8 @@ setup.nr_frames = NR_GRANT_FRAMES; setup.frame_list = frames; - BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1)); - BUG_ON(setup.status != 0); + rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1); + BUG_ON(rc || setup.status); #ifndef __ia64__ if (shared == NULL) { @@ -402,9 +403,10 @@ BUG_ON(area == NULL); shared = area->addr; } - BUG_ON(generic_page_range(&init_mm, (unsigned long)shared, - PAGE_SIZE * NR_GRANT_FRAMES, - map_pte_fn, &pframes)); + rc = apply_to_page_range(&init_mm, (unsigned long)shared, + PAGE_SIZE * NR_GRANT_FRAMES, + map_pte_fn, &pframes); + BUG_ON(rc); #else shared = __va(frames[0] << PAGE_SHIFT); printk("grant table at %p\n", shared); @@ -418,9 +420,9 @@ { #ifndef __ia64__ - generic_page_range(&init_mm, (unsigned long)shared, - PAGE_SIZE * NR_GRANT_FRAMES, - unmap_pte_fn, NULL); + apply_to_page_range(&init_mm, (unsigned long)shared, + PAGE_SIZE * NR_GRANT_FRAMES, + unmap_pte_fn, NULL); #endif return 0; diff -r 401624a17ef7 -r bd108ccc38a0 linux-2.6-xen-sparse/drivers/xen/util.c --- a/linux-2.6-xen-sparse/drivers/xen/util.c Thu Mar 23 13:45:21 2006 +++ b/linux-2.6-xen-sparse/drivers/xen/util.c Thu Mar 23 14:30:00 2006 @@ -6,9 +6,9 @@ #include <asm/uaccess.h> #include <xen/driver_util.h> -static int f(pte_t *pte, struct page *pte_page, unsigned long addr, void *data) +static int f(pte_t *pte, struct page *pmd_page, unsigned long addr, void *data) { - /* generic_page_range() does all the hard work. */ + /* apply_to_page_range() does all the hard work. */ return 0; } @@ -24,8 +24,8 @@ * This ensures that page tables are constructed for this region * of kernel virtual address space and mapped into init_mm. */ - if (generic_page_range(&init_mm, (unsigned long)area->addr, - area->size, f, NULL)) { + if (apply_to_page_range(&init_mm, (unsigned long)area->addr, + area->size, f, NULL)) { free_vm_area(area); return NULL; } diff -r 401624a17ef7 -r bd108ccc38a0 linux-2.6-xen-sparse/include/linux/mm.h --- a/linux-2.6-xen-sparse/include/linux/mm.h Thu Mar 23 13:45:21 2006 +++ b/linux-2.6-xen-sparse/include/linux/mm.h Thu Mar 23 14:30:00 2006 @@ -1020,10 +1020,10 @@ #define FOLL_ANON 0x08 /* give ZERO_PAGE if no pgtable */ #ifdef CONFIG_XEN -typedef int (*pte_fn_t)(pte_t *pte, struct page *pte_page, unsigned long addr, - void *data); -extern int generic_page_range(struct mm_struct *mm, unsigned long address, - unsigned long size, pte_fn_t fn, void *data); +typedef int (*pte_fn_t)(pte_t *pte, struct page *pmd_page, unsigned long addr, + void *data); +extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, + unsigned long size, pte_fn_t fn, void *data); #endif #ifdef CONFIG_PROC_FS diff -r 401624a17ef7 -r bd108ccc38a0 linux-2.6-xen-sparse/mm/memory.c --- a/linux-2.6-xen-sparse/mm/memory.c Thu Mar 23 13:45:21 2006 +++ b/linux-2.6-xen-sparse/mm/memory.c Thu Mar 23 14:30:00 2006 @@ -1378,36 +1378,39 @@ EXPORT_SYMBOL(remap_pfn_range); #ifdef CONFIG_XEN -static inline int generic_pte_range(struct mm_struct *mm, pmd_t *pmd, - unsigned long addr, unsigned long end, - pte_fn_t fn, void *data) +static inline int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, + unsigned long addr, unsigned long end, + pte_fn_t fn, void *data) { pte_t *pte; int err; - struct page *pte_page; + struct page *pmd_page; + spinlock_t *ptl; pte = (mm == &init_mm) ? pte_alloc_kernel(pmd, addr) : - pte_alloc_map(mm, pmd, addr); + pte_alloc_map_lock(mm, pmd, addr, &ptl); if (!pte) return -ENOMEM; - pte_page = pmd_page(*pmd); + BUG_ON(pmd_huge(*pmd)); + + pmd_page = pmd_page(*pmd); do { - err = fn(pte, pte_page, addr, data); + err = fn(pte, pmd_page, addr, data); if (err) break; } while (pte++, addr += PAGE_SIZE, addr != end); if (mm != &init_mm) - pte_unmap(pte-1); + pte_unmap_unlock(pte-1, ptl); return err; } -static inline int generic_pmd_range(struct mm_struct *mm, pud_t *pud, - unsigned long addr, unsigned long end, - pte_fn_t fn, void *data) +static inline int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud, + unsigned long addr, unsigned long end, + pte_fn_t fn, void *data) { pmd_t *pmd; unsigned long next; @@ -1418,16 +1421,16 @@ return -ENOMEM; do { next = pmd_addr_end(addr, end); - err = generic_pte_range(mm, pmd, addr, next, fn, data); + err = apply_to_pte_range(mm, pmd, addr, next, fn, data); if (err) break; } while (pmd++, addr = next, addr != end); return err; } -static inline int generic_pud_range(struct mm_struct *mm, pgd_t *pgd, - unsigned long addr, unsigned long end, - pte_fn_t fn, void *data) +static inline int apply_to_pud_range(struct mm_struct *mm, pgd_t *pgd, + unsigned long addr, unsigned long end, + pte_fn_t fn, void *data) { pud_t *pud; unsigned long next; @@ -1438,7 +1441,7 @@ return -ENOMEM; do { next = pud_addr_end(addr, end); - err = generic_pmd_range(mm, pud, addr, next, fn, data); + err = apply_to_pmd_range(mm, pud, addr, next, fn, data); if (err) break; } while (pud++, addr = next, addr != end); @@ -1449,8 +1452,8 @@ * Scan a region of virtual memory, filling in page tables as necessary * and calling a provided function on each leaf page table. */ -int generic_page_range(struct mm_struct *mm, unsigned long addr, - unsigned long size, pte_fn_t fn, void *data) +int apply_to_page_range(struct mm_struct *mm, unsigned long addr, + unsigned long size, pte_fn_t fn, void *data) { pgd_t *pgd; unsigned long next; @@ -1461,12 +1464,13 @@ pgd = pgd_offset(mm, addr); do { next = pgd_addr_end(addr, end); - err = generic_pud_range(mm, pgd, addr, next, fn, data); + err = apply_to_pud_range(mm, pgd, addr, next, fn, data); if (err) break; } while (pgd++, addr = next, addr != end); return err; } +EXPORT_SYMBOL_GPL(apply_to_page_range); #endif /* _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |