From nobody Sun Feb 8 04:38:45 2026 Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [222.66.158.135]) (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 DB25CEED8 for ; Tue, 3 Feb 2026 07:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102937; cv=none; b=qSfTVuQjt+LKRhTBB7PnVg4UeAppjlx7ifAT0cQvnub1keQd/WYtwxsFfBfDCmj2955+9bxOB8D848UAZ76vjZWE8dDTkD4MMIuKbL8xEsXGbgjhspXe3zVnlnaFgubs2ob3YFi+GsGyZz+Pw0CRHXXjsKNwW/iXgC50gJz7JxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102937; c=relaxed/simple; bh=Y5eVcF/kprlwyaB72zcGUK0YkIWKS/geT/OC2MDm4aI=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=S4M6Yf515dOfzTsErTRI+bFJ0kYvV3gvOuXlhthF5mUwT6C2GUC1QPa/abWUixhMVLyzkOw8SmDqv/DfEef1FK2SQL34gO1M/j5RX1efvm4h+wvYGtbuX9iyyviRT/GOyX4gjVVRgEF01FXjgmAhhulJ++TUrZREIKgzyL9gCE0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; dkim=pass (2048-bit key) header.d=unisoc.com header.i=@unisoc.com header.b=tLoj5Eh/; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=unisoc.com header.i=@unisoc.com header.b="tLoj5Eh/" Received: from SHSQR01.spreadtrum.com (localhost [127.0.0.2] (may be forged)) by SHSQR01.spreadtrum.com with ESMTP id 6136ZnAU083709 for ; Tue, 3 Feb 2026 14:35:49 +0800 (+08) (envelope-from Xuewen.Yan@unisoc.com) Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 6136ZE9H077900; Tue, 3 Feb 2026 14:35:14 +0800 (+08) (envelope-from Xuewen.Yan@unisoc.com) Received: from SHDLP.spreadtrum.com (BJMBX01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4f4tyS1n7mz2MZGh2; Tue, 3 Feb 2026 14:35:12 +0800 (CST) Received: from BJ10918NBW01.spreadtrum.com (10.0.73.73) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 3 Feb 2026 14:35:12 +0800 From: Xuewen Yan To: , , , , CC: , , , , Subject: [PATCH] PM: sleep: core: Fix sync issues between work_in_progress and must_resume Date: Tue, 3 Feb 2026 14:34:59 +0800 Message-ID: <20260203063459.12808-1-xuewen.yan@unisoc.com> 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SHCAS01.spreadtrum.com (10.0.1.201) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 6136ZE9H077900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unisoc.com; s=default; t=1770100540; bh=friVGGYZGjT3EFdufZzfyfrOF2gSvrj8FbnJIrYeQm0=; h=From:To:CC:Subject:Date; b=tLoj5Eh/iCMczwVRTDjZeSM117KubD7XWSIVqFBsQEBoCKZveCm5gS1UBd5HVY3CX 1oYiOQ3mNcKlkI7jgcVaDUuwMSIIVDodxWmkZu4TZibTJWfa6uz2/CnEUsranEqEpj Xwc879ggW+7qzKV2vmJhJaN0I5ILJM6WHmPfEbbBDNItq5QUz5DmcT+WHvF1WB9O8s JRPYhQ8t9QTbkXZl07e6u8VB7fVK8DHQ8B93iXlm9Hs50GTUbETvyFbaZv336LhNTA INJV3kKOykdM5xka3hO6QoRTN/r7arTLwbCA1FFQc6TOxp3emfwwS/xWR76HxlUsNX XmUmItfPbOL6w== There is a synchronization issue when suspend async: suspend-task: async-child-kworker dpm_noirq_suspend_devices mutex_lock(dpm_list_mtx) async_suspend_noirq list_for_each(dpm_late_early_list) device_suspend_noirq dpm_clear_async_state(parent); dpm_run_callback() reinit_completion() dpm_superior_set_must_resume(d= ev) parent->power.work_in_progress =3D false; dev->parent->power.must_re= sume =3D true; Because the power.work_in_progress and power.must_resume use the same byte: struct dev_pm_info { .... [56] struct completion completion; [104] struct wakeup_source *wakeup; [112] bool wakeup_path : 1; [112] bool syscore : 1; [112] bool no_pm_callbacks : 1; [112] bool work_in_progress : 1; [112] bool smart_suspend : 1; [112] bool must_resume : 1; [112] bool may_skip_resume : 1; [112] bool strict_midlayer : 1; ... } So, if suspend-task and child-kworker modify these two variables simultaneously, it will cause mutual overwriting issues. More severely, this may result in the work_in_progress variable not being set to false, preventing the __dpm_async() function from queuing work to execute the parent=E2=80=99s suspend function. Consequently, the completion event will never be finalized, ultimately causing the suspend process to be blocked. To resolve the aforementioned issue, the must_resume variable should be protected using dpm_list_mtx. Fixes: aa7a9275ab81 ("PM: sleep: Suspend async parents after suspending chi= ldren") Fixes: 443046d1ad66 ("PM: sleep: Make suspend of devices more asynchronous") Signed-off-by: Xuewen Yan --- drivers/base/power/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 97a8b4fcf471..7ab42e065074 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1407,8 +1407,11 @@ static void dpm_superior_set_must_resume(struct devi= ce *dev) struct device_link *link; int idx; =20 - if (dev->parent) + if (dev->parent) { + mutex_lock(&dpm_list_mtx); dev->parent->power.must_resume =3D true; + mutex_unlock(&dpm_list_mtx); + } =20 idx =3D device_links_read_lock(); =20 --=20 2.25.1