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] There is an allocation-failure path in sc

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] There is an allocation-failure path in sched_credit.c that BUGs. The
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 02 Aug 2006 10:40:14 +0000
Delivery-date: Wed, 02 Aug 2006 03:42:49 -0700
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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 556022fb8eb6d62846bc106356fb23d3e5201ad1
# Parent  bbc27b921e2af0948bd9af3742be149c746eed0f
There is an allocation-failure path in sched_credit.c that BUGs.  The
attached patch handles this potential failure case more gracefully.

Signed-off-by:  Charles Coffing <ccoffing@xxxxxxxxxx>
---
 xen/common/sched_credit.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff -r bbc27b921e2a -r 556022fb8eb6 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Wed Aug 02 09:16:26 2006 +0100
+++ b/xen/common/sched_credit.c Wed Aug 02 09:20:09 2006 +0100
@@ -296,11 +296,16 @@ __runq_tickle(unsigned int cpu, struct c
         cpumask_raise_softirq(mask, SCHEDULE_SOFTIRQ);
 }
 
-static void
+static int
 csched_pcpu_init(int cpu)
 {
     struct csched_pcpu *spc;
     unsigned long flags;
+
+    /* Allocate per-PCPU info */
+    spc = xmalloc(struct csched_pcpu);
+    if ( spc == NULL )
+        return -1;
 
     spin_lock_irqsave(&csched_priv.lock, flags);
 
@@ -311,9 +316,6 @@ csched_pcpu_init(int cpu)
     if ( csched_priv.master >= csched_priv.ncpus )
         csched_priv.master = cpu;
 
-    /* Allocate per-PCPU info */
-    spc = xmalloc(struct csched_pcpu);
-    BUG_ON( spc == NULL );
     INIT_LIST_HEAD(&spc->runq);
     spc->runq_sort_last = csched_priv.runq_sort;
     schedule_data[cpu].sched_priv = spc;
@@ -323,6 +325,8 @@ csched_pcpu_init(int cpu)
     cpu_set(cpu, csched_priv.idlers);
 
     spin_unlock_irqrestore(&csched_priv.lock, flags);
+
+    return 0;
 }
 
 #ifndef NDEBUG
@@ -490,7 +494,10 @@ csched_vcpu_init(struct vcpu *vc)
 
     /* Allocate per-PCPU info */
     if ( unlikely(!CSCHED_PCPU(vc->processor)) )
-        csched_pcpu_init(vc->processor);
+    {
+        if ( csched_pcpu_init(vc->processor) != 0 )
+            return -1;
+    }
 
     CSCHED_VCPU_CHECK(vc);
 

_______________________________________________
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] There is an allocation-failure path in sched_credit.c that BUGs. The, Xen patchbot-unstable <=