From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH] linux/x86: eliminate nesting of run-queue locks inside xtime_lock Date: Tue, 10 Aug 2010 15:10:26 +0100 Message-ID: <4C6179F2020000780000F10F@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartDAF7FAC2.2__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" Cc: salvet@ics.muni.cz, Ian Campbell List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartDAF7FAC2.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline From: Zdenek Salvet According to Debian bug 591362 this has been causing problems. While no proof was given that the inverse lock order does actually occur anywhere (with interrupts enabled), it is plain unnecessary to take the risk. Signed-off-by: Jan Beulich Cc: Ian Campbell --- a/arch/i386/kernel/time-xen.c +++ b/arch/i386/kernel/time-xen.c @@ -666,6 +666,7 @@ irqreturn_t timer_interrupt(int irq, voi s64 delta, delta_cpu, stolen, blocked; u64 sched_time; unsigned int i, cpu =3D smp_processor_id(); + int schedule_clock_was_set_work =3D 0; struct shadow_time_info *shadow =3D &per_cpu(shadow_time, cpu); struct vcpu_runstate_info *runstate =3D &per_cpu(runstate, cpu); =20 @@ -720,12 +721,14 @@ irqreturn_t timer_interrupt(int irq, voi =20 if (shadow_tv_version !=3D HYPERVISOR_shared_info->wc_version) { update_wallclock(); - if (keventd_up()) - schedule_work(&clock_was_set_work); + schedule_clock_was_set_work =3D 1; } =20 write_sequnlock(&xtime_lock); =20 + if (schedule_clock_was_set_work && keventd_up()) + schedule_work(&clock_was_set_work); + /* * Account stolen ticks. * HACK: Passing NULL to account_steal_time() --=__PartDAF7FAC2.2__= Content-Type: text/plain; name="xenlinux-x86-clock-was-set-work.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xenlinux-x86-clock-was-set-work.patch" From: Zdenek Salvet =0ASubject: eliminate nesting of = run-queue locks inside xtime_lock=0A=0AAccording to Debian bug 591362 this = has been causing problems. While=0Ano proof was given that the inverse = lock order does actually occur=0Aanywhere (with interrupts enabled), it is = plain unnecessary to take=0Athe risk.=0A=0ASigned-off-by: Jan Beulich = =0ACc: Ian Campbell =0A=0A---= a/arch/i386/kernel/time-xen.c=0A+++ b/arch/i386/kernel/time-xen.c=0A@@ = -666,6 +666,7 @@ irqreturn_t timer_interrupt(int irq, voi=0A s64 delta, = delta_cpu, stolen, blocked;=0A u64 sched_time;=0A unsigned int i, = cpu =3D smp_processor_id();=0A+ int schedule_clock_was_set_work =3D 0;=0A = struct shadow_time_info *shadow =3D &per_cpu(shadow_time, cpu);=0A = struct vcpu_runstate_info *runstate =3D &per_cpu(runstate, cpu);=0A =0A@@ = -720,12 +721,14 @@ irqreturn_t timer_interrupt(int irq, voi=0A =0A if = (shadow_tv_version !=3D HYPERVISOR_shared_info->wc_version) {=0A = update_wallclock();=0A- if (keventd_up())=0A- = schedule_work(&clock_was_set_work);=0A+ schedule_clock_was_set_work= =3D 1;=0A }=0A =0A write_sequnlock(&xtime_lock);=0A =0A+ if = (schedule_clock_was_set_work && keventd_up())=0A+ schedule_wo= rk(&clock_was_set_work);=0A+=0A /*=0A * Account stolen = ticks.=0A * HACK: Passing NULL to account_steal_time()=0A --=__PartDAF7FAC2.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartDAF7FAC2.2__=--