NISHIGUCHI Naoki
2008-Apr-24 04:34 UTC
[Xen-devel] [PATCH] Fix deadlock in schedule.c at TRACE mode
Hi, In schedule.c, schedule() and sched_adjust() call trace functions during acquiring lock of schedule_lock in each cpu''s schedule_data. When trace buffers are enabled, the trace function (__trace_var()) may call vcpu_wake() by calling send_guest_global_virq(). In the case, a deadlock occurs when acquiring lock of schedule_lock. Attached patch fixes this problem. Signed-off-by: Naoki Nishiguchi <nisiguti@jp.fujitsu.com> Regards, Naoki Nishiguchi _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Atsushi SAKAI
2008-Apr-24 05:42 UTC
Re: [Xen-devel] [PATCH] Fix deadlock in schedule.c at TRACE mode
Hi, Naoki I have two questions about this. 1)How to reproduce your deadlock ? Would you give me your test environment to reproduce this deadlock? Is it easily reproduced by running xenmon.py or xentrace with one or two guest domain(s)? or Any additional condition needed? 2)About fixing code, I think __trace_var() should fix for this issue not schedule() This issue cannot be fixed by modify the __trace_var()? Thanks Atsushi SAKAI NISHIGUCHI Naoki <nisiguti@jp.fujitsu.com> wrote:> Hi, > > In schedule.c, schedule() and sched_adjust() call trace functions during > acquiring lock of schedule_lock in each cpu''s schedule_data. When trace > buffers are enabled, the trace function (__trace_var()) may call > vcpu_wake() by calling send_guest_global_virq(). In the case, a deadlock > occurs when acquiring lock of schedule_lock. > > Attached patch fixes this problem. > > Signed-off-by: Naoki Nishiguchi <nisiguti@jp.fujitsu.com> > > Regards, > Naoki Nishiguchi_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
NISHIGUCHI Naoki
2008-Apr-24 07:03 UTC
Re: [Xen-devel] [PATCH] Fix deadlock in schedule.c at TRACE mode
Hi, Atsushi Atsushi SAKAI wrote:> I have two questions about this. > > 1)How to reproduce your deadlock ? > Would you give me your test environment to reproduce this deadlock? > Is it easily reproduced by running xenmon.py or xentrace > with one or two guest domain(s)? > or Any additional condition needed?This deadlock can be easily reproduced by running xenmon.py without guest domain. Furthermore, this deadlock occurs easier by applying my patch to xenbaked.c. Subject of my patch is "[PATCH] Fix access to trace buffer after xentrace changes".> 2)About fixing code, > I think __trace_var() should fix for this issue not schedule() > This issue cannot be fixed by modify the __trace_var()?Thanks for your advise. I agree with you. I fixed this deadlock using tasklet in trace.c. Here is the patch. Thanks, Naoki Nishiguchi _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2008-Apr-24 07:29 UTC
Re: [Xen-devel] [PATCH] Fix deadlock in schedule.c at TRACE mode
On 24/4/08 08:03, "NISHIGUCHI Naoki" <nisiguti@jp.fujitsu.com> wrote:>> 2)About fixing code, >> I think __trace_var() should fix for this issue not schedule() >> This issue cannot be fixed by modify the __trace_var()? > > Thanks for your advise. > I agree with you. > I fixed this deadlock using tasklet in trace.c. > > Here is the patch.Thanks. This was my bad as I removed the old softirq and couldn''t see a reason not to call wake() directly. I''ll add a comment when I apply your patch. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel