Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5817562imm; Tue, 12 Jun 2018 13:57:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI2/NaXD7VYF5nEIs6/K5eRJQfF7noVPjMKZgvQbOrhAzSVuUxpHsielTp3dAoD6zoaSGug X-Received: by 2002:a65:5246:: with SMTP id q6-v6mr1656309pgp.152.1528837065473; Tue, 12 Jun 2018 13:57:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528837065; cv=none; d=google.com; s=arc-20160816; b=YyhBpJJKqZmB5PnzJ0QC1aaO6WtcOphinSx6UFFt6Kyg7ZDm2hZ+niFINYqwKMd3Lh a6wIX07OFsw6VO4K5q2WJ5QMdXmBaDNx9TeWjqZvwcmeGamxnvnnSbQqp0MyOIzEdujG LtNcmG1e3p+hHqLFCvrE/JXdput1HipWlBisPVjd9B8q3aKBgVsJcTm7OG8LWGCNVvBD pg1GxXSYv3JNeIzOISFIaLrcgjJChYNY9CUSoIiLcNnjn7/5oE2Zj/2OT7fE1HjVRGOf wen1MNLNvxicBmafgfShgNBE6NImPVXnRvRFx7xVIhAtdANJTlDqpVe9U7apLFm7cnPv WEYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=LUwFf+Ae7TN++/Wj+Px8atzbQJwwwOGW+JAVCXV9Dic=; b=wAo0JPB49pfdlnXpKqSOTZBDTsgZsmUnACwbApR+6RkU4C24shJ2guVTgJzpYyxC28 Z9GwD1UmRwMtCci1OnOBB0J2+zt0Dg9qCNDdB9ewNhxCNOSvnbKUSCXpij/lYR1/LAin fnUOo5W9PCY+Yc7wtJUBNLJvLk6YZOofIhPq2x9Up2Xqz5OHOoRydS6UoRciR741/Dr+ p4X9mIVG+KKx03qxeUNTOGtyJ9HDwgXJ3wg3izAnxbHaHY17E8wFoBp9Fm3zO8WhN+af BJgBomsYM3ZRi8OMAxfSHblZhBhw8sGfLPLMOoazuxJ9SLRY7dMtjPo8907Kvl+jrIf3 +4Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=vbkH03re; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y20-v6si868673pfm.186.2018.06.12.13.57.31; Tue, 12 Jun 2018 13:57:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=vbkH03re; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934783AbeFLU46 (ORCPT + 99 others); Tue, 12 Jun 2018 16:56:58 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:31588 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934350AbeFLU4r (ORCPT ); Tue, 12 Jun 2018 16:56:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1528837007; x=1560373007; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=LUwFf+Ae7TN++/Wj+Px8atzbQJwwwOGW+JAVCXV9Dic=; b=vbkH03re156tWJH7CQPVKodPhOaCFoCJooVrn9MyoAjvdOxRld3es1JW yI2+zeP8fNRL7i4qyTj+Whw6vDPwiwOAoMucGpik0UelPKhSZiHlGCvZW 35N4wI+WDv5egseEsSuN9xzp0wKIITy2bPmkFdAWNXn+gu8MokxjHsRZw U=; X-IronPort-AV: E=Sophos;i="5.51,216,1526342400"; d="scan'208";a="682679292" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2b-baacba05.us-west-2.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Jun 2018 20:56:43 +0000 Received: from EX13MTAUWA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2b-baacba05.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w5CKufg2102858 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 12 Jun 2018 20:56:41 GMT Received: from EX13D10UWA003.ant.amazon.com (10.43.160.248) by EX13MTAUWA001.ant.amazon.com (10.43.160.118) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Jun 2018 20:56:39 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13D10UWA003.ant.amazon.com (10.43.160.248) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 12 Jun 2018 20:56:38 +0000 Received: from localhost (10.25.15.63) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 12 Jun 2018 20:56:38 +0000 From: Anchal Agarwal To: , , , CC: , , , , , , , , , , , , , , , , , Subject: [RFC PATCH 11/12] x86/xen: close event channels for PIRQs in system core suspend callback Date: Tue, 12 Jun 2018 20:56:18 +0000 Message-ID: <20180612205619.28156-12-anchalag@amazon.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180612205619.28156-1-anchalag@amazon.com> References: <20180612205619.28156-1-anchalag@amazon.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Munehisa Kamata Close event channels allocated for devices which are backed by PIRQ and still active when suspending the system core. Normally, the devices are emulated legacy devices, e.g. PS/2 keyboard, floppy controller and etc. Without this, in PM hibernation, information about the event channel remains in hibernation image, but there is no guarantee that the same event channel numbers are assigned to the devices when restoring the system. This may cause conflict like the following and prevent some devices from being restored correctly. [ 102.330821] ------------[ cut here ]------------ [ 102.333264] WARNING: CPU: 0 PID: 2324 at drivers/xen/events/events_base.c:878 bind_evtchn_to_irq+0x88/0xf0 ... [ 102.348057] Call Trace: [ 102.348057] [] dump_stack+0x63/0x84 [ 102.348057] [] __warn+0xd1/0xf0 [ 102.348057] [] warn_slowpath_null+0x1d/0x20 [ 102.348057] [] bind_evtchn_to_irq+0x88/0xf0 [ 102.348057] [] ? blkif_copy_from_grant+0xb0/0xb0 [xen_blkfront] [ 102.348057] [] bind_evtchn_to_irqhandler+0x27/0x80 [ 102.348057] [] talk_to_blkback+0x425/0xcd0 [xen_blkfront] [ 102.348057] [] ? __kmalloc+0x1ea/0x200 [ 102.348057] [] blkfront_restore+0x2d/0x60 [xen_blkfront] [ 102.348057] [] xenbus_dev_restore+0x58/0x100 [ 102.348057] [] ? xenbus_frontend_delayed_resume+0x20/0x20 [ 102.348057] [] xenbus_dev_cond_restore+0x1e/0x30 [ 102.348057] [] dpm_run_callback+0x4e/0x130 [ 102.348057] [] device_resume+0xe7/0x210 [ 102.348057] [] ? pm_dev_dbg+0x80/0x80 [ 102.348057] [] dpm_resume+0x114/0x2f0 [ 102.348057] [] hibernation_snapshot+0x15f/0x380 [ 102.348057] [] hibernate+0x183/0x290 [ 102.348057] [] state_store+0xcf/0xe0 [ 102.348057] [] kobj_attr_store+0xf/0x20 [ 102.348057] [] sysfs_kf_write+0x3a/0x50 [ 102.348057] [] kernfs_fop_write+0x10b/0x190 [ 102.348057] [] __vfs_write+0x28/0x120 [ 102.348057] [] ? rw_verify_area+0x49/0xb0 [ 102.348057] [] vfs_write+0xb2/0x1b0 [ 102.348057] [] SyS_write+0x46/0xa0 [ 102.348057] [] entry_SYSCALL_64_fastpath+0x1a/0xa9 [ 102.423005] ---[ end trace b8d6718e22e2b107 ]--- [ 102.425031] genirq: Flags mismatch irq 6. 00000000 (blkif) vs. 00000000 (floppy) Note that we don't explicitly re-allocate event channels for such devices in the resume callback. Re-allocation will occur when PM core re-enable IRQs for the devices at later point. Signed-off-by: Munehisa Kamata Signed-off-by: Anchal Agarwal Reviewed-by: Munehisa Kamata Reviewed-by: Eduardo Valentin --- arch/x86/xen/suspend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index dae0f74..affa63d 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -105,6 +105,8 @@ static int xen_syscore_suspend(void) xen_save_steal_clock(cpu); } + xen_shutdown_pirqs(); + xrfp.domid = DOMID_SELF; xrfp.gpfn = __pa(HYPERVISOR_shared_info) >> PAGE_SHIFT; -- 2.7.4