From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpbgjp3.qq.com (smtpbgjp3.qq.com [54.92.39.34]) (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 984DA190462 for ; Thu, 18 Jun 2026 01:32:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.92.39.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781746356; cv=none; b=GV2hICpG5hOtbtYX+9IhYVbxnx+GgbcNroaYZh4qKJaFOaIRqEPatXLMTJJBMJqivyzt35DvIExqp1moih6BlHLAp9tbWLAtYnpeQ9Eku9i4mRT9khqBgmXYmEFLCPcZ9pNcIk44DWjCbGBWmEMnsT4Q5t5HPFFq8h+jJetH1BU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781746356; c=relaxed/simple; bh=BN3HOsEgWlvUWdTzGM/7bMKC1H0GMmZnPty4uJ5J3zY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nIDSwyrsp+wMYe2elLVpoz4qDNLqELYEOE3mc7U2ZH8kU5g0q+jMZpAvJnGSiWN/dztLCzb16nn4oFsQthKKFR/MaCLxsD097Ho3Uu9wU8FR7biC083/OquGjCXx+Y96jKs4VMm5Osbrz1evVbSNdCFZpi8sGpzrojeH3jTcea0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=SPjfiQhX; arc=none smtp.client-ip=54.92.39.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="SPjfiQhX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1781746314; bh=XuyqIVk4TA83mMek4q/hmkWntBwGcXqXYtOybwsn4DY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=SPjfiQhXqtN6Fef7uYhTdzc6/ql7aJgrElfEhF28EzPQ2BTbbKFX8AdYSMFE2ugDp GSOC0P0qbpyLOwRVf0IUA+nUTuO1qwAHWEVk68jEqYqqy/Sm8djRICXlTxXkXVvtzZ ZN1cGMqY6CDuILDLlPvYwHrKQ9ygm9ozpGHkrWcs= X-QQ-mid: esmtpsz10t1781746301td878c4d8 X-QQ-Originating-IP: /fn3H90OKJPyg9TAzppitqhppYgXFYix1ahqvTzODAA= Received: from localhost.localdomain ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 18 Jun 2026 09:31:38 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 3030917331799414675 EX-QQ-RecipientCnt: 15 From: Haowen Tu To: rafael@kernel.org Cc: tuhaowen@uniontech.com, gregkh@linuxfoundation.org, hansg@kernel.org, kernel@uniontech.com, laurent.pinchart@ideasonboard.com, lenb@kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, mchehab@kernel.org, oneukum@suse.com, pavel@kernel.org, stern@rowland.harvard.edu Subject: [PATCH v3 0/3] PM: hibernate: skip UVC streaming restart after snapshot Date: Thu, 18 Jun 2026 09:31:30 +0800 Message-Id: <20260618013133.1047270-1-tuhaowen@uniontech.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20260602032413.1540166-1-tuhaowen@uniontech.com> References: <20260602032413.1540166-1-tuhaowen@uniontech.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: esmtpsz:uniontech.com:qybglogicsvrsz:qybglogicsvrsz3b-0 X-QQ-XMAILINFO: NULd4DJcKZL/8p3Cb7gfg/2OpokqOFu1ScmPW1vbh29zsvTUyjrT/JIL TGhEy2E29fj+BwgOgkbnb//aAx3YuNNALhwgx0ZILe3e02TrGlwCYQrGXFA6ocZLpFArrYp lsFs2Xx1e19mdNT5niYHBw14F+HSFIcXCa2ztYjcTRCv8HGcQCbpZa2GWYeDFikteeIQQnm EhslxDOBwgtgAy3aec1/lMufPwuG456ZfZRfCct4/Tks3f5lNdpdqiNpLtcmBVBeta7CMj9 hTVpDdvdWKAdSJESLWVaWvv7k6m5SW7j76pLdRSRWTIIqQTT+unRHd8LINSDa4SVYnr226v eOOsibmhQ5s30/qEkC3ADs88rzzp7tYEAaAW7JTZJIxyvQouFiyOVhKQ7LcYCLfQMbfk1pD 5nklE5QuwS2Wy0sx2VdTaSDrFMmlZiw5WF2XtqrrOpE8jd846oPNNAneavMDXZ5hvIBVzsa v+4kyLt2VfmjDpFRvCLzCc+yLbIMf1EJK+UJt/QdHGYCzDfIufomYB2yaU/i5TRCiDZf2dV ij68a65QW2ciIPzOAzRkC6jEtO1h5SrHhIVMR31DcJYxn8+CWtsJVAsfhWZQENKF+eWAD/B 6N2OWjQD73HOO4URMwvLaRvnFreo7/nzxFoF+lkbmYnS0SGNQ/ywAMEbihNm9dKbe7EYHfd sraB8uAk5VDwAhtoTnUx9fGtEuNHlFGBiZuF/Gp9kC7D4ROhbKFl5Ghj1ql5ipwJbxA5vK6 vEA4eMoGqLsV+ssHxTcDpdvccQFsJDWueuQMCeBHSOWAQ6KbHB0H05hSX7TCVxNppesHQkm x8R+j0eHQS1sMnxaEBk8NqlpdzPO96Jvy8orIHnCjEuQBS337b3rojmhx1ioK/je/twWzCi DJX9zg5TjfwMentwrd+0drrJaXQQE7p3kEpal55C3XFzadCYGJv+5TzKxVAkwpzKtn86pkr n5PpTmCKkioei5hhxP0Zx3Mn3DV4OdPmbRLz1D4QCMkxNqnVIUGzLksULWvwhqnDlyWfyNr 8xRqAPHArN8LGrPgj6X24HmqgOH7SiGkW7MNEkiw== X-QQ-XMRINFO: Mp0Kj//9VHAxzExpfF+O8yhSrljjwrznVg== X-QQ-RECHKSPAM: 0 After a hibernation snapshot is created, devices are resumed with PMSG_THAW before the image is written and the system is powered off. USB interface driver resume callbacks do not receive the PM event, so they cannot distinguish this phase from PMSG_RESTORE. This series first makes the lifetime represented by in_suspend match the snapshot memory lifetime, then exposes that state through pm_hibernation_snapshot_done(). The helper only exposes the PM state; drivers remain responsible for deciding whether device-specific behavior is safe, including subsequent poweroff or shutdown handling. As the first user, uvcvideo skips only restarting active streaming hardware during the transient THAW phase. Its frozen state and clock are still updated, a subsequent UVC suspend can stop the stream as usual, and uvcvideo does not provide a shutdown callback that requires the streaming hardware to be restarted first. Changes in v3: - Split the in_suspend cleanup into a separate patch, as requested by Rafael. - Reword the helper description to clarify that it only exposes PM state and that callers must account for poweroff/shutdown handling. - Restrict the UVC description to skipping the streaming hardware restart and explain why it does not prevent UVC shutdown handling. - Drop extern from the new prototype to satisfy Media CI checkpatch. Changes in v2: - Rename pm_hibernation_storing_image() to pm_hibernation_snapshot_done(). - Clear in_suspend before releasing snapshot memory on failure paths and after swsusp_write() returns. - Move the UVC check after clearing the frozen state and resetting its clock. Haowen Tu (3): PM: hibernate: clear in_suspend before freeing the snapshot PM: hibernate: add pm_hibernation_snapshot_done() helper media: uvcvideo: skip streaming restart after hibernation snapshot drivers/media/usb/uvc/uvc_video.c | 8 ++++++++ include/linux/suspend.h | 2 ++ kernel/power/hibernate.c | 24 ++++++++++++++++++++---- 3 files changed, 30 insertions(+), 4 deletions(-) -- 2.20.1