This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] Fixing mwait usage when doing cpu offline

To: Keir Fraser <keir@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Fixing mwait usage when doing cpu offline
From: Haitao Shan <maillists.shan@xxxxxxxxx>
Date: Wed, 23 Feb 2011 17:05:25 +0800
Delivery-date: Wed, 23 Feb 2011 01:06:17 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=eM2Q1rAxzso+dH8Ckk7rdhdG5gK1FafShcvw/SqFqDs=; b=IBCriHEQ4QlwGW0P6Ik11L9d2G4osy9shsqKtQvNKcbIxukanmXIU1+RG78x9Ej1It dCT/Fneu59pnSDCAr9PNKRh5lj8CNsphkiMIOdpOmPYOvJ/ESQIu/cfaYmgGDx4ftDTX dPKSegbkcwvIWgRMwRRouPqXgXtcZL9dzyWFk=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=VRzcr6UrKnB3p+pmi+SxnXz97KxastuiNLtX9MrMBnn19GYFGBwB/LQxR/O3xa8IWz lWVhuDp1vMe1LIO6rG34EgBcNS3SvdcINFe6O2L5p+uY0S02PUHuXIjprjuOKFr5yv67 W6UcNfJw4g0gw0DKaETzfwXSkFo35wRAhvcis=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi, Keir,

In debugging the issue "system hang when doing cpu offline", I identified a situation that could cause a dead lock. The scenario is: mwait_idle_with_hint inside play_dead will access per cpu variable, which causes #PF. The #PF handler will use printk, which will schedule a tasklet. In scheduling a tasklet, per cpu variables are needed, otherwise, there will be another #PF. These series of #PF produce a dead lock around tasklet_lock.

This patch avoids using per_cpu variable inside play_dead.

Signed-off-by: Shan Haitao <haitao.shan@xxxxxxxxx>
Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>

diff -r dac86c85222e xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c Fri Feb 18 19:07:11 2011 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c Wed Feb 23 17:05:32 2011 +0800
@@ -569,7 +569,8 @@ static void acpi_dead_idle(void)
             case ACPI_CSTATE_EM_FFH:
                 /* Not treat interrupt as break event */
-                mwait_idle_with_hints(cx->address, 0);
+                __monitor((void *)&mwait_wakeup(smp_processor_id()), 0, 0);
+                __mwait(cx->address, 0);
             case ACPI_CSTATE_EM_SYSIO:

Attachment: cpu_offline_mwait_fix.patch
Description: Binary data

Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fixing mwait usage when doing cpu offline, Haitao Shan <=