Received: by 10.213.65.68 with SMTP id h4csp2114522imn; Sun, 8 Apr 2018 20:04:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+8tCPaaeyVoI3iUR/C1cixXnl07ZGX1FjFO4LZOTboeEe/AVvfHXEWctPwSezHQ90RrJvr X-Received: by 10.99.149.83 with SMTP id t19mr23765710pgn.433.1523243087957; Sun, 08 Apr 2018 20:04:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243087; cv=none; d=google.com; s=arc-20160816; b=jz5iNzCouVyXkvOvuMIyifP2g0sVhYWsWKPRnojs3rwXLsgFWalZ9EO/LxRUufdfT5 069MwjUTn07llpyduEr7GZ8/fYfxbpnLOESfRb0FJ8YNhU17+awZWxzBO/wLcNfrkXIu 2wAE6QZz8NIV6OEFTvHI/ovWBgwmMIQrO9aCxtOd0vNZ0TqtDLbaMLPPeWEfU2J4+vQi m9DPhZV3nPyaMCohPUK4d3Y/rbb2bIYQmfAYX2YstUlyV2Bj6oZmVohPKFVhsopvnAaW ZvZ1Dd8gASxvNFMF+fDfGRqiBKC3n0H/5rJu6ZFJn2JJWkCVZkJwJfx4u+tQJg99DMGf +3ww== 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=CBG0LUyweUysaWri6huEGkQXNoey1CI5WzM/tjBjaokURu/a40gNMrkPy4pG7TMQA9 4QIHDLPMYGVjQI93gOVzkPP7Rwk1EKgj2DeeYSG+ymooug0tCDu43AlkycjyMUW64Zat XE2Ml6No+3+jmbtqIzfkPWNOrttprtDr658SB5pB7FgoFOx2iE3yPwemYMlZBWUxx/3M 2NBqEWieT13Rx8TKzKuJRNHPHKSM8TTuBDWaGH69jxsL2LGgX8WG+qxSG0qwMgCwO7uF Ook5MZvcTkz820ulrWOMFWsMDBZllW0Shy+pHN4ricfcmaAf3FOXG+vJitl/2lA1oNlF RoaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=VDprNThJ; 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 g3-v6si13919127pld.513.2018.04.08.20.04.11; Sun, 08 Apr 2018 20:04:47 -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=VDprNThJ; 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 S1755404AbeDIA0l (ORCPT + 98 others); Sun, 8 Apr 2018 20:26:41 -0400 Received: from mail-sn1nam02on0138.outbound.protection.outlook.com ([104.47.36.138]:42256 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755350AbeDIA0d (ORCPT ); Sun, 8 Apr 2018 20:26:33 -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=VDprNThJruC1G996K6Xxit0l9o4gT3Drucz4FGgiofUHFRYdZArNNW4i137TjYeFwWxXM0juuJ4bPtjKNOS6gG0VjKVH4wXVXRZwXUPAViIeguEV8TgJDTbURQ00wXIMFjUfHvJdvdZU+LicJDGx3yk0u5HXn1uHSI5RId2f7f4= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0725.namprd21.prod.outlook.com (10.167.107.167) 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:26:22 +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:26:22 +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.14 152/161] PM / wakeirq: Fix unbalanced IRQ enable for wakeirq Thread-Topic: [PATCH AUTOSEL for 4.14 152/161] PM / wakeirq: Fix unbalanced IRQ enable for wakeirq Thread-Index: AQHTz5jFeqpmTIDj0E69g/HAlgB/Tw== Date: Mon, 9 Apr 2018 00:21:57 +0000 Message-ID: <20180409001936.162706-152-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-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;DM5PR2101MB0725;7:XqX3dd6b3UH4MZLUC81nwsC58Vl866ZVTxG3HSwY9oTpigJYsezBmLX3tv/TlwuLFzcrIpBQQ++rRmsEFDMR+V+PApmXBXn9PS47r4V872lDb1J/4nq0rFhTNv9FtnuWknWZb2RvVib4sPcENsMVl/2BtFdvZcjKkzHJp7VevsEgcYeX/AtuOOPvoVCi3vH68SibtU0HOMXByVc4PFxHGpxo9v0bOkxNubQF3ZyK7nTRdNlq0LDud2bWILqt6kTv;20:fg9DAvcoQVGPKTsmlR4eiAUfjSZZ4q1ZYYi8eBZ07sQtUto1Xwy/1gLmLVnpkkvFkfJRCxj8GvG0RW7KtMsDKziTQyOEsJA5ZAlMIAY9dL6gxCKgvWZ//i06cj4poPrMtqv3EhdHgGx6bDn6Ac+lJ0kucMLM82j7CXZSFVID7xM= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 42af339d-cc4b-47ff-9d9c-08d59db085d8 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0725; x-ms-traffictypediagnostic: DM5PR2101MB0725: 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)(5005006)(8121501046)(10201501046)(3231221)(944501327)(52105095)(93006095)(93001095)(3002001)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011);SRVR:DM5PR2101MB0725;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0725; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(346002)(366004)(376002)(396003)(39860400002)(199004)(189003)(6486002)(81166006)(26005)(6512007)(4326008)(6666003)(6436002)(81156014)(8676002)(97736004)(186003)(36756003)(72206003)(53936002)(107886003)(2906002)(86362001)(76176011)(110136005)(305945005)(10090500001)(486006)(3660700001)(102836004)(5660300001)(14454004)(476003)(86612001)(446003)(99286004)(68736007)(66066001)(11346002)(54906003)(2616005)(1076002)(7736002)(5250100002)(25786009)(8936002)(478600001)(2900100001)(2501003)(3280700002)(105586002)(59450400001)(316002)(106356001)(22452003)(6506007)(3846002)(10290500003)(6116002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0725;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: KW12FMKo07Y+ubkapHnMuWwYdRz4023bY76R3WNyYr74Aj4MM5wVs4SmrzSmxqr1uRqVu38YH2Hb/3kCAAZej7TK3zQ+ImHLEcCcCajGOFwK3ezPRbwScWfjgWjEElHnsELOpA++Tn8uVMQANYoHHu6kgidYkjBAGBYFcgkS8DBtyrpyDT7kTSV6x+LxcrM0OK8CnhLJr2hwacGKH5CTae89lLUXcLA9/byQh4tbGcMVaA2qrDZuNQNHeXT27Kf8R19BYr8VKaR5DqYVZ3OJGb8zNsSjqM4KuRjymn8Xum5r9hMGCBNU1C83UrZNIW6oHPlEZtQzXuA6uOX+abmzgwpMyRkwdl/ueaPC1HVYJRikEX2enyTFwMWa5dNZr/jQebGIcnH0uxOGjLS4G3Ou1RARQa07yUk3pLJutVaSWZs= 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: 42af339d-cc4b-47ff-9d9c-08d59db085d8 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:21:57.6123 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0725 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