bitkeeper revision 1.825.3.22 (406bed54_kfGyHK4C9Lf4xDiVaaG6A)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 1 Apr 2004 10:22:12 +0000 (10:22 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 1 Apr 2004 10:22:12 +0000 (10:22 +0000)
sched_atropos.c, page_alloc.c, event_channel.c, irq.c:
  Fix task_struct refcnt bug. Fix compile warnings in debug builds.

xen/arch/i386/irq.c
xen/common/event_channel.c
xen/common/page_alloc.c
xen/common/sched_atropos.c

index 30735e0324933200c7dd3eeaea15f98185f5b0d8..f09590b7a290f8787c9ea7ec5792f1d7d32b463e 100644 (file)
@@ -1033,7 +1033,8 @@ int pirq_guest_bind(struct task_struct *p, int irq, int will_share)
     }
     else if ( !will_share || !action->shareable )
     {
-        DPRINTK("Cannot bind IRQ %d to guest. Will not share with others.\n");
+        DPRINTK("Cannot bind IRQ %d to guest. Will not share with others.\n",
+                irq);
         rc = -EBUSY;
         goto out;
     }
index 216a794f5bff2585c19d8a38d882c530e32efd80..c0bea86320ae0083d3f77bc11db6a8c36c1a909f 100644 (file)
@@ -370,6 +370,7 @@ static long evtchn_status(evtchn_status_t *status)
     domid_t             dom = status->dom;
     int                 port = status->port;
     event_channel_t    *chn;
+    long                rc = 0;
 
     if ( dom == DOMID_SELF )
         dom = current->domain;
@@ -385,8 +386,8 @@ static long evtchn_status(evtchn_status_t *status)
 
     if ( (port < 0) || (port >= p->max_event_channel) )
     {
-        spin_unlock(&p->event_channel_lock);
-        return -EINVAL;
+        rc = -EINVAL;
+        goto out;
     }
 
     switch ( chn[port].state )
@@ -414,8 +415,10 @@ static long evtchn_status(evtchn_status_t *status)
         BUG();
     }
 
+ out:
     spin_unlock(&p->event_channel_lock);
-    return 0;
+    put_task_struct(p);
+    return rc;
 }
 
 
index ba9c29dd449143b5cd5450fb3b0cb804235d4aa5..adef28ea328742c706b1d7579c25e8121597c759 100644 (file)
@@ -280,12 +280,12 @@ retry:
     spin_lock_irqsave(&alloc_lock, flags);
 
     /* Find smallest order which can satisfy the request. */
-    for ( i = order; i < FREELIST_SIZE; i++ ) {
+    for ( i = order; i < FREELIST_SIZE; i++ )
        if ( !FREELIST_EMPTY(i) ) 
            break;
-    }
 
-    if ( i == FREELIST_SIZE ) goto no_memory;
+    if ( i == FREELIST_SIZE ) 
+        goto no_memory;
  
     /* Unlink a chunk. */
     alloc_ch = free_head[i];
@@ -327,9 +327,10 @@ retry:
     return((unsigned long)alloc_ch);
 
  no_memory:
+    spin_unlock_irqrestore(&alloc_lock, flags);
+        
     if ( attempts++ < 8 )
     {
-        spin_unlock_irqrestore(&alloc_lock, flags);
         kmem_cache_reap(0);
         goto retry;
     }
index 1a5fd792aaecba56d8bb2cd0c6318ae4a2f89bd7..0a40d9c8eacb369eccae972f965d91c11e41f445 100644 (file)
@@ -14,6 +14,9 @@
  * these modifications are (C) 2004 Intel Research Cambridge
  */
 
+#include <xen/config.h>
+#include <xen/init.h>
+#include <xen/lib.h>
 #include <xen/time.h>
 #include <xen/sched.h>
 #include <xen/sched-if.h>
@@ -31,9 +34,9 @@
 struct at_dom_info
 {
     /* MAW Xen additions */
-    struct task_struct *owner; /* the struct task_struct this data belongs to */
-    struct list_head waitq;    /* wait queue                                  */
-    int reason;                /* reason domain was last scheduled            */
+    struct task_struct *owner; /* the task_struct this data belongs to */
+    struct list_head waitq;    /* wait queue                           */
+    int reason;                /* reason domain was last scheduled     */
 
     /* (what remains of) the original fields */
 
@@ -112,8 +115,9 @@ static void requeue(struct task_struct *sdom)
         prev = WAITQ(sdom->processor);
         list_for_each(next, WAITQ(sdom->processor))
         {
-            struct at_dom_info *i = list_entry(next, struct at_dom_info, waitq);
-            if( i->deadline > inf->deadline )
+            struct at_dom_info *i = 
+                list_entry(next, struct at_dom_info, waitq);
+            if ( i->deadline > inf->deadline )
             {
                 __list_add(&inf->waitq, prev, next);
                 break;
@@ -124,10 +128,10 @@ static void requeue(struct task_struct *sdom)
 
         /* put the domain on the end of the list if it hasn't been put
          * elsewhere */
-        if ( next == WAITQ(sdom->processor))
+        if ( next == WAITQ(sdom->processor) )
             list_add_tail(&inf->waitq, WAITQ(sdom->processor));
     }
-    else if(sdom->state == TASK_RUNNING)
+    else if ( sdom->state == TASK_RUNNING )
     {
         /* insert into ordered run queue */
         prev = RUNQ(sdom->processor);
@@ -471,7 +475,7 @@ task_slice_t ksched_scheduler(s_time_t time)
     cur_sdom->min_slice = newtime - time;
     DOM_INFO(cur_sdom)->reason = reason;
 
-    TRACE_2D(0, cur_sdom->domain >> 32, (u32)cur_sdom->domain);
+    TRACE_2D(0, (cur_sdom->domain >> 32), ((u32)cur_sdom->domain));
  
     return ret;
 }