2005-04-16 18:20:36 -04:00
|
|
|
#ifndef meminit_h
|
|
|
|
#define meminit_h
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Entries defined so far:
|
|
|
|
* - boot param structure itself
|
|
|
|
* - memory map
|
|
|
|
* - initrd (optional)
|
|
|
|
* - command line string
|
|
|
|
* - kernel code & data
|
2006-12-07 12:51:35 -05:00
|
|
|
* - crash dumping code reserved region
|
2005-09-08 15:39:59 -04:00
|
|
|
* - Kernel memory map built from EFI memory map
|
2007-03-06 05:34:26 -05:00
|
|
|
* - ELF core header
|
2008-10-16 22:17:47 -04:00
|
|
|
* - xen start info if CONFIG_XEN
|
2005-04-16 18:20:36 -04:00
|
|
|
*
|
|
|
|
* More could be added if necessary
|
|
|
|
*/
|
2008-10-16 22:17:47 -04:00
|
|
|
#define IA64_MAX_RSVD_REGIONS 9
|
2005-04-16 18:20:36 -04:00
|
|
|
|
|
|
|
struct rsvd_region {
|
|
|
|
unsigned long start; /* virtual address of beginning of element */
|
|
|
|
unsigned long end; /* virtual address of end of element + 1 */
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
|
|
|
|
extern int num_rsvd_regions;
|
|
|
|
|
|
|
|
extern void find_memory (void);
|
|
|
|
extern void reserve_memory (void);
|
|
|
|
extern void find_initrd (void);
|
|
|
|
extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
|
2008-04-11 18:21:35 -04:00
|
|
|
extern int filter_memory (unsigned long start, unsigned long end, void *arg);
|
2007-10-19 02:41:00 -04:00
|
|
|
extern unsigned long efi_memmap_init(unsigned long *s, unsigned long *e);
|
[IA64] min_low_pfn and max_low_pfn calculation fix
We have seen bad_pte_print when testing crashdump on an SN machine in
recent 2.6.20 kernel. There are tons of bad pte print (pfn < max_low_pfn)
reports when the crash kernel boots up, all those reported bad pages
are inside initmem range; That is because if the crash kernel code and
data happens to be at the beginning of the 1st node. build_node_maps in
discontig.c will bypass reserved regions with filter_rsvd_memory. Since
min_low_pfn is calculated in build_node_map, so in this case, min_low_pfn
will be greater than kernel code and data.
Because pages inside initmem are freed and reused later, we saw
pfn_valid check fail on those pages.
I think this theoretically happen on a normal kernel. When I check
min_low_pfn and max_low_pfn calculation in contig.c and discontig.c.
I found more issues than this.
1. min_low_pfn and max_low_pfn calculation is inconsistent between
contig.c and discontig.c,
min_low_pfn is calculated as the first page number of boot memmap in
contig.c (Why? Though this may work at the most of the time, I don't
think it is the right logic). It is calculated as the lowest physical
memory page number bypass reserved regions in discontig.c.
max_low_pfn is calculated include reserved regions in contig.c. It is
calculated exclude reserved regions in discontig.c.
2. If kernel code and data region is happen to be at the begin or the
end of physical memory, when min_low_pfn and max_low_pfn calculation is
bypassed kernel code and data, pages in initmem will report bad.
3. initrd is also in reserved regions, if it is at the begin or at the
end of physical memory, kernel will refuse to reuse the memory. Because
the virt_addr_valid check in free_initrd_mem.
So it is better to fix and clean up those issues.
Calculate min_low_pfn and max_low_pfn in a consistent way.
Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Acked-by: Jay Lan <jlan@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
2007-03-20 16:41:57 -04:00
|
|
|
extern int find_max_min_low_pfn (unsigned long , unsigned long, void *);
|
2005-04-16 18:20:36 -04:00
|
|
|
|
2007-03-06 05:34:26 -05:00
|
|
|
extern unsigned long vmcore_find_descriptor_size(unsigned long address);
|
|
|
|
extern int reserve_elfcorehdr(unsigned long *start, unsigned long *end);
|
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
/*
|
|
|
|
* For rounding an address to the next IA64_GRANULE_SIZE or order
|
|
|
|
*/
|
|
|
|
#define GRANULEROUNDDOWN(n) ((n) & ~(IA64_GRANULE_SIZE-1))
|
|
|
|
#define GRANULEROUNDUP(n) (((n)+IA64_GRANULE_SIZE-1) & ~(IA64_GRANULE_SIZE-1))
|
|
|
|
|
2005-10-04 15:13:50 -04:00
|
|
|
#ifdef CONFIG_NUMA
|
2005-04-16 18:20:36 -04:00
|
|
|
extern void call_pernode_memory (unsigned long start, unsigned long len, void *func);
|
|
|
|
#else
|
|
|
|
# define call_pernode_memory(start, len, func) (*func)(start, len, 0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define IGNORE_PFN0 1 /* XXX fix me: ignore pfn 0 until TLB miss handler is updated... */
|
|
|
|
|
2008-04-11 18:21:35 -04:00
|
|
|
extern int register_active_ranges(u64 start, u64 len, int nid);
|
2007-01-30 05:11:09 -05:00
|
|
|
|
2005-04-16 18:20:36 -04:00
|
|
|
#ifdef CONFIG_VIRTUAL_MEM_MAP
|
|
|
|
# define LARGE_GAP 0x40000000 /* Use virtual mem map if hole is > than this */
|
|
|
|
extern unsigned long vmalloc_end;
|
|
|
|
extern struct page *vmem_map;
|
|
|
|
extern int find_largest_hole (u64 start, u64 end, void *arg);
|
|
|
|
extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
|
2006-06-28 12:55:43 -04:00
|
|
|
extern int vmemmap_find_next_valid_pfn(int, int);
|
|
|
|
#else
|
|
|
|
static inline int vmemmap_find_next_valid_pfn(int node, int i)
|
|
|
|
{
|
|
|
|
return i + 1;
|
|
|
|
}
|
2005-04-16 18:20:36 -04:00
|
|
|
#endif
|
|
|
|
#endif /* meminit_h */
|