Skip to contentSkip to conversation

small accounting and lockup fix for xenfreebsd on -unstable

PATCH New Kip Macy 1 participant 1 message Mar 24, 2005

lore
Share & tools
lore

Kip Macy

author
#0 lore raw

PATCH 1/1 small accounting and lockup fix for xenfreebsd on -unstable

# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet

#   2005/03/23 18:27:49-08:00 [email protected] 
#   only bump tmpindex by NKPT-1 once
#   release sched lock on upcall
#   Signed-off-by: Kip Macy <[email protected]>
# 
# freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
#   2005/03/23 18:24:47-08:00 [email protected] +0 -4
#   remove extra bump of tmpindex
# 
# freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c
#   2005/03/23 18:24:47-08:00 [email protected] +7 -3
#   release sched lock on upcall
# 
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c 2005-03-24
13:19:58 -08:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/evtchn.c 2005-03-24
13:19:58 -08:00
@@ -54,16 +54,16 @@
 {
     unsigned long  l1, l2;
     unsigned int   l1i, l2i, port;
-    int            irq;
+    int            irq, owned;
     unsigned long  flags;
     shared_info_t *s = HYPERVISOR_shared_info;
     vcpu_info_t   *vcpu_info = &s->vcpu_data[smp_processor_id()];
     local_irq_save(flags);

- while ( s->vcpu_data[0].evtchn_upcall_pending )
+ while ( vcpu_info->evtchn_upcall_pending )

     {
-        s->vcpu_data[0].evtchn_upcall_pending = 0;
+        vcpu_info->evtchn_upcall_pending = 0;
         /* NB. No need for a barrier here -- XCHG is a barrier on x86. */
         l1 = xen_xchg(&vcpu_info->evtchn_pending_sel, 0);
         while ( (l1i = ffs(l1)) != 0 )
@@ -78,12 +78,16 @@
                 l2 &= ~(1 << l2i);
             
                 port = (l1i << 5) + l2i;
+               if ((owned = mtx_recursed(&sched_lock)) != 0)
+                   mtx_unlock_spin_flags(&sched_lock, MTX_QUIET);
                 if ( (irq = evtchn_to_irq[port]) != -1 ) {
                    struct intsrc *isrc = intr_lookup_source(irq);
                    intr_execute_handlers(isrc, frame);
                } else {
                     evtchn_device_upcall(port);
                }
+               if (owned)
+                   mtx_lock_spin_flags(&sched_lock, MTX_QUIET);
             }
         }
     }
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c       
2005-03-24 13:19:58 -08:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c       
2005-03-24 13:19:58 -08:00
@@ -1454,10 +1454,6 @@
     for (i = 0; i < NKPT-1; i++, tmpindex++)
        xpq_queue_pt_update(IdlePTD + KPTDI + i + 1,
xpmap_ptom((tmpindex << PAGE_SHIFT))| PG_M | PG_RW | PG_V | PG_A);
     tmpindex += NKPT-1;

-
-
-
- tmpindex += NKPT-1;
PT_UPDATES_FLUSH();

HYPERVISOR_shared_info = (shared_info_t *)(KERNBASE + (tmpindex
<< PAGE_SHIFT));

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click