# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1224683729 -3600
# Node ID e410857fd83c2c6f9c0c0a4adb84f25e7f81c617
# Parent f7a2c0985f9933ac37ce5ec81e33352ff3813006
Remove contiguous_bitmap[] as it's no longer needed.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
arch/i386/kernel/pci-dma-xen.c | 10 --
arch/i386/mm/hypervisor.c | 57 ---------------
arch/i386/mm/init-xen.c | 7 -
arch/ia64/kernel/setup.c | 3
arch/ia64/xen/hypervisor.c | 155 -----------------------------------------
arch/ia64/xen/xen_dma.c | 3
arch/x86_64/mm/init-xen.c | 7 -
include/asm-ia64/hypervisor.h | 1
8 files changed, 3 insertions(+), 240 deletions(-)
diff -r f7a2c0985f99 -r e410857fd83c arch/i386/kernel/pci-dma-xen.c
--- a/arch/i386/kernel/pci-dma-xen.c Wed Oct 22 11:54:44 2008 +0100
+++ b/arch/i386/kernel/pci-dma-xen.c Wed Oct 22 14:55:29 2008 +0100
@@ -97,17 +97,11 @@ static int check_pages_physically_contig
int range_straddles_page_boundary(paddr_t p, size_t size)
{
- extern unsigned long *contiguous_bitmap;
unsigned long pfn = p >> PAGE_SHIFT;
unsigned int offset = p & ~PAGE_MASK;
- if (offset + size <= PAGE_SIZE)
- return 0;
- if (test_bit(pfn, contiguous_bitmap))
- return 0;
- if (check_pages_physically_contiguous(pfn, offset, size))
- return 0;
- return 1;
+ return ((offset + size > PAGE_SIZE) &&
+ !check_pages_physically_contiguous(pfn, offset, size));
}
int
diff -r f7a2c0985f99 -r e410857fd83c arch/i386/mm/hypervisor.c
--- a/arch/i386/mm/hypervisor.c Wed Oct 22 11:54:44 2008 +0100
+++ b/arch/i386/mm/hypervisor.c Wed Oct 22 14:55:29 2008 +0100
@@ -190,54 +190,6 @@ void xen_set_ldt(const void *ptr, unsign
BUG_ON(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0);
}
-/*
- * Bitmap is indexed by page number. If bit is set, the page is part of a
- * xen_create_contiguous_region() area of memory.
- */
-unsigned long *contiguous_bitmap;
-
-static void contiguous_bitmap_set(
- unsigned long first_page, unsigned long nr_pages)
-{
- unsigned long start_off, end_off, curr_idx, end_idx;
-
- curr_idx = first_page / BITS_PER_LONG;
- start_off = first_page & (BITS_PER_LONG-1);
- end_idx = (first_page + nr_pages) / BITS_PER_LONG;
- end_off = (first_page + nr_pages) & (BITS_PER_LONG-1);
-
- if (curr_idx == end_idx) {
- contiguous_bitmap[curr_idx] |=
- ((1UL<<end_off)-1) & -(1UL<<start_off);
- } else {
- contiguous_bitmap[curr_idx] |= -(1UL<<start_off);
- while ( ++curr_idx < end_idx )
- contiguous_bitmap[curr_idx] = ~0UL;
- contiguous_bitmap[curr_idx] |= (1UL<<end_off)-1;
- }
-}
-
-static void contiguous_bitmap_clear(
- unsigned long first_page, unsigned long nr_pages)
-{
- unsigned long start_off, end_off, curr_idx, end_idx;
-
- curr_idx = first_page / BITS_PER_LONG;
- start_off = first_page & (BITS_PER_LONG-1);
- end_idx = (first_page + nr_pages) / BITS_PER_LONG;
- end_off = (first_page + nr_pages) & (BITS_PER_LONG-1);
-
- if (curr_idx == end_idx) {
- contiguous_bitmap[curr_idx] &=
- -(1UL<<end_off) | ((1UL<<start_off)-1);
- } else {
- contiguous_bitmap[curr_idx] &= (1UL<<start_off)-1;
- while ( ++curr_idx != end_idx )
- contiguous_bitmap[curr_idx] = 0;
- contiguous_bitmap[curr_idx] &= -(1UL<<end_off);
- }
-}
-
/* Protected by balloon_lock. */
#define MAX_CONTIG_ORDER 9 /* 2MB */
static unsigned long discontig_frames[1<<MAX_CONTIG_ORDER];
@@ -334,10 +286,6 @@ int xen_create_contiguous_region(
if (HYPERVISOR_multicall_check(cr_mcl, i, NULL))
BUG();
- if (success)
- contiguous_bitmap_set(__pa(vstart) >> PAGE_SHIFT,
- 1UL << order);
-
balloon_unlock(flags);
return success ? 0 : -ENOMEM;
@@ -363,8 +311,7 @@ void xen_destroy_contiguous_region(unsig
}
};
- if (xen_feature(XENFEAT_auto_translated_physmap) ||
- !test_bit(__pa(vstart) >> PAGE_SHIFT, contiguous_bitmap))
+ if (xen_feature(XENFEAT_auto_translated_physmap))
return;
if (unlikely(order > MAX_CONTIG_ORDER))
@@ -376,8 +323,6 @@ void xen_destroy_contiguous_region(unsig
scrub_pages((void *)vstart, 1 << order);
balloon_lock(flags);
-
- contiguous_bitmap_clear(__pa(vstart) >> PAGE_SHIFT, 1UL << order);
/* 1. Find start MFN of contiguous extent. */
in_frame = pfn_to_mfn(__pa(vstart) >> PAGE_SHIFT);
diff -r f7a2c0985f99 -r e410857fd83c arch/i386/mm/init-xen.c
--- a/arch/i386/mm/init-xen.c Wed Oct 22 11:54:44 2008 +0100
+++ b/arch/i386/mm/init-xen.c Wed Oct 22 14:55:29 2008 +0100
@@ -47,8 +47,6 @@
#include <asm/hypervisor.h>
#include <asm/swiotlb.h>
-extern unsigned long *contiguous_bitmap;
-
unsigned int __VMALLOC_RESERVE = 128 << 20;
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -619,11 +617,6 @@ void __init mem_init(void)
int tmp;
int bad_ppro;
unsigned long pfn;
-
- contiguous_bitmap = alloc_bootmem_low_pages(
- (max_low_pfn + 2*BITS_PER_LONG) >> 3);
- BUG_ON(!contiguous_bitmap);
- memset(contiguous_bitmap, 0, (max_low_pfn + 2*BITS_PER_LONG) >> 3);
#if defined(CONFIG_SWIOTLB)
swiotlb_init();
diff -r f7a2c0985f99 -r e410857fd83c arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c Wed Oct 22 11:54:44 2008 +0100
+++ b/arch/ia64/kernel/setup.c Wed Oct 22 14:55:29 2008 +0100
@@ -684,9 +684,6 @@ setup_arch (char **cmdline_p)
}
#endif
paging_init();
-#ifdef CONFIG_XEN
- xen_contiguous_bitmap_init(max_pfn);
-#endif
}
/*
diff -r f7a2c0985f99 -r e410857fd83c arch/ia64/xen/hypervisor.c
--- a/arch/ia64/xen/hypervisor.c Wed Oct 22 11:54:44 2008 +0100
+++ b/arch/ia64/xen/hypervisor.c Wed Oct 22 14:55:29 2008 +0100
@@ -77,154 +77,6 @@ xen_cpu_init(void)
{
extern void xen_smp_intr_init(void);
xen_smp_intr_init();
-}
-
-/*
- *XXX same as i386, x86_64 contiguous_bitmap_set(), contiguous_bitmap_clear()
- * move those to lib/contiguous_bitmap?
- *XXX discontigmem/sparsemem
- */
-
-/*
- * Bitmap is indexed by page number. If bit is set, the page is part of a
- * xen_create_contiguous_region() area of memory.
- */
-unsigned long *contiguous_bitmap __read_mostly;
-
-#ifdef CONFIG_VIRTUAL_MEM_MAP
-/* Following logic is stolen from create_mem_map_table() for virtual memmap */
-static int
-create_contiguous_bitmap(u64 start, u64 end, void *arg)
-{
- unsigned long address, start_page, end_page;
- unsigned long bitmap_start, bitmap_end;
- unsigned char *bitmap;
- int node;
- pgd_t *pgd;
- pud_t *pud;
- pmd_t *pmd;
- pte_t *pte;
-
- bitmap_start = (unsigned long)contiguous_bitmap +
- ((__pa(start) >> PAGE_SHIFT) >> 3);
- bitmap_end = (unsigned long)contiguous_bitmap +
- (((__pa(end) >> PAGE_SHIFT) + 2 * BITS_PER_LONG) >> 3);
-
- start_page = bitmap_start & PAGE_MASK;
- end_page = PAGE_ALIGN(bitmap_end);
- node = paddr_to_nid(__pa(start));
-
- bitmap = alloc_bootmem_pages_node(NODE_DATA(node),
- end_page - start_page);
- BUG_ON(!bitmap);
- memset(bitmap, 0, end_page - start_page);
-
- for (address = start_page; address < end_page; address += PAGE_SIZE) {
- pgd = pgd_offset_k(address);
- if (pgd_none(*pgd))
- pgd_populate(&init_mm, pgd,
- alloc_bootmem_pages_node(NODE_DATA(node),
- PAGE_SIZE));
- pud = pud_offset(pgd, address);
-
- if (pud_none(*pud))
- pud_populate(&init_mm, pud,
- alloc_bootmem_pages_node(NODE_DATA(node),
- PAGE_SIZE));
- pmd = pmd_offset(pud, address);
-
- if (pmd_none(*pmd))
- pmd_populate_kernel(&init_mm, pmd,
- alloc_bootmem_pages_node
- (NODE_DATA(node), PAGE_SIZE));
- pte = pte_offset_kernel(pmd, address);
-
- if (pte_none(*pte))
- set_pte(pte,
- pfn_pte(__pa(bitmap + (address - start_page))
- >> PAGE_SHIFT, PAGE_KERNEL));
- }
- return 0;
-}
-#endif
-
-static void
-__contiguous_bitmap_init(unsigned long size)
-{
- contiguous_bitmap = alloc_bootmem_pages(size);
- BUG_ON(!contiguous_bitmap);
- memset(contiguous_bitmap, 0, size);
-}
-
-void
-xen_contiguous_bitmap_init(unsigned long end_pfn)
-{
- unsigned long size = (end_pfn + 2 * BITS_PER_LONG) >> 3;
-#ifndef CONFIG_VIRTUAL_MEM_MAP
- __contiguous_bitmap_init(size);
-#else
- unsigned long max_gap = 0;
-
- efi_memmap_walk(find_largest_hole, (u64*)&max_gap);
- if (max_gap < LARGE_GAP) {
- __contiguous_bitmap_init(size);
- } else {
- unsigned long map_size = PAGE_ALIGN(size);
- vmalloc_end -= map_size;
- contiguous_bitmap = (unsigned long*)vmalloc_end;
- efi_memmap_walk(create_contiguous_bitmap, NULL);
- }
-#endif
-}
-
-#if 0
-int
-contiguous_bitmap_test(void* p)
-{
- return test_bit(__pa(p) >> PAGE_SHIFT, contiguous_bitmap);
-}
-#endif
-
-static void contiguous_bitmap_set(
- unsigned long first_page, unsigned long nr_pages)
-{
- unsigned long start_off, end_off, curr_idx, end_idx;
-
- curr_idx = first_page / BITS_PER_LONG;
- start_off = first_page & (BITS_PER_LONG-1);
- end_idx = (first_page + nr_pages) / BITS_PER_LONG;
- end_off = (first_page + nr_pages) & (BITS_PER_LONG-1);
-
- if (curr_idx == end_idx) {
- contiguous_bitmap[curr_idx] |=
- ((1UL<<end_off)-1) & -(1UL<<start_off);
- } else {
- contiguous_bitmap[curr_idx] |= -(1UL<<start_off);
- while ( ++curr_idx < end_idx )
- contiguous_bitmap[curr_idx] = ~0UL;
- contiguous_bitmap[curr_idx] |= (1UL<<end_off)-1;
- }
-}
-
-static void contiguous_bitmap_clear(
- unsigned long first_page, unsigned long nr_pages)
-{
- unsigned long start_off, end_off, curr_idx, end_idx;
-
- curr_idx = first_page / BITS_PER_LONG;
- start_off = first_page & (BITS_PER_LONG-1);
- end_idx = (first_page + nr_pages) / BITS_PER_LONG;
- end_off = (first_page + nr_pages) & (BITS_PER_LONG-1);
-
- if (curr_idx == end_idx) {
- contiguous_bitmap[curr_idx] &=
- -(1UL<<end_off) | ((1UL<<start_off)-1);
- } else {
- contiguous_bitmap[curr_idx] &= (1UL<<start_off)-1;
- while ( ++curr_idx != end_idx )
- contiguous_bitmap[curr_idx] = 0;
- contiguous_bitmap[curr_idx] &= -(1UL<<end_off);
- }
}
/*
@@ -303,8 +155,6 @@ __xen_create_contiguous_region(unsigned
} else
success = 1;
}
- if (success)
- contiguous_bitmap_set(start_gpfn, num_gpfn);
#if 0
if (success) {
unsigned long mfn;
@@ -363,9 +213,6 @@ __xen_destroy_contiguous_region(unsigned
};
- if (!test_bit(start_gpfn, contiguous_bitmap))
- return;
-
if (unlikely(order > MAX_CONTIG_ORDER))
return;
@@ -375,8 +222,6 @@ __xen_destroy_contiguous_region(unsigned
scrub_pages(vstart, num_gpfn);
balloon_lock(flags);
-
- contiguous_bitmap_clear(start_gpfn, num_gpfn);
/* Do the exchange for non-contiguous MFNs. */
in_frame = start_gpfn;
diff -r f7a2c0985f99 -r e410857fd83c arch/ia64/xen/xen_dma.c
--- a/arch/ia64/xen/xen_dma.c Wed Oct 22 11:54:44 2008 +0100
+++ b/arch/ia64/xen/xen_dma.c Wed Oct 22 14:55:29 2008 +0100
@@ -57,7 +57,6 @@ static int check_pages_physically_contig
int range_straddles_page_boundary(paddr_t p, size_t size)
{
- extern unsigned long *contiguous_bitmap;
unsigned long pfn = p >> PAGE_SHIFT;
unsigned int offset = p & ~PAGE_MASK;
@@ -65,8 +64,6 @@ int range_straddles_page_boundary(paddr_
return 0;
if (offset + size <= PAGE_SIZE)
- return 0;
- if (test_bit(pfn, contiguous_bitmap))
return 0;
if (check_pages_physically_contiguous(pfn, offset, size))
return 0;
diff -r f7a2c0985f99 -r e410857fd83c arch/x86_64/mm/init-xen.c
--- a/arch/x86_64/mm/init-xen.c Wed Oct 22 11:54:44 2008 +0100
+++ b/arch/x86_64/mm/init-xen.c Wed Oct 22 14:55:29 2008 +0100
@@ -61,8 +61,6 @@ EXPORT_SYMBOL(__kernel_page_user);
int after_bootmem;
-extern unsigned long *contiguous_bitmap;
-
static unsigned long dma_reserve __initdata;
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -972,11 +970,6 @@ void __init mem_init(void)
long codesize, reservedpages, datasize, initsize;
unsigned long pfn;
- contiguous_bitmap = alloc_bootmem_low_pages(
- (end_pfn + 2*BITS_PER_LONG) >> 3);
- BUG_ON(!contiguous_bitmap);
- memset(contiguous_bitmap, 0, (end_pfn + 2*BITS_PER_LONG) >> 3);
-
pci_iommu_alloc();
/* How many end-of-memory variables you have, grandma! */
diff -r f7a2c0985f99 -r e410857fd83c include/asm-ia64/hypervisor.h
--- a/include/asm-ia64/hypervisor.h Wed Oct 22 11:54:44 2008 +0100
+++ b/include/asm-ia64/hypervisor.h Wed Oct 22 14:55:29 2008 +0100
@@ -140,7 +140,6 @@ int privcmd_mmap(struct file * file, str
#define pte_mfn(_x) pte_pfn(_x)
#define phys_to_machine_mapping_valid(_x) (1)
-void xen_contiguous_bitmap_init(unsigned long end_pfn);
int __xen_create_contiguous_region(unsigned long vstart, unsigned int order,
unsigned int address_bits);
static inline int
xen_create_contiguous_region(unsigned long vstart,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|