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-changelog

[Xen-changelog] [linux-2.6.18-xen] xen/balloon: Fix return value interpr

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] xen/balloon: Fix return value interpretation for XENMEM_get_pod_target
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Mar 2010 10:35:14 -0700
Delivery-date: Tue, 30 Mar 2010 10:35:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1269970114 -3600
# Node ID 11175e60d39349f7daf5672481f25b9546f0918e
# Parent  10eae161c15390fdf31cd210b36540d608c46801
xen/balloon: Fix return value interpretation for XENMEM_get_pod_target

Unfortunately c/s 989 didn't consider what I would call a quirk in
pre-3.4 Xen, resulting in XENMEM_get_pod_target calls to not return
-ENOSYS as one would normally expect.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 drivers/xen/balloon/balloon.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff -r 10eae161c153 -r 11175e60d393 drivers/xen/balloon/balloon.c
--- a/drivers/xen/balloon/balloon.c     Thu Mar 25 10:00:03 2010 +0000
+++ b/drivers/xen/balloon/balloon.c     Tue Mar 30 18:28:34 2010 +0100
@@ -522,6 +522,7 @@ static int __init balloon_init(void)
        } xen_pod_target_t;
 # endif
        xen_pod_target_t pod_target = { .domid = DOMID_SELF };
+       int rc;
 #elif defined(CONFIG_X86)
        unsigned long pfn;
        struct page *page;
@@ -536,11 +537,17 @@ static int __init balloon_init(void)
        bs.current_pages = min(xen_start_info->nr_pages, max_pfn);
        totalram_pages   = bs.current_pages;
 #else 
-       totalram_bias = HYPERVISOR_memory_op(
-               HYPERVISOR_memory_op(XENMEM_get_pod_target,
-                       &pod_target) != -ENOSYS
-               ? XENMEM_maximum_reservation
-               : XENMEM_current_reservation,
+       rc = HYPERVISOR_memory_op(XENMEM_get_pod_target, &pod_target);
+       /*
+        * Xen prior to 3.4.0 masks the memory_op command to 4 bits, thus
+        * converting XENMEM_get_pod_target to XENMEM_decrease_reservation.
+        * Fortunately this results in a request with all input fields zero,
+        * but (due to the way bit 4 and upwards get interpreted) a starting
+        * extent of 1. When start_extent > nr_extents (>= in newer Xen), we
+        * simply get start_extent returned.
+        */
+       totalram_bias = HYPERVISOR_memory_op(rc != -ENOSYS && rc != 1
+               ? XENMEM_maximum_reservation : XENMEM_current_reservation,
                &pod_target.domid);
        if ((long)totalram_bias != -ENOSYS) {
                BUG_ON(totalram_bias < totalram_pages);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] xen/balloon: Fix return value interpretation for XENMEM_get_pod_target, Xen patchbot-linux-2.6.18-xen <=