Skip to contentSkip to conversation

alloc_{start,end} truncation

PATCH In review Scott Parish 2 participants 3 messages Aug 5, 2005 – Aug 8, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alloc_{start,end} truncation

Alloc_{start,end} should be physaddr_t. See attached patch.

sRp

Signature · 2 lines
Scott Parish
Signed-off-by: [email protected]
xen/arch/x86/domain_build.c +4 -4
diff -rN -u -p old-xen-pae/xen/arch/x86/domain_build.c new-xen-pae/xen/arch/x86/domain_build.c
@@ -78,8 +78,8 @@ int construct_dom0(struct domain *d,
     unsigned long pfn, mfn;
     unsigned long nr_pages;
     unsigned long nr_pt_pages;
-    unsigned long alloc_start;
-    unsigned long alloc_end;
+    physaddr_t alloc_start;
+    physaddr_t alloc_end;
     unsigned long count;
     struct pfn_info *page = NULL;
     start_info_t *si;
@@ -219,8 +219,8 @@ int construct_dom0(struct domain *d,
         panic("Insufficient contiguous RAM to build kernel image.\n");
 
     printk("PHYSICAL MEMORY ARRANGEMENT:\n"
-           " Dom0 alloc.:   %p->%p",
-           _p(alloc_start), _p(alloc_end));
+           " Dom0 alloc.:   %llx->%llx",
+           (u64)alloc_start, (u64)alloc_end);
     if ( d->tot_pages < nr_pages )
         printk(" (%lu pages to be allocated)",
                nr_pages - d->tot_pages);
xen/include/asm-x86/io.h +1 -1
diff -rN -u -p old-xen-pae/xen/include/asm-x86/io.h new-xen-pae/xen/include/asm-x86/io.h
@@ -45,7 +45,7 @@ static inline void * phys_to_virt(unsign
 /*
  * Change "struct pfn_info" to physical address.
  */
-#ifdef CONFIG_HIGHMEM64G
+#ifdef CONFIG_TARGET_X86_PAE
 #define page_to_phys(page)  ((u64)(page - frame_table) << PAGE_SHIFT)
 #else
 #define page_to_phys(page)  ((page - frame_table) << PAGE_SHIFT)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 1 line · Scott Parish

Alloc_{start,end} should be physaddr_t. See attached patch.

Ha, *that* the bug I was hunting as well ;)

Quoted 1 line

+++ new-xen-pae/xen/arch/x86/domain_build.c 2005-08-05 17:48:07.000000000 +0000

This change looks perfectly fine.

xen/include/asm-x86/io.h static inline void * phys_to_virt(unsign · line 48

Quoted 8 lines
xen/include/asm-x86/io.h +1 -1
@@ -45,7 +45,7 @@ static inline void * phys_to_virt(unsign
 /*
  * Change "struct pfn_info" to physical address.
  */
-#ifdef CONFIG_HIGHMEM64G
+#ifdef CONFIG_TARGET_X86_PAE

That one should be "CONFIG_X86_PAE"

xen/include/asm-x86/io.h static inline void * phys_to_virt(unsign · line 49

Quoted 1 line
xen/include/asm-x86/io.h +0 -0
 #define page_to_phys(page)  ((u64)(page - frame_table) << PAGE_SHIFT)

But I think even better is to simply drop the ifdef and turn that into

"#define page_to_phys(page) ((physaddr_t)(page - frame_table) << PAGE_SHIFT)"

With these changes in place the dom0 builder survives on my 6GB test box, now the linux kernel seems to crash early at boot, continuing debugging ...

Gerd

Signature · 1 line
panic("it works"); /* avoid being flooded with debug messages */
#2 lore raw
Quoted 5 lines · Gerd Knorr

"Scott Parish" <[email protected]> writes:

But I think even better is to simply drop the ifdef and turn that into

"#define page_to_phys(page) ((physaddr_t)(page - frame_table) << PAGE_SHIFT)"

Excellent idea

sRp

Signature · 2 lines
Scott Parish
Signed-off-by: [email protected]
xen/arch/x86/domain_build.c +4 -4
diff -rN -u -p old-xen-pae/xen/arch/x86/domain_build.c new-xen-pae/xen/arch/x86/domain_build.c
@@ -78,8 +78,8 @@ int construct_dom0(struct domain *d,
     unsigned long pfn, mfn;
     unsigned long nr_pages;
     unsigned long nr_pt_pages;
-    unsigned long alloc_start;
-    unsigned long alloc_end;
+    physaddr_t alloc_start;
+    physaddr_t alloc_end;
     unsigned long count;
     struct pfn_info *page = NULL;
     start_info_t *si;
@@ -219,8 +219,8 @@ int construct_dom0(struct domain *d,
         panic("Insufficient contiguous RAM to build kernel image.\n");
 
     printk("PHYSICAL MEMORY ARRANGEMENT:\n"
-           " Dom0 alloc.:   %p->%p",
-           _p(alloc_start), _p(alloc_end));
+           " Dom0 alloc.:   %llx->%llx",
+           (u64)alloc_start, (u64)alloc_end);
     if ( d->tot_pages < nr_pages )
         printk(" (%lu pages to be allocated)",
                nr_pages - d->tot_pages);
xen/include/asm-x86/io.h +1 -6
diff -rN -u -p old-xen-pae/xen/include/asm-x86/io.h new-xen-pae/xen/include/asm-x86/io.h
@@ -45,12 +45,7 @@ static inline void * phys_to_virt(unsign
 /*
  * Change "struct pfn_info" to physical address.
  */
-#ifdef CONFIG_HIGHMEM64G
-#define page_to_phys(page)  ((u64)(page - frame_table) << PAGE_SHIFT)
-#else
-#define page_to_phys(page)  ((page - frame_table) << PAGE_SHIFT)
-#endif
-
+#define page_to_phys(page)  ((physaddr_t)(page - frame_table) << PAGE_SHIFT)
 #define page_to_pfn(_page)  ((unsigned long)((_page) - frame_table))
 #define page_to_virt(_page) phys_to_virt(page_to_phys(_page))
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel