]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
x86 numa: Fix the overflow of physical addresses.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 20 Mar 2008 12:07:32 +0000 (12:07 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 20 Mar 2008 12:07:32 +0000 (12:07 +0000)
If memory address >4G, the address will overflow in some NUMA code if
using unsigned long to statement a physical address in PAE arch.

Replace "unsigned long" with paddr_t to avoid overflow.

Signed-off-by: Duan Ronghui <ronghui.duan@intel.com>
xen-unstable changeset:   17201:f82baf1755ac6b4e1b77a35f160d26d30a094a1c
xen-unstable date:        Mon Mar 17 11:18:06 2008 +0000

xen/arch/x86/numa.c
xen/include/asm-x86/numa.h

index e80a3995a181bc697cc88169432a4cb0550687b5..9f983db06dbaf84805ee6f299615e350f45a1cc8 100644 (file)
@@ -57,7 +57,7 @@ populate_memnodemap(const struct node *nodes, int numnodes, int shift)
 {
        int i; 
        int res = -1;
-       unsigned long addr, end;
+       paddr_t addr, end;
 
        if (shift >= 64)
                return -1;
@@ -286,13 +286,13 @@ static void dump_numa(unsigned char key)
                  (u32)(now>>32), (u32)now);
 
        for_each_online_node(i) {
-               unsigned long pa = (NODE_DATA(i)->node_start_pfn + 1)<< PAGE_SHIFT;
+               paddr_t pa = (NODE_DATA(i)->node_start_pfn + 1)<< PAGE_SHIFT;
                printk("idx%d -> NODE%d start->%lu size->%lu\n",
                          i, NODE_DATA(i)->node_id,
                          NODE_DATA(i)->node_start_pfn,
                          NODE_DATA(i)->node_spanned_pages);
                /* sanity check phys_to_nid() */
-               printk("phys_to_nid(%lx) -> %d should be %d\n", pa, phys_to_nid(pa),
+               printk("phys_to_nid(%"PRIpaddr") -> %d should be %d\n", pa, phys_to_nid(pa),
                          NODE_DATA(i)->node_id);
        }
        for_each_online_cpu(i)
index ee150953bfab36882e8c93157830c238cbf1a547..90233e07b95eb72593a4dd0fcf97334454f61ce0 100644 (file)
@@ -52,7 +52,7 @@ struct node_data {
 
 extern struct node_data node_data[];
 
-static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) 
+static inline __attribute__((pure)) int phys_to_nid(paddr_t addr) 
 { 
        unsigned nid; 
        VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE);