From nobody Thu Oct 9 08:15:46 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 4BE4D23908B; Thu, 19 Jun 2025 03:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750305288; cv=none; b=NKmiAlj9cwtvDNwPIcGOO1v5EW9gUaScTzRmCAKOsdNZmCjY1cf4+XRfIT1/gd1AmkK51v6o/LRxTwlaOp0K2puaHIMZdvxJusH36K8kJPRF3+vtYdFk4PbdISaOdOFW3fmtfgyIWQn6KZshUqHHCTnttEdwzVLNDnKbNpjDAf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750305288; c=relaxed/simple; bh=eAit7dLjhFoUkFRK3AiJoiIf5OY6G3Y0LTeOZ+nYXh4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UDX1qKF+Kebhf2sMcUT6XPTH6fZLQhIMgBI/vnKH5vqmBE/9A2o6sXrkcJo0FIVdbG4FTvCXwxZGNlYdkjgzEng1ZMTkIHYlP0VceFKK2NaOdkn7VOhOlq2KRwNNinV7D8rHRE05GI7CHZMSCDnLx095R0JCocyeiHv07LONJoU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 210d6f944cc111f0b29709d653e92f7d-20250619 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:b4670211-3e8c-4c09-ae35-55eff7c8895b,IP:0,U RL:0,TC:0,Content:-25,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACT ION:release,TS:-50 X-CID-META: VersionHash:6493067,CLOUDID:97fb7946ccfa904ee71656e6ca9055b8,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:1,IP:n il,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LE S:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 210d6f944cc111f0b29709d653e92f7d-20250619 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1690500008; Thu, 19 Jun 2025 11:54:41 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 5CA6DE00891C; Thu, 19 Jun 2025 11:54:41 +0800 (CST) X-ns-mid: postfix-68538A01-2107067 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 5BB6BE008900; Thu, 19 Jun 2025 11:54:22 +0800 (CST) From: Zihuan Zhang To: rafael@kernel.org, pavel@kernel.org, len.brown@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v2 1/4] PM: freezer: Add retry count statistics for freeze pass iterations Date: Thu, 19 Jun 2025 11:53:52 +0800 Message-Id: <20250619035355.33402-2-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250619035355.33402-1-zhangzihuan@kylinos.cn> References: <20250619035355.33402-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Freezer retry loops during suspend are often triggered by tasks entering D-state (TASK_UNINTERRUPTIBLE), which cannot be frozen. This patch adds a simple retry counter to freeze_processes() to help quantify how many attempts were required before all tasks entered the frozen state. This is useful for performance tuning and debugging unpredictable suspend delays. A new dmesg log is added for visibility: freeze round: xx, tasks to freeze: xx This message allows users to correlate freeze instability with system state. Signed-off-by: Zihuan Zhang --- kernel/power/process.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/power/process.c b/kernel/power/process.c index dc0dfc349f22..87616ca710ac 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -32,6 +32,7 @@ static int try_to_freeze_tasks(bool user_only) struct task_struct *g, *p; unsigned long end_time; unsigned int todo; + unsigned int retry =3D 0; bool wq_busy =3D false; ktime_t start, end, elapsed; unsigned int elapsed_msecs; @@ -63,6 +64,8 @@ static int try_to_freeze_tasks(bool user_only) todo +=3D wq_busy; } =20 + pm_pr_dbg("freeze round: %d, task to freeze: %d\n", retry, todo); + if (!todo || time_after(jiffies, end_time)) break; =20 @@ -79,6 +82,7 @@ static int try_to_freeze_tasks(bool user_only) usleep_range(sleep_usecs / 2, sleep_usecs); if (sleep_usecs < 8 * USEC_PER_MSEC) sleep_usecs *=3D 2; + retry++; } =20 end =3D ktime_get_boottime(); --=20 2.25.1 From nobody Thu Oct 9 08:15:46 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 531C223A98E; Thu, 19 Jun 2025 03:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750305296; cv=none; b=deXTrwxyLNzicza4mnYICBJcKoV7gvGBKbqM4d/RANeiWgKYGpX7YYWxfWDHn2LRI8VPJofY5fLJhXY9ct/Qpvq7hZXky08iuqOpwbbwD9w+Nbr0BSZGkPtFmUuzDrlmw7mbKIT6VJ3heeaLo2quYZ5ScYMuSLgQeDXRMFqEnH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750305296; c=relaxed/simple; bh=fZSVGE1O4xTy4YTkQhSi8BuCDJSqE1i4HitHdLcQimQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XPQYNfXwjp4c/6CNignOe/hh8Frvj8hH9reNeZDcdQdYBfXuBeBbuC9wyC0JZEkvQ4fFxLkfWUwdKIQUJVmMQFyLFkP04X+RUldBAS/kl3vtoGQ+HdRp1IhGFduDz5Mag5BTulFmN6C0wm0USXRS0VG6UXUVFNMqL7baC2GXRGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 260cfe2e4cc111f0b29709d653e92f7d-20250619 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:470fc5b0-a2b4-4598-825a-d6f051aa7744,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:6493067,CLOUDID:44a0a1af001ac5a643a542b508c9405f,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3,IP: nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,L ES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 260cfe2e4cc111f0b29709d653e92f7d-20250619 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1184961320; Thu, 19 Jun 2025 11:54:49 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id BE55FE008900; Thu, 19 Jun 2025 11:54:49 +0800 (CST) X-ns-mid: postfix-68538A07-177829 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 933FCE00891C; Thu, 19 Jun 2025 11:54:46 +0800 (CST) From: Zihuan Zhang To: rafael@kernel.org, pavel@kernel.org, len.brown@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v2 2/4] PM: freezer: Print tasks stuck in D-state during freeze Date: Thu, 19 Jun 2025 11:53:53 +0800 Message-Id: <20250619035355.33402-3-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250619035355.33402-1-zhangzihuan@kylinos.cn> References: <20250619035355.33402-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To help diagnose freezing delays caused by tasks stuck in D-state, this patch adds logging for tasks that are stuck in D-state during each retry of the freezer loop. Such tasks are not killable and cannot be frozen, which can cause the system suspend process to retry many times before aborting. This message can help developers identify which user-space or kernel tasks are blocking the freeze process. Signed-off-by: Zihuan Zhang --- kernel/power/process.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/power/process.c b/kernel/power/process.c index 87616ca710ac..4007f621c2ad 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -55,6 +55,9 @@ static int try_to_freeze_tasks(bool user_only) if (p =3D=3D current || !freeze_task(p)) continue; =20 + if (retry > 1 && READ_ONCE(p->__state) =3D=3D TASK_UNINTERRUPTIBLE) + sched_show_task(p); + todo++; } read_unlock(&tasklist_lock); --=20 2.25.1 From nobody Thu Oct 9 08:15:46 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 212B023ABAC; Thu, 19 Jun 2025 03:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750305299; cv=none; b=WeWnjQ6eJqfszM09nXc4zjY0ZUlN0S29d4vXA+h76jUh5lJ+iQgHbYgRvA1g8A79gZDvsas6kx/1m245Ny3H+ypFuY3u5ZrlW5jO1JRiycgNQQ0rJfPnhcDMUqf4hDw2rfcqAOglzQWSHTnDpyIMedxpSyoCmRUywHSpD0TdSZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750305299; c=relaxed/simple; bh=y2uzoZ5QOSb6Z3GzmpyquAH2fLVaaVeh57OqZC7M0X0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kRcsq5d0cOsrYSUIXt8v3gw12zvoVBc84B+b34fxtD+GepBjcjJnSkhydavy8Z+RPVrnjzH61/2HTDtoqB5ouXMExG58+vuI7wrhNzayFx3Xr+yaEqKUU3h89u/nXwMocVK+dQBEELFWYcPTTHFr4OPxlgF5W6w9Y+dz0RK1a+4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 272a7d544cc111f0b29709d653e92f7d-20250619 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:cf6224e5-702d-42b7-8378-6c106d07fa6c,IP:0,U RL:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:b2808c8d7950ceec268a4d1ec147fdda,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:1,IP:n il,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LE S:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 272a7d544cc111f0b29709d653e92f7d-20250619 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1059521812; Thu, 19 Jun 2025 11:54:51 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 9E03AE00891C; Thu, 19 Jun 2025 11:54:51 +0800 (CST) X-ns-mid: postfix-68538A0B-23206110 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id C77F9E008900; Thu, 19 Jun 2025 11:54:50 +0800 (CST) From: Zihuan Zhang To: rafael@kernel.org, pavel@kernel.org, len.brown@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v2 3/4] PM: suspend: Assign pm_suspend_target_state earlier for valid debug logs Date: Thu, 19 Jun 2025 11:53:54 +0800 Message-Id: <20250619035355.33402-4-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250619035355.33402-1-zhangzihuan@kylinos.cn> References: <20250619035355.33402-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pm_suspend_target_state is used in debug logs inside enter_state(), but it is only assigned inside suspend_devices_and_enter(), which is too late. This causes early pm_pr_dbg() output to either show incorrect state or nothing at all, making suspend debugging harder. Assign pm_suspend_target_state at the beginning of enter_state() to ensure early log output is meaningful. Signed-off-by: Zihuan Zhang --- kernel/power/suspend.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 76b141b9aac0..16172ca22f21 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -584,6 +584,8 @@ static int enter_state(suspend_state_t state) if (!mutex_trylock(&system_transition_mutex)) return -EBUSY; =20 + pm_suspend_target_state =3D state; + if (state =3D=3D PM_SUSPEND_TO_IDLE) s2idle_begin(); =20 @@ -616,6 +618,7 @@ static int enter_state(suspend_state_t state) suspend_finish(); Unlock: filesystems_thaw(); + pm_suspend_target_state =3D PM_SUSPEND_ON; mutex_unlock(&system_transition_mutex); return error; } --=20 2.25.1 From nobody Thu Oct 9 08:15:46 2025 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 2A42823C50B; Thu, 19 Jun 2025 03:54:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750305300; cv=none; b=VPGKjuApRqImFN0D1BsaVfApgoD8bOfesL+mrxMeRwPN1sTFJV+4GnHuWj2kTt/LX6FWXJ1a22E0rXR43dk3VabUBBsgfQNoo2ldLxVIaU9cb0msP4VMr37SFwm5HEjWy6Rwvrpnp9CEo3W3Eq3bLrr/gOT8QgCDPRLxVjl9/mA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750305300; c=relaxed/simple; bh=wkBwDWReUmC3WJ88+crUEMgmlSBBufXjXXl67nIvoRo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hAqbRHnylziTLP/ObvJB50f2iMoU7vnB6/UVyz4GfjPq9hQZhwErZP8QGV9vWyBKbmofMRqpUzhKJJEnr/JmoSfOWxOStGJItnbEuDiLT0hto4S3nWI3RjVduQjeTDce3rfdYiyEaHKGGJjWsUKHpzwIKtx3X6wopHQPoD/Naqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 28437e5c4cc111f0b29709d653e92f7d-20250619 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.45,REQID:e0c611f5-6af2-4b27-bfee-9bfc5143c9b5,IP:0,U RL:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:6493067,CLOUDID:8dc46cc638afb5e98fed8effba1e0052,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:1,IP:n il,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LE S:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 28437e5c4cc111f0b29709d653e92f7d-20250619 Received: from mail.kylinos.cn [(10.44.16.175)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1067101472; Thu, 19 Jun 2025 11:54:53 +0800 Received: from mail.kylinos.cn (localhost [127.0.0.1]) by mail.kylinos.cn (NSMail) with SMTP id 2B176E00891C; Thu, 19 Jun 2025 11:54:53 +0800 (CST) X-ns-mid: postfix-68538A0D-4009511 Received: from localhost.localdomain (unknown [172.25.120.24]) by mail.kylinos.cn (NSMail) with ESMTPA id 973E5E008900; Thu, 19 Jun 2025 11:54:52 +0800 (CST) From: Zihuan Zhang To: rafael@kernel.org, pavel@kernel.org, len.brown@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zihuan Zhang Subject: [PATCH v2 4/4] PM: suspend: Simplify state check using sleep_state_supported() Date: Thu, 19 Jun 2025 11:53:55 +0800 Message-Id: <20250619035355.33402-5-zhangzihuan@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250619035355.33402-1-zhangzihuan@kylinos.cn> References: <20250619035355.33402-1-zhangzihuan@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently enter_state() open-codes state validation using `if (state =3D=3D PM_SUSPEND_TO_IDLE) ... else if (!valid_state(state)) ...= `. This can be simplified by calling sleep_state_supported(), which already encodes this logic. This improves clarity and reduces duplication. Signed-off-by: Zihuan Zhang --- kernel/power/suspend.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 16172ca22f21..b95c7a80ef20 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -571,16 +571,10 @@ static int enter_state(suspend_state_t state) int error; =20 trace_suspend_resume(TPS("suspend_enter"), state, true); - if (state =3D=3D PM_SUSPEND_TO_IDLE) { -#ifdef CONFIG_PM_DEBUG - if (pm_test_level !=3D TEST_NONE && pm_test_level <=3D TEST_CPUS) { - pr_warn("Unsupported test mode for suspend to idle, please choose none/= freezer/devices/platform.\n"); - return -EAGAIN; - } -#endif - } else if (!valid_state(state)) { - return -EINVAL; - } + + if (!sleep_state_supported(state)) + return -ENOSYS; + if (!mutex_trylock(&system_transition_mutex)) return -EBUSY; =20 --=20 2.25.1