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-ia64-devel

[Xen-ia64-devel] pickled code

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] pickled code
From: Jes Sorensen <jes@xxxxxxx>
Date: Wed, 20 Sep 2006 16:21:56 +0200
Delivery-date: Wed, 20 Sep 2006 07:51:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Resent-date: Wed, 20 Sep 2006 16:51:23 +0200
Resent-from: Jes Sorensen <jes@xxxxxxx>
Resent-message-id: <4511556B.7040201@xxxxxxx>
Resent-to: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Resent-user-agent: Mozilla/5.0 (X11; U; Linux ia64; en-US; rv:1.8.0.4) Gecko/20060527 SUSE/1.5.0.4-3 Thunderbird/1.5.0.4
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.4 (X11/20060527)
Hi,

I found another interesting issue in the code - the way the 'pickle'
functions work just cannot be right. There is no way one should ever
try and truncate the output of __pa() to u32 or expect to be able to
run __va() on a u32 and obtain any level of usable output.

I have to admit I have zero clue what the pickle code is trying to
achieve, but I am at least fairly confident that something needs to
be done in this space :(

Cheers,
Jes

Truncating __va() and __pa() output to u32 is simply not going to work.
Some platforms don't even have any physical memory within the 4GB window.

Signed-off-by: Jes Sorensen <jes@xxxxxxx>


diff -r 3e4fa8b5b245 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Tue Sep 12 11:43:22 2006 -0600
+++ b/xen/arch/ia64/xen/mm.c    Wed Sep 20 15:47:09 2006 +0200
@@ -213,7 +213,7 @@ static void
 static void
 try_to_clear_PGC_allocate(struct domain* d, struct page_info* page)
 {
-    u32 _d, _nd;
+    u64 _d, _nd;
     u64 x, nx, y;
 
     _d = pickle_domptr(d);
@@ -1329,7 +1349,7 @@ steal_page(struct domain *d, struct page
 #if 0 /* if big endian */
 # error "implement big endian version of steal_page()"
 #endif
-    u32 _d, _nd;
+    u64 _d, _nd;
     u64 x, nx, y;
 
     if (page_get_owner(page) != d) {
diff -r 3e4fa8b5b245 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Tue Sep 12 11:43:22 2006 -0600
+++ b/xen/include/asm-ia64/mm.h Wed Sep 20 14:12:43 2006 +0200
@@ -53,7 +53,7 @@ struct page_info
         /* Page is in use: ((count_info & PGC_count_mask) != 0). */
         struct {
             /* Owner of this page (NULL if page is anonymous). */
-            u32 _domain; /* pickled format */
+            u64 _domain; /* pickled format */
             /* Type reference count and various PGT_xxx flags and fields. */
             unsigned long type_info;
         } __attribute__ ((packed)) inuse;
@@ -125,10 +125,10 @@ struct page_info
 #define IS_XEN_HEAP_FRAME(_pfn) ((page_to_maddr(_pfn) < xenheap_phys_end) \
                                 && (page_to_maddr(_pfn) >= xen_pstart))
 
-static inline struct domain *unpickle_domptr(u32 _d)
+static inline struct domain *unpickle_domptr(u64 _d)
 { return (_d == 0) ? NULL : __va(_d); }
 static inline u32 pickle_domptr(struct domain *_d)
-{ return (_d == NULL) ? 0 : (u32)__pa(_d); }
+{ return (_d == NULL) ? 0 : (u64)__pa(_d); }
 
 #define page_get_owner(_p)     (unpickle_domptr((_p)->u.inuse._domain))
 #define page_set_owner(_p, _d) ((_p)->u.inuse._domain = pickle_domptr(_d))
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
<Prev in Thread] Current Thread [Next in Thread>