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] [xen-unstable] [LINUX] Fix backward compatibility with h

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [LINUX] Fix backward compatibility with hypervisors which do not support kexec.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Nov 2006 21:30:56 +0000
Delivery-date: Thu, 30 Nov 2006 13:33:06 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Node ID d7f71de58c4b484820c49f45ed40fd577c3368d6
# Parent  cefb1f761f0b9894459d571618846141ec6f36e2
[LINUX] Fix backward compatibility with hypervisors which do not support kexec.

Also do not rely on side effects in BUG_ON(x) -- use if(x) BUG() instead.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c |   21 +++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff -r cefb1f761f0b -r d7f71de58c4b 
linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c     Thu Nov 30 
18:08:34 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c     Thu Nov 30 
18:21:50 2006 +0000
@@ -20,7 +20,7 @@ void xen_machine_kexec_setup_resources(v
 {
        xen_kexec_range_t range;
        struct resource *res;
-       int k = 0;
+       int err, k = 0;
 
        if (!is_initial_xendomain())
                return;
@@ -32,8 +32,16 @@ void xen_machine_kexec_setup_resources(v
                range.range = KEXEC_RANGE_MA_CPU;
                range.nr = k;
 
-               if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
+               /*
+                * Anything other than EINVAL or success indictates
+                * that we are not running on a hypervisor which
+                * supports kexec.
+                */
+               err = HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range);
+               if (err == -EINVAL)
                        break;
+               else if (err)
+                       return;
 
                k++;
        }
@@ -52,7 +60,8 @@ void xen_machine_kexec_setup_resources(v
                range.range = KEXEC_RANGE_MA_CPU;
                range.nr = k;
 
-               BUG_ON(HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range));
+               if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
+                       BUG();
 
                res = xen_phys_cpus + k;
 
@@ -68,7 +77,8 @@ void xen_machine_kexec_setup_resources(v
        memset(&range, 0, sizeof(range));
        range.range = KEXEC_RANGE_MA_XEN;
 
-       BUG_ON(HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range));
+       if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
+               BUG();
 
        xen_hypervisor_res.name = "Hypervisor code and data";
        xen_hypervisor_res.start = range.start;
@@ -80,7 +90,8 @@ void xen_machine_kexec_setup_resources(v
        memset(&range, 0, sizeof(range));
        range.range = KEXEC_RANGE_MA_CRASH;
 
-       BUG_ON(HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range));
+       if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
+               BUG();
 
        if (range.size) {
                crashk_res.start = range.start;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [LINUX] Fix backward compatibility with hypervisors which do not support kexec., Xen patchbot-unstable <=