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] [PATCH] linux: Add more consistency checking to balloon code

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux: Add more consistency checking to balloon code
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Mon, 12 Mar 2007 14:32:15 +0000
Delivery-date: Mon, 12 Mar 2007 07:30:33 -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
.. to catch possible problems earlier. This is only a suggested patch,
not one strictly required.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2007-02-27/drivers/xen/balloon/balloon.c
===================================================================
--- head-2007-02-27.orig/drivers/xen/balloon/balloon.c  2007-01-29 
12:22:44.000000000 +0100
+++ head-2007-02-27/drivers/xen/balloon/balloon.c       2007-03-12 
09:27:46.000000000 +0100
@@ -106,6 +106,8 @@ static struct timer_list balloon_timer;
 /* balloon_append: add the given page to the balloon. */
 static void balloon_append(struct page *page)
 {
+       BUG_ON(!PageReserved(page));
+
        /* Lowmem is re-populated first, so highmem pages go at list tail. */
        if (PageHighMem(page)) {
                list_add_tail(PAGE_TO_LIST(page), &ballooned_pages);
@@ -132,6 +134,8 @@ static struct page *balloon_retrieve(voi
        else
                bs.balloon_low--;
 
+       BUG_ON(!PageReserved(page));
+
        return page;
 }
 
@@ -293,6 +297,7 @@ static int decrease_reservation(unsigned
        for (i = 0; i < nr_pages; i++) {
                pfn = mfn_to_pfn(frame_list[i]);
                set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
+               SetPageReserved(pfn_to_page(pfn));
                balloon_append(pfn_to_page(pfn));
        }
 
@@ -483,6 +488,7 @@ static int __init balloon_init(void)
        for (pfn = xen_start_info->nr_pages; pfn < max_pfn; pfn++) {
                page = pfn_to_page(pfn);
                if (!PageReserved(page))
+                       SetPageReserved(page),
                        balloon_append(page);
        }
 #endif
@@ -560,6 +566,8 @@ struct page **alloc_empty_pages_and_page
                } else {
                        ret = apply_to_page_range(&init_mm, vaddr, PAGE_SIZE,
                                                  dealloc_pte_fn, NULL);
+                       if (ret == 0)
+                               SetPageReserved(page);
                }
 
                if (ret != 0) {
@@ -599,6 +607,7 @@ static void free_empty_pages_and_pageve
        balloon_lock(flags);
        for (i = 0; i < nr_pages; i++) {
                BUG_ON(page_count(pagevec[i]) != 1);
+               set_phys_to_machine(page_to_pfn(pagevec[i]), INVALID_P2M_ENTRY);
                balloon_append(pagevec[i]);
        }
        balloon_unlock(flags);
@@ -613,6 +622,7 @@ void balloon_release_driver_page(struct 
        unsigned long flags;
 
        balloon_lock(flags);
+       set_phys_to_machine(page_to_pfn(page), INVALID_P2M_ENTRY);
        balloon_append(page);
        bs.driver_pages--;
        balloon_unlock(flags);



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux: Add more consistency checking to balloon code, Jan Beulich <=