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] Re: Fedora-xen-ia64 test status

To: Juan Quintela <quintela@xxxxxxxxxx>
Subject: [Xen-ia64-devel] Re: Fedora-xen-ia64 test status
From: Aron Griffis <aron@xxxxxx>
Date: Thu, 3 Aug 2006 17:22:41 -0400
Cc: fedora-xen@xxxxxxxxxx, Chris Wright <chrisw@xxxxxxxxxxxx>, Isaku Yamahata <yamahata@xxxxxxxxxxxxx>, jean-paul.pigache@xxxxxxxx, Dave Jones <davej@xxxxxxxxxx>, ia64 Fedora Core Development <fedora-ia64-list@xxxxxxxxxx>, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 03 Aug 2006 14:22:57 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <79C6B734D72AA4takebe_akio@xxxxxxxxxxxxxx>
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>
Mail-followup-to: Juan Quintela <quintela@xxxxxxxxxx>, Akio Takebe <takebe_akio@xxxxxxxxxxxxxx>, ia64 Fedora Core Development <fedora-ia64-list@xxxxxxxxxx>, fedora-xen@xxxxxxxxxx, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx, Chris Wright <chrisw@xxxxxxxxxxxx>, Dave Jones <davej@xxxxxxxxxx>, jean-paul.pigache@xxxxxxxx, Kouya SHIMURA <kouya@xxxxxxxxxxxxxx>, Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
References: <79C6B734D72AA4takebe_akio@xxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Hi Juan, 

Here is the patch cleaned up to apply to your current tree.
I omitted the #ifdef notyet parts because they're already fixed by the
patch I sent yesterday.
https://www.redhat.com/archives/fedora-xen/2006-August/msg00019.html

Regards,
Aron

# HG changeset patch
# User agriffis@xxxxxxxxxxxxxxx
# Node ID 8040a45ec900fda375346157f4028da57bb62e20
# Parent  33a2d3fb09120f3c9342ddeba2c20200571de75b
Compare both start and end when sorting rsvd_region list, then collapse
overlapping regions.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Signed-off-by: Aron Griffis <aron@xxxxxx>

diff -r 33a2d3fb0912 -r 8040a45ec900 arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c  Wed Aug 02 22:25:15 2006 -0400
+++ b/arch/ia64/kernel/setup.c  Thu Aug 03 17:17:14 2006 -0400
@@ -196,21 +196,75 @@ filter_rsvd_memory (unsigned long start,
        return 0;
 }
 
+static int __init
+rsvd_region_cmp(struct rsvd_region *lhs, struct rsvd_region *rhs)
+{
+       if (lhs->start > rhs->start)
+               return 1;
+       if (lhs->start < rhs->start)
+               return -1;
+
+       if (lhs->end > rhs->end)
+               return 1;
+       if (lhs->end < rhs->end)
+               return -1;
+
+       return 0;
+}
+
 static void __init
 sort_regions (struct rsvd_region *rsvd_region, int max)
 {
+       int num = max;
        int j;
 
        /* simple bubble sorting */
        while (max--) {
                for (j = 0; j < max; ++j) {
-                       if (rsvd_region[j].start > rsvd_region[j+1].start) {
+                       if (rsvd_region_cmp(&rsvd_region[j],
+                                           &rsvd_region[j + 1]) > 0) {
                                struct rsvd_region tmp;
                                tmp = rsvd_region[j];
                                rsvd_region[j] = rsvd_region[j + 1];
                                rsvd_region[j + 1] = tmp;
                        }
                }
+       }
+
+       for (j = 0; j < num; j++) {
+               printk("rsvd_region[%d]: [0x%016lx, 0x%06lx)\n",
+                      j, rsvd_region[j].start, rsvd_region[j].end);
+       }
+
+       for (j = 0; j < num - 1; j++) {
+               int k;
+               unsigned long start = rsvd_region[j].start;
+               unsigned long end = rsvd_region[j].end;
+               int collapsed;
+               
+               for (k = j + 1; k < num; k++) {
+                       BUG_ON(start > rsvd_region[k].start);
+                       if (end < rsvd_region[k].start) {
+                               k--;
+                               break;
+                       }
+                       end = max(end, rsvd_region[k].end);
+               }
+               if (k == num) {
+                       k--;
+               }
+               rsvd_region[j].end = end;
+               collapsed = k - j;
+               for (k = j + 1; k < j + 1 + collapsed; k++) {
+                       rsvd_region[k] = rsvd_region[k + collapsed];
+               }
+               num -= collapsed;
+       }
+
+       num_rsvd_regions = num;
+       for (j = 0; j < num; j++) {
+               printk("rsvd_region[%d]: [0x%016lx, 0x%06lx)\n",
+                      j, rsvd_region[j].start, rsvd_region[j].end);
        }
 }
 

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel