WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] fix the overflow of pysical address

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] fix the overflow of pysical address
From: "Duan, Ronghui" <ronghui.duan@xxxxxxxxx>
Date: Mon, 10 Mar 2008 10:57:18 +0800
Delivery-date: Sun, 09 Mar 2008 20:00:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AciCWnP7qv+G42BARb6e7nIrDGEhDg==
Thread-topic: fix the overflow of pysical address

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@xxxxxxxxx>

 

diff -r 2909b03e05de xen/arch/x86/numa.c

--- a/xen/arch/x86/numa.c     Tue Mar 04 13:30:07 2008 +0000

+++ b/xen/arch/x86/numa.c     Mon Mar 10 19:12:36 2008 +0800

@@ -57,7 +57,7 @@ populate_memnodemap(const struct node *n

 {

      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)

diff -r 2909b03e05de xen/include/asm-x86/numa.h

--- a/xen/include/asm-x86/numa.h    Tue Mar 04 13:30:07 2008 +0000

+++ b/xen/include/asm-x86/numa.h    Mon Mar 10 19:12:36 2008 +0800

@@ -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);

 

 

Attachment: pa.patch
Description: pa.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] fix the overflow of pysical address, Duan, Ronghui <=