From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 18DB64409; Mon, 23 Jun 2025 21:37:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750714645; cv=none; b=P80BOoZP2Rga9kz4YmFHfYokVx88knInSPB7mAGWQ4GFFFXNBTXsJgp9xziMOtHI8vfhAvOPD4uQFkMUXRnj0u2qXnXf2bghjWDMBD99QrRP7gVq+bYKtCKBQRlraYgx8t/Nc3ehlIBz7Eu0OjszPYYicWRlwFRyvyyjZ8SZ4+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750714645; c=relaxed/simple; bh=ZENANfJwadpoVTPkAZFzRq1wHruCOebfQNJZbE+ByCg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V1Z37K1UZAEhvEAaSbgHlGJFC902wXU4KdhQW5ZPTv3C6l3ePITns/W7Pg2LG3wiDfjh+tkns04WiJsdGFrYsaRrAKvzxXcW1hYzhItEjoWbW6NZtE1k22n4dXh5Q6oyfsvbMm/l7i9iyV5V0whMVtoSo8bse1TqWqQfR/0X7LE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cPF+1SkK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cPF+1SkK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6028C4CEEA; Mon, 23 Jun 2025 21:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750714645; bh=ZENANfJwadpoVTPkAZFzRq1wHruCOebfQNJZbE+ByCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cPF+1SkKOqMr22ujwBpFv0G0ekVVOolGcko5oQZDYJ7VVTp/lpiKucHg7e4xrCMdZ vpakJgjJlz7cCsKX4qTja0o6PlBDOl2ud9sSMQoHZ/+BT0DGjhCGijZM1ESId8sCA8 YG2k0erNd90nAyhJEJX4EmVW6C/nnCn92tX6SYM8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Patrick Daly , Charan Teja Kalla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.10 220/355] PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn() Date: Mon, 23 Jun 2025 15:07:01 +0200 Message-ID: <20250623130633.356948337@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130626.716971725@linuxfoundation.org> References: <20250623130626.716971725@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Charan Teja Kalla [ Upstream commit 40d3b40dce375d6f1c1dbf08d79eed3aed6c691d ] pm_runtime_put_autosuspend() schedules a hrtimer to expire at "dev->power.timer_expires". If the hrtimer's callback, pm_suspend_timer_fn(), observes that the current time equals "dev->power.timer_expires", it unexpectedly bails out instead of proceeding with runtime suspend. pm_suspend_timer_fn(): if (expires > 0 && expires < ktime_get_mono_fast_ns()) { dev->power.timer_expires = 0; rpm_suspend(..) } Additionally, as ->timer_expires is not cleared, all the future auto suspend requests will not schedule hrtimer to perform auto suspend. rpm_suspend(): if ((rpmflags & RPM_AUTO) &&...) { if (!(dev->power.timer_expires && ...) { <-- this will fail. hrtimer_start_range_ns(&dev->power.suspend_timer,...); } } Fix this by as well checking if current time reaches the set expiration. Co-developed-by: Patrick Daly Signed-off-by: Patrick Daly Signed-off-by: Charan Teja Kalla Link: https://patch.msgid.link/20250515064125.1211561-1-quic_charante@quicinc.com Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/base/power/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 4950864d3ea50..58d376b1cd680 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -998,7 +998,7 @@ static enum hrtimer_restart pm_suspend_timer_fn(struct hrtimer *timer) * If 'expires' is after the current time, we've been called * too early. */ - if (expires > 0 && expires < ktime_get_mono_fast_ns()) { + if (expires > 0 && expires <= ktime_get_mono_fast_ns()) { dev->power.timer_expires = 0; rpm_suspend(dev, dev->power.timer_autosuspends ? (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); -- 2.39.5