From patchwork Wed Aug 17 08:51:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Yang X-Patchwork-Id: 1667157 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=BtTQxCXd; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4M71xc6jHNz1ygF for ; Wed, 17 Aug 2022 18:52:52 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oOEn3-0001BZ-Np; Wed, 17 Aug 2022 08:52:41 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oOEmd-0000Vj-4R for kernel-team@lists.ubuntu.com; Wed, 17 Aug 2022 08:52:15 +0000 Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id D48733FB94 for ; Wed, 17 Aug 2022 08:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1660726332; bh=ktEGjgQ2/GBQmayyYgmMOsxe/9J/tcFMDjZVgEXSLrY=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BtTQxCXdnTBvSaUjnVJug99hBXaW3ad73ZA1B0qQey9XpsZaPEwQNYKWtFxU2QTSs mdZ9fD2qLOn+WxWG0jzn9lbUFFgre78/ISllPYGM6Q+EfnweWjQla1TC/2oLEK2Oec oLuYcgMEWEy7n4fCHktujONXEyWwjDaYJvpPg1NfLioHnwmD/N7CgM7M5X91ncs6Wm zlr/uuc5FUEBBlmuEUjZPM/1XpdegSAZwaV//jVRAKlIg5i7rlYvmgDzc7AxKYo7x/ o9W+c9VWvxk23VKCrCRZ6efOLOCi2iXPhX0i0KZFPh+ZiqvN7/2YCT025JJd4YWr0S p++PsGpo0uiTw== Received: by mail-pl1-f200.google.com with SMTP id l2-20020a170902f68200b00171590ddc3bso7955287plg.2 for ; Wed, 17 Aug 2022 01:52:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=ktEGjgQ2/GBQmayyYgmMOsxe/9J/tcFMDjZVgEXSLrY=; b=B2zB4SaMV56k17PHwUuq1akqSbQ40Ez/p+wKRbHlER3ktvYcmnxQtNyuKyVrijjN+O SRP3jF07bUAS0tzN12kne6Ipv+3e+2H8WTQoDy/LbnxINZv3HGn01Ec6ig5ZHihyhVcC brtDALIhp4Qj8nQm+NTZNcdPejKVtYzD0Ij1WBt7y8dHsirv5o5k7R6ckHEoePoYGPKm 5QQ788WSUqoJpZn0Uw45cGikL9A7KqYjeYoXLcFSQe9OWEgxjkK7uhWxxX+SVe9QwlS7 9vsDjnfLlBptHh7RcULAchVKjZYw9mf9AB49mUPV0IE/+FdY3vlQhpuihL0ClRRPlH2v XrMA== X-Gm-Message-State: ACgBeo0ZnupUmc8TVx+sDLBt8LRWSCh6DYhTRTg/CirjwsFZf2lvR/lF 2M7uXVxTl/yOj6OXjujOg6uhb8r+Yo6cTV0ko58DXCsvLcjtX5RasGrH5pHvZNiJYjLXp7hZNXM /rvbkwJiiVjfWeHHFR+TcCgHru0e2wf0ygIbIfZ9EAw== X-Received: by 2002:a65:5504:0:b0:41d:271:4929 with SMTP id f4-20020a655504000000b0041d02714929mr20969083pgr.606.1660726331245; Wed, 17 Aug 2022 01:52:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR5VtOTZou+A8N+HI8xC/b253xYV0wQmRb/kIMsEv4RgLF0q/FsXylwuU+ZNr2hUPRq6yEcoug== X-Received: by 2002:a65:5504:0:b0:41d:271:4929 with SMTP id f4-20020a655504000000b0041d02714929mr20969065pgr.606.1660726330741; Wed, 17 Aug 2022 01:52:10 -0700 (PDT) Received: from localhost.localdomain (220-135-31-21.hinet-ip.hinet.net. [220.135.31.21]) by smtp.gmail.com with ESMTPSA id s90-20020a17090a69e300b001f522180d46sm1001033pjj.8.2022.08.17.01.52.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 01:52:10 -0700 (PDT) From: Gerald Yang To: kernel-team@lists.ubuntu.com Subject: [SRU][jammy/linux-aws][kinetic/linux-aws][PATCH 11/20] UBUNTU: SAUCE: x86/xen: close event channels for PIRQs in system core suspend callback Date: Wed, 17 Aug 2022 16:51:40 +0800 Message-Id: <20220817085150.2078055-15-gerald.yang@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817085150.2078055-1-gerald.yang@canonical.com> References: <20220817085150.2078055-1-gerald.yang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Munehisa Kamata BugLink: https://bugs.launchpad.net/bugs/1968062 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 CR: https://cr.amazon.com/r/8273217/ (cherry picked from commit 46bd378646b79f762eae1ad124694302fe1aa2f9 amazon-5.15.y/mainline) Signed-off-by: Gerald Yang Signed-off-by: Matthew Ruffell --- 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 dae0f74f5390..affa63d4b6bd 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;