Message ID | 20240301092657.15528-1-qingliang.li@mediatek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-88182-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp959542dyb; Fri, 1 Mar 2024 01:27:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUp2XsFsijQVSSMFaT95HDJ/tsamPbPx5Q3VUVCIOCdYc/E8GGSvrH0kpYoYyvLmgqJ/ZmroD49VyPHZbWnTjC13obhmw== X-Google-Smtp-Source: AGHT+IHwZM36JRMWAtAMiT7XclWIXisnnYfDlpycwcQ7ZqeRuY6BFdi+RUniVHgZduhSW9BfuVC0 X-Received: by 2002:a05:622a:1a90:b0:42e:7a59:8041 with SMTP id s16-20020a05622a1a9000b0042e7a598041mr6587198qtc.4.1709285262472; Fri, 01 Mar 2024 01:27:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709285262; cv=pass; d=google.com; s=arc-20160816; b=mGQR/FcJsWBVkHcgP0DP9hpM9J0Ajlbs0E/PmTx37zIDfcyL0DINmX8CWQVg+nzzM2 W01KGY0duUXz9nAEB3/feMxMm1VihXSh8Wbr+HZ6owHiN7l5s+esnTN8BJ1Djxx3nHfG k/B/6Rlyi2FflPT+QrCfliWTKRS44C/9WAilwnty968ZDeN1/wMjx46puBBVpYbsWPvO G2W5naI2u0JcnOek6O5lPj1eD6E4/NXWbNV0r9wLaGaoVcqex/Uq6a8/bJc8uENgw6GX n2HA5pzoiuPKyZ6bhscAyAjJsxaYgdVSCO4+XqbGZnI6Obs5jf11m9GPDJu404Ayditg jj3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=URy1vpIJ5f5vmjJkt9UJsw41aHt3Xplgxq8vgpxbX3U=; fh=UEqk7KTwFBlPBrjsHKC2bazYrv9dp+Hv2w8pDEvjxio=; b=gNhBO+sWxMF2iTamS9loh0u6aH+AniKkOpPbiPqg/smD/be1l2fYqrugLI3S333t4g wPh+foBr72VcW+9bK9ZH2ZezLCvrceqXEsB7z3ARpTiT/0QmGEgS4MK3jtXCt0RcnMXa T8LmNq7BxFqXxBzLYUa0u91vWmpEwbOwAhQSF6cfdaTwhm3EEoOYv0YfE6G2e6YuOjB9 hLaBXq4/45dRL06WsoOV2/+dZ9srmNsMKyqa8VKq9oJcMpeP4elWWVVRBcVPXgFaHnV0 Loawgpi7okhB9/a+R1gIwCuE4ko7UBmmKSZNn4AYfRkHf7NNBX2trxo9v0XMePV8lnqo t4uw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="Hy/D0RAJ"; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-88182-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88182-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f13-20020ac86ecd000000b0042ea0a2fb20si3043850qtv.570.2024.03.01.01.27.42 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 01:27:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88182-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="Hy/D0RAJ"; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-88182-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88182-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 351C21C211E7 for <ouuuleilei@gmail.com>; Fri, 1 Mar 2024 09:27:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0E846A35C; Fri, 1 Mar 2024 09:27:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Hy/D0RAJ" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE6215B1E2; Fri, 1 Mar 2024 09:27:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709285234; cv=none; b=LwmA92xcDDazyneQq/HRn0g/yKyysjz1iM0dkpriWTImb49oxR8cvrjJOATFMo0RZY88uHo7aWJfTtJjD9M+eYKRJXX9pryB5I5AwAIZfpqShIt/m6InFaZ5g7+YgK2s/9UOc4qXpdxM6oC9UOLwtEThcZyAWgkfTzgXd2sU1eE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709285234; c=relaxed/simple; bh=47OsnaN5y1sSpMaVgSHMNf7KXfsd52j31fHUXwOIOaQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=r1if1szaj9088mKdQ2QzIdR+kDrCDdvQaEHWxyQYUxWWI7FqPEbGkT+ub6hfodtdO8cdTRVJtFRuH8I+WvZCViBtpUgEh+d0M/SeZL8fHawF8ceQdJTK7PluhfXNJ2BuSJTMmNospesPtcI2grvOyVZtRLukhRXFntXf4ARj/Wg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=Hy/D0RAJ; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: de139508d7ad11ee935d6952f98a51a9-20240301 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=URy1vpIJ5f5vmjJkt9UJsw41aHt3Xplgxq8vgpxbX3U=; b=Hy/D0RAJ98wVHYPKQDHB+3rBm67EOPJV3Tk9rOKzI3486xUiBdbKsOZ0pPWz2ysQFrE1TuK+X3DmLlU+I9EvYfqgQJk/9e376bjE8WjzKTng2OSNjnB51i3PC/KRmUwcJkrbDUwwBjqwpDAb6kf/YkiBSvcDmg7PCusEQ8Hn9vA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:81194082-23ff-4dae-a5a0-9772d21edcd6,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:6f543d0,CLOUDID:c716ff80-4f93-4875-95e7-8c66ea833d57,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES :1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: de139508d7ad11ee935d6952f98a51a9-20240301 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw02.mediatek.com (envelope-from <qingliang.li@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1229228584; Fri, 01 Mar 2024 17:27:05 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 1 Mar 2024 17:27:03 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 1 Mar 2024 17:27:03 +0800 From: Qingliang Li <qingliang.li@mediatek.com> To: "Rafael J . Wysocki" <rafael@kernel.org>, Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Johan Hovold <johan+linaro@kernel.org>, Tony Lindgren <tony@atomide.com> CC: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>, Qingliang Li <qingliang.li@mediatek.com>, Dhruva Gole <d-gole@ti.com> Subject: [PATCH v2] PM: sleep: wakeirq: fix wake irq warning in system suspend Date: Fri, 1 Mar 2024 17:26:57 +0800 Message-ID: <20240301092657.15528-1-qingliang.li@mediatek.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792315503476117681 X-GMAIL-MSGID: 1792315503476117681 |
Series |
[v2] PM: sleep: wakeirq: fix wake irq warning in system suspend
|
|
Commit Message
Qingliang Li
March 1, 2024, 9:26 a.m. UTC
When driver uses pm_runtime_force_suspend() as the system suspend callback function and registers the wake irq with reverse enable ordering, the wake irq will be re-enabled when entering system suspend, triggering an 'Unbalanced enable for IRQ xxx' warning. In this scenario, the call sequence during system suspend is as follows: suspend_devices_and_enter() -> dpm_suspend_start() -> dpm_run_callback() -> pm_runtime_force_suspend() -> dev_pm_enable_wake_irq_check() -> dev_pm_enable_wake_irq_complete() -> suspend_enter() -> dpm_suspend_noirq() -> device_wakeup_arm_wake_irqs() -> dev_pm_arm_wake_irq() To fix this issue, complete the setting of WAKE_IRQ_DEDICATED_ENABLED flag in dev_pm_enable_wake_irq_complete() to avoid redundant irq enablement. Reviewed-by: Dhruva Gole <d-gole@ti.com> Signed-off-by: Qingliang Li <qingliang.li@mediatek.com> --- drivers/base/power/wakeirq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On Fri, Mar 01, 2024 at 05:26:57PM +0800, Qingliang Li wrote: > When driver uses pm_runtime_force_suspend() as the system suspend callback > function and registers the wake irq with reverse enable ordering, the wake > irq will be re-enabled when entering system suspend, triggering an > 'Unbalanced enable for IRQ xxx' warning. In this scenario, the call > sequence during system suspend is as follows: > suspend_devices_and_enter() > -> dpm_suspend_start() > -> dpm_run_callback() > -> pm_runtime_force_suspend() > -> dev_pm_enable_wake_irq_check() > -> dev_pm_enable_wake_irq_complete() > > -> suspend_enter() > -> dpm_suspend_noirq() > -> device_wakeup_arm_wake_irqs() > -> dev_pm_arm_wake_irq() > > To fix this issue, complete the setting of WAKE_IRQ_DEDICATED_ENABLED flag > in dev_pm_enable_wake_irq_complete() to avoid redundant irq enablement. > > Reviewed-by: Dhruva Gole <d-gole@ti.com> > Signed-off-by: Qingliang Li <qingliang.li@mediatek.com> Thanks for the fix. Looks correct to me: Reviewed-by: Johan Hovold <johan+linaro@kernel.org> I think you should add back the Fixes tag from v1 and CC stable as well: Fixes: 8527beb12087 ("PM: sleep: wakeirq: fix wake irq arming") Cc: stable@vger.kernel.org # 5.16 Note that WAKE_IRQ_DEDICATED_REVERSE was added in 5.16 by commit 259714100d98 ("PM / wakeirq: support enabling wake-up irq after runtime_suspend called") so no need to try to backport any further than that. Johan
diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c index 42171f766dcb..5a5a9e978e85 100644 --- a/drivers/base/power/wakeirq.c +++ b/drivers/base/power/wakeirq.c @@ -313,8 +313,10 @@ void dev_pm_enable_wake_irq_complete(struct device *dev) return; if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED && - wirq->status & WAKE_IRQ_DEDICATED_REVERSE) + wirq->status & WAKE_IRQ_DEDICATED_REVERSE) { enable_irq(wirq->irq); + wirq->status |= WAKE_IRQ_DEDICATED_ENABLED; + } } /**