From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpbg151.qq.com (smtpbg151.qq.com [18.169.211.239]) (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 52C673C09E8 for ; Wed, 29 Jul 2026 07:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=18.169.211.239 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785309157; cv=none; b=XLB6F9bqgQbZHeP7wY2vme1KKSo/ZPKSRHeSf868WZBaKUjdA6ne5hUIW2C71D9UQ9wmiDwWQ8rmHe2OmPEfYJ/7a5b69Fy6XS5FUDMFUhyPboM62W/f1MdAZXHnMyW3aFVHH/KK1Ypif75u+DTFYRLkZPfFhsVvQbG5bGPz6FA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785309157; c=relaxed/simple; bh=I5qTtsts4ePqKS+GLEYxvXdrZHtppnKWgD7Qi8HNo7M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HBFPxFHmrwue5QJX+zLiew0CyXlMSX+3cICjOYx/0rgjBExdkdg+VwNZO2Km7q3Y7mUjkXNRGcKc9gynxt4MGUV4GXryE1sPpS6BCyrLDFWAzSTiHbnepaiqsMkRQGhhHsA3spETU6NP0kSAQ8jJcqXHgkNVxIP+4N/UbfBBZg0= 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=AqlE7bJZ; arc=none smtp.client-ip=18.169.211.239 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="AqlE7bJZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1785309105; bh=5xOVCFXEtbG3EQktKJ1PgZ4txTWTZ/R+7K3pkeRkDpo=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=AqlE7bJZ71wb2cbGj+1rz0VYG0Bz25XdWq1qUNi+3MER1arp63Mf802XCV8+2Cne6 iO/uWSn0BTB7PXl0mPBfJVvOCAOlMKdSFcWKM85TwiFUEz4c3oXloO1QX5/UgZHvoJ ZxMIxvgvaYXpZKZK3kOyicA+iCPasVKWWGsMyl9Q= X-QQ-mid: zesmtpgz6t1785309091t976a8b4c X-QQ-Originating-IP: OsBCyYmP33cesME96eJoZFMj5XpVPT7ejjN9Dl4ojTk= Received: from localhost.localdomain ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 29 Jul 2026 15:11:28 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 9183807335896332137 EX-QQ-RecipientCnt: 15 From: Haowen Tu To: laurent.pinchart@ideasonboard.com, rafael@kernel.org Cc: gregkh@linuxfoundation.org, hansg@kernel.org, kernel@uniontech.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, tuhaowen@uniontech.com Subject: [PATCH v4 0/4] PM: hibernate: defer UVC streaming restart after snapshot Date: Wed, 29 Jul 2026 15:11:19 +0800 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: <20260723084633.GE648629@killaraus.ideasonboard.com> References: <20260723084633.GE648629@killaraus.ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.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88y9/5iMzQihH1Ffl HoTaJvOOsDLiVq0TufBqeytr1lrQ3AUXMtqxqTj02iNAiryNa8QxlCZ7H4NlAETYR+ROgk+ 5WQ2WgsFSx4yGm1t8hIDi8jtdrNMQlR+iRMXj0Gw== X-QQ-XMRINFO: NI4Ajvh11aEjEMj13RCX7UuhPEoou2bs1g== X-QQ-RECHKSPAM: 0 During hibernation, after the memory snapshot has been created, the kernel resumes devices with PMSG_THAW to write the hibernation image. USB interface resume callbacks do not receive the PM message, so UVC cannot distinguish that intermediate THAW resume from the later RESTORE resume by using its local callback arguments. This series keeps in_suspend consistent with the lifetime of snapshot memory, exports pm_hibernation_snapshot_done(), adds a hibernation image write failure notification, and uses both in uvcvideo to defer restarting streaming during the THAW phase after snapshot creation. Unlike v3, the UVC patch now handles the image write failure path. The driver records streams whose streaming restart was deferred. If image writeout fails, PM sends PM_HIBERNATION_IMAGE_WRITE_FAILED after swsusp_write() returns and before userspace is thawed, and uvcvideo restarts those deferred streams. If the recovery restart fails, the driver falls back to its existing streamoff error path so userspace is not left waiting indefinitely. Changes in v4: - Add PM_HIBERNATION_IMAGE_WRITE_FAILED before userspace thaw on image write failure. - Update uvcvideo to defer streaming restart instead of just skipping it. - Recover deferred UVC streams on image write failure. - Carry Rafael's Acked-by tags on the two PM patches from v3. Haowen Tu (4): PM: hibernate: clear in_suspend before freeing the snapshot PM: hibernate: add pm_hibernation_snapshot_done() helper PM: hibernate: notify on image write failure media: uvcvideo: defer streaming restart after hibernation snapshot drivers/media/usb/uvc/uvc_driver.c | 56 +++++++++++++++++++++++++++++- drivers/media/usb/uvc/uvc_video.c | 19 +++++++++- drivers/media/usb/uvc/uvcvideo.h | 2 ++ include/linux/suspend.h | 3 ++ kernel/power/hibernate.c | 27 +++++++++++--- 5 files changed, 101 insertions(+), 6 deletions(-) -- 2.20.1