Received: by 10.213.65.68 with SMTP id h4csp2111921imn; Sun, 8 Apr 2018 20:01:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/f/7Hk9Pj6wckyHa+M3xB3IVFhrdbguM1S90OhhLgN2F0CXxb7oqhosIPlNKRtpg9hrR92 X-Received: by 2002:a17:902:728f:: with SMTP id d15-v6mr35983887pll.227.1523242885406; Sun, 08 Apr 2018 20:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523242885; cv=none; d=google.com; s=arc-20160816; b=ctaVDiR99yj4sXHzbIY/BykzriSg/9PvdCBCt+HzgIE3967uEbD/FehAMRglV+J01N 1zuCPE0pJQVlk+f5gVCUcywsMVgNyoxA7DCI60kgOv8D0lJndUeCLjoKCj76yo9J++DG /udw6E+lmSTGTtwP8udWMSDfdypwfLgeT1FrAjyyA5i5/JgNs4ucCLgl5emoo5jxVp+g cZJM4DIMql5Mb5/1T0BgUsRsKlGVLxzFDv+bD3DHNwh5gyE9DKvYAyyRPPeaYj4Qablk BBVFfR5RdXh+umSYEpyIv5FdeEXc3ydOVcy3SXjcN9RTMpMlGjTFMHeyxwaRY1jT6lqX MOOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=5ZT+2xRqeOI4DGJVTtfGyt+6ypj5gkYGPFvEEnttplo=; b=iPvE4IqKRY+oQAmWHEEq0WNkNa4+YoYm/nt+GqL2EtzKz1DRaTZ6XUDQJ38X+ZFQfV JfZz9goxodkfgconDNdCJFQ/iuOiyl+GCG9Zu/xc6GAOYjl0FSptUJqPdUcfc0HJ6BuT PSTKB5ibIlVMU9rHRj8junyR5YHTbR8TDWuHM3IftwDs5wzsvhfR0JzDQZ8qPM119aaM 7NTTH3j5jFNEetykWsCDwwF+NkHwMJIthVvixyYKJa3Rjh5pTEOtiacq2Uez7Pv5+g76 cVNhKE1uVL0+1RStY9sldAMLEVMatflhlAjvIcc5fHvHuLleja9uEp02+GaeGyGTGJsJ 8Qpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=UgF1EtPP; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2-v6si5725380plo.508.2018.04.08.20.00.48; Sun, 08 Apr 2018 20:01:25 -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=@microsoft.com header.s=selector1 header.b=UgF1EtPP; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754491AbeDIAVg (ORCPT + 99 others); Sun, 8 Apr 2018 20:21:36 -0400 Received: from mail-bl2nam02on0107.outbound.protection.outlook.com ([104.47.38.107]:21664 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754473AbeDIAVY (ORCPT ); Sun, 8 Apr 2018 20:21:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=5ZT+2xRqeOI4DGJVTtfGyt+6ypj5gkYGPFvEEnttplo=; b=UgF1EtPP7cFZLw3hhjmzW8kCaoEqbExGuS4VfHgzs3VTz0w4TqYSLZfQV0khISgvt0QzOs+HQAqnSET2BQhmSsUlrTtKFeVwUiEvTEg+OIk+WUSRWuJjFRnJdhVR+fUZ8yGEw9Q1l77WcGvAooCcmty3+m1qW/EzsuLqzyJcY9U= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1125.namprd21.prod.outlook.com (52.132.130.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:21:16 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:21:16 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Tony Lindgren , "Rafael J . Wysocki" , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 180/189] PM / wakeirq: Fix unbalanced IRQ enable for wakeirq Thread-Topic: [PATCH AUTOSEL for 4.15 180/189] PM / wakeirq: Fix unbalanced IRQ enable for wakeirq Thread-Index: AQHTz5hhfinYRxjnp0CyW2ogxr6J/Q== Date: Mon, 9 Apr 2018 00:19:10 +0000 Message-ID: <20180409001637.162453-180-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1125;7:VtNEZl8jJmcEF7wtNMGqr/MeSJNtjCbyXF0wRH1PXEQj0yn3L2O3r5YTZr48CrTKluVLJunVxWwfTDteuZ/Bx61BwIGY33cPOu9YDi5eYe74qq7jEoOqb8IK4eok/x/wD31dM9l/J+vmYcjncb5McDtp7Mif3gQjKkyEhcOpZn8QO2Bfa3OK7VbKwDbMRtiAynY970aQT2aS1iJWYH/6gCjrHQm4W8nHb6jUuqc45EjbHUAydJTwnIfDQ4J1stB0;20:2Vi2R79eoecGZbNiDzeH62B+FMYb8WOqfV9byZwwphM/2HzX7VE++SZaIaihe2ogknteOseSw1N+9QgMNVv6T1RcSUHefxAbwvnoncIqGtGGJYA1yTDS90pPv7I4XjavqvrZz//cHCJhC5H5ZPebZEIy6snu4GI1ArVW6jMwhbI= X-MS-Office365-Filtering-Correlation-Id: ea38f4c9-dc38-4f83-0468-08d59dafcefb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603328)(7193020);SRVR:DM5PR2101MB1125; x-ms-traffictypediagnostic: DM5PR2101MB1125: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1125;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1125; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(376002)(396003)(39380400002)(39860400002)(346002)(199004)(189003)(105586002)(7736002)(8676002)(97736004)(81166006)(59450400001)(106356001)(81156014)(305945005)(14454004)(66066001)(1076002)(102836004)(5250100002)(478600001)(2501003)(2900100001)(22452003)(72206003)(68736007)(26005)(86362001)(8936002)(76176011)(6506007)(6116002)(6486002)(186003)(5660300001)(3660700001)(316002)(54906003)(110136005)(25786009)(2906002)(10090500001)(6512007)(3280700002)(6666003)(10290500003)(53936002)(99286004)(86612001)(3846002)(6436002)(486006)(4326008)(2616005)(11346002)(107886003)(36756003)(476003)(446003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1125;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: uIMb9Ez8M7KqBkLN0gO7txeBn6PYpGDACV46yYe5Dzl4K5p2RrTBishTFIgV6W9+8Bpu5sZF3e4F+zbY6OCv2SU2HhMrZWg/8XRQJ71Iw71B1Cs5Df10mwX8Sb6wYoBJ5oT/Z6nC9BAKZ5sFXKggslukG/KfSx0tAimOgPrb4wovvus4VPNScj8qplj33APu0aTmE0ydOVGXmYneSqswdqjZXpkpoFAANgokgkmt6MsR38YrfIt3K2Z8kstTkpKExciYVAaIOBaKo7WowjppexRpeD5IFT91t6P6w9Zqch5l2l+2NMdfsPJppSEvz87G7K+lKbCmDZw9h1xrJBPDDdt6rbtbLPeDKYd8alR/1hC0Z85AEXlDq7mlbms4RD5So8vtQQuRgNaRnnpPt3TsSlf8SUrYN0DqJiP/nOP1hag= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea38f4c9-dc38-4f83-0468-08d59dafcefb X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:19:10.8457 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1125 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Lindgren [ Upstream commit 69728051f5bf15efaf6edfbcfe1b5a49a2437918 ] If a device is runtime PM suspended when we enter suspend and has a dedicated wake IRQ, we can get the following warning: WARNING: CPU: 0 PID: 108 at kernel/irq/manage.c:526 enable_irq+0x40/0x94 [ 102.087860] Unbalanced enable for IRQ 147 ... (enable_irq) from [] (dev_pm_arm_wake_irq+0x4c/0x60) (dev_pm_arm_wake_irq) from [] (device_wakeup_arm_wake_irqs+0x58/0x9c) (device_wakeup_arm_wake_irqs) from [] (dpm_suspend_noirq+0x10/0x48) (dpm_suspend_noirq) from [] (suspend_devices_and_enter+0x30c/0xf14) (suspend_devices_and_enter) from [] (enter_state+0xad4/0xbd8) (enter_state) from [] (pm_suspend+0x38/0x98) (pm_suspend) from [] (state_store+0x68/0xc8) This is because the dedicated wake IRQ for the device may have been already enabled earlier by dev_pm_enable_wake_irq_check(). Fix the issue by checking for runtime PM suspended status. This issue can be easily reproduced by setting serial console log level to zero, letting the serial console idle, and suspend the system from an ssh terminal. On resume, dmesg will have the warning above. The reason why I have not run into this issue earlier has been that I typically run my PM test cases from on a serial console instead over ssh. Fixes: c84345597558 (PM / wakeirq: Enable dedicated wakeirq for suspend) Signed-off-by: Tony Lindgren Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/base/power/wakeirq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c index ae0429827f31..67c50738834b 100644 --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -323,7 +323,8 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq) return; =20 if (device_may_wakeup(wirq->dev)) { - if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED) + if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED && + !pm_runtime_status_suspended(wirq->dev)) enable_irq(wirq->irq); =20 enable_irq_wake(wirq->irq); @@ -345,7 +346,8 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq) if (device_may_wakeup(wirq->dev)) { disable_irq_wake(wirq->irq); =20 - if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED) + if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED && + !pm_runtime_status_suspended(wirq->dev)) disable_irq_nosync(wirq->irq); } } --=20 2.15.1