From nobody Tue Dec 9 02:55:05 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 94D1B191F98; Thu, 13 Nov 2025 01:26:46 +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=1762997212; cv=none; b=MX33I8N4KHJ41imiw6Xg0M4mgk+x/5Y7qlVE0iW6bDoHoua+JY1QhkcKBlMi66Llcmgy6mMWpFZ579urn6krzeijrU1elO6rPk4tHDLzV7QT7dYPJiImDJf7oXD+aTxeFz6TEictWc+lHYECu6BpqTR9akVbbIjcHY7R/mA79j8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762997212; c=relaxed/simple; bh=64dZnGamHBcTIvq0pmmd7szcIoX92qyWF+m6eDt/MGY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=i5y5IDNA/afDkpUCBEnXpRsTBsofTQ2T6AW8kAdZaT0iHLdweYYiKYmvW1JAqS+3kfEUAM2tuNj2DwnixrQFOu9xari30LE9yPYemf/9esQa5GWVxgAOnWIEbQZmkGmAYaTsrX/cmocc2Vy/YZefjjjq6SIWRD7b3I/im9TOZtI= 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: cf436956c02f11f0a38c85956e01ac42-20251113 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.6,REQID:d3ef6248-b3cd-471d-999e-14d6365f27b3,IP:0,UR L:0,TC:0,Content:0,EDM:-25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-25 X-CID-META: VersionHash:a9d874c,CLOUDID:1dd7349b43aa92193d6a79371df4f246,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:102|850,TC:nil,Content:0|15|50,EDM:2,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: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: cf436956c02f11f0a38c85956e01ac42-20251113 X-User: luriwen@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1558849958; Thu, 13 Nov 2025 09:26:42 +0800 From: Riwen Lu To: rafael@kernel.org, pavel@kernel.org, lenb@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Riwen Lu , xiongxin Subject: [PATCH v3] PM: suspend: Make pm_test delay interruptible by wakeup events Date: Thu, 13 Nov 2025 09:26:38 +0800 Message-Id: <20251113012638.1362013-1-luriwen@kylinos.cn> X-Mailer: git-send-email 2.25.1 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" Modify the suspend_test() function to make the test delay can be interrupted by wakeup events. This improves the responsiveness of the system during suspend testing when wakeup events occur, allowing the suspend process to proceed without waiting for the full test delay to complete when wakeup events are detected. Additionally, using msleep() instead of mdelay() avoids potential soft lockup "CPU stuck" issues when long test delays are configured. Co-developed-by: xiongxin Signed-off-by: xiongxin Signed-off-by: Riwen Lu --- kernel/power/suspend.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index b4ca17c2fecf..1c2f777da367 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -344,10 +344,14 @@ MODULE_PARM_DESC(pm_test_delay, static int suspend_test(int level) { #ifdef CONFIG_PM_DEBUG + int i; + if (pm_test_level =3D=3D level) { pr_info("suspend debug: Waiting for %d second(s).\n", pm_test_delay); - mdelay(pm_test_delay * 1000); + for (i =3D 0; i < pm_test_delay && !pm_wakeup_pending(); i++) + msleep(1000); + return 1; } #endif /* !CONFIG_PM_DEBUG */ --=20 2.25.1