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

Re: [Xen-ia64-devel] Re: Fedora-xen-ia64 test status

To: Aron Griffis <aron@xxxxxx>
Subject: Re: [Xen-ia64-devel] Re: Fedora-xen-ia64 test status
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Fri, 4 Aug 2006 11:30:35 +0900
Cc: fedora-xen@xxxxxxxxxx, Juan Quintela <quintela@xxxxxxxxxx>, Chris Wright <chrisw@xxxxxxxxxxxx>, 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 19:30:47 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20060803212241.GA12696@xxxxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <79C6B734D72AA4takebe_akio@xxxxxxxxxxxxxx> <20060803212241.GA12696@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
Hi Aron. Thank you for cleaning up.
However a bug was there. Here is the updated one.

- removed debug print.
- bug fix. Extents at the end can be discarded.
- coding style clean up

changeset:   34929:7ca328ac2929e1dfc19b298d7656e653a05d709b
tag:         tip
user:        yamahata@xxxxxxxxxxxxx
date:        Fri Aug 04 11:17:17 2006 +0900
files:       arch/ia64/kernel/setup.c
description:
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 e677133a59a9c5313e6985e5ba63ff50aecec42c -r 
7ca328ac2929e1dfc19b298d7656e653a05d709b arch/ia64/kernel/setup.c
--- a/arch/ia64/kernel/setup.c  Thu Aug 03 00:43:34 2006 +0200
+++ b/arch/ia64/kernel/setup.c  Fri Aug 04 11:17:17 2006 +0900
@@ -194,15 +194,33 @@ 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];
@@ -210,6 +228,31 @@ sort_regions (struct rsvd_region *rsvd_r
                        }
                }
        }
+
+       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;
+               num -= collapsed;
+               for (k = j + 1; k < num; k++)
+                       rsvd_region[k] = rsvd_region[k + collapsed];
+       }
+
+       num_rsvd_regions = num;
 }
 
 /*





-- 
yamahata

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