[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] trace: Notify dom0 from tasklet context.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1209027509 -3600
# Node ID f73b9a286ee4e0abe27036c55f3a81e35c6ea300
# Parent  77dec8732cde02bab4db07acf191eb3042224692
trace: Notify dom0 from tasklet context.

Avoids deadlocks by avoiding calling into scheduler recursively
(__trace_var() is sometimes called with scheduler locks held).

Signed-off-by: Naoki Nishiguchi <nisiguti@xxxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/trace.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletion(-)

diff -r 77dec8732cde -r f73b9a286ee4 xen/common/trace.c
--- a/xen/common/trace.c        Wed Apr 23 16:58:44 2008 +0100
+++ b/xen/common/trace.c        Thu Apr 24 09:58:29 2008 +0100
@@ -374,6 +374,15 @@ static inline int insert_lost_records(st
                            (unsigned char *)&ed);
 }
 
+/*
+ * Notification is performed in qtasklet to avoid deadlocks with contexts
+ * which __trace_var() may be called from (e.g., scheduler critical regions).
+ */
+static void trace_notify_dom0(unsigned long unused)
+{
+    send_guest_global_virq(dom0, VIRQ_TBUF);
+}
+static DECLARE_TASKLET(trace_notify_dom0_tasklet, trace_notify_dom0, 0);
 
 /**
  * trace - Enters a trace tuple into the trace buffer for the current CPU.
@@ -506,7 +515,7 @@ void __trace_var(u32 event, int cycles, 
     /* Notify trace buffer consumer that we've crossed the high water mark. */
     if ( started_below_highwater &&
          (calc_unconsumed_bytes(buf) >= t_buf_highwater) )
-        send_guest_global_virq(dom0, VIRQ_TBUF);
+        tasklet_schedule(&trace_notify_dom0_tasklet);
 }
 
 /*

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.