From nobody Sat Jul 25 18:55:14 2026 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCEAC4E3799 for ; Tue, 14 Jul 2026 17:27:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784050074; cv=none; b=WtyOO3tZsyNcSIbRy6JL1A3YT9fH3OOXPuVz5NiVntwNfqChsvgBRRjcNYWmK0sh1k/htPBJ1DDhbCCfzLtbxJxor9YlTKCc4GY+Iv4YoHDpL2oTVYpG5v08OmTvSQqkxC0AinTtZejdPuOEZn1ar5bVTCLk1Dkm/5HaXjO5+Gg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784050074; c=relaxed/simple; bh=f4gRRdyAk0SYh/aGqpacFBqr8KjG0ILqdRvv9QEbvHU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Qe1pjei2MhYj/j2VA8MHoNs6YzLZ/qzHXeF159Wlp/pNxaOjYDAHRkHHaQeVApBCRBZ86IfjzPedJH7SU000lnqq3+i8KOEPbjs4rrTGYDkMlqYHL7BFathlFFl79VDvd5oadZcpaS/2U8Tjaa9fR6WIBEeP8QhnMmRthZc3bIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HSGIiyI0; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HSGIiyI0" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-c9e7391839cso1120193a12.0 for ; Tue, 14 Jul 2026 10:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784050072; x=1784654872; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=hgCzlBG6lq6b/rCZWmhMuZKJx8BuNSqfyPONIcSDu8U=; b=HSGIiyI0sBpo4B2k5vZlWmmeNnwslAFVpFp+zHDEuyu0iNkS48ehg4uWM4wT5ZHCnb P7vlF2dgRXz7DxSFqKiTy88Z8bOH6k4fTDTf5njOIUE8AZ+h++1w2jQBZWq/X6/cGVeP co4KXKDHwrCr0pmaX8l+ZfhpWGx6GLlzgLYE0ep+JGbobaO0FVcGzDtjcofhPaXRb9xz 4vUh2krmWfid2TG69be4jv7K/YLWZQJUNMvkit73zS08scu1Q3OLhL0+WXA13C8TEV9t 7RBdizmLUhsvwltVOVuzIuRkHH618NCJMuopqxxq3HB8pftbFkeOj/PWWfV6zzNyqKCI o/vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784050072; x=1784654872; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hgCzlBG6lq6b/rCZWmhMuZKJx8BuNSqfyPONIcSDu8U=; b=itxtSGL8HE0dWfqAIm2X75XQkHdmt1m0EffCi9OjSZcf+J65uSX3SJa7aNH5iMPd4F jCIdbAmFeQqdOaInl8GJMw137QCtSOmJRfufXjkBh3WI2muvExThhuYJXRrv8DOqMhiW e5klI5Cgl5trWEKjA1v/fzjUDIJuXcS0QRQfVbL7CaCG8a8fW441wgEPKfzpiSWhgCHk pTRrELv+IpEDUsM8EQwGcmzjjU4904LQFLI1wGc6O/UUtljTH2r+mEqBXq6MRTAP8qQI LsNog+OQaujD310n4S8PtmL4pJVQWE1+Xy+/mOzQtieqOmbqsAGrsv/byHNNtlNc4Y8L bGGw== X-Forwarded-Encrypted: i=1; AHgh+RpVloh6dSorbHiSUV50KswOH1ZIS3/djryneE2vK2mYu2jP+DcUDHp33Bso+nPs0OViF6UEri3dKcJNKcQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyU+6tyDD4gIotiufi26EnmmDWK9JGwZsjoBBgBvEWIjQ6Idz37 iIzNMT7k0ixREtn7YeXyVHeW1SAG74JJMrujyU0xOrSpXP6wmKbw34lr X-Gm-Gg: AfdE7cn4BTob77vTHi/iwzpUJPJycmtZMMjvW0sXq2rLOW4Ggidi8rn9faz28RNCIYx oyIu+M9mwoWi6rW/u+koDGbw+NotqWPB5cZ2Ii3awUccUhhVsw8yDpwDuWiJhrFDo7NWwK/xYBf DKE4ATKdbXwLqdpF69RWTZiMpL7sfbSuVsyLtujfxtZvHXQbOjB0wFXB2ZfbDSjcd0mYJ9cT+Z2 BQtTC6cIjtYLPw7csG8gfrIVaWiZ1v3KloR9Sj5Nazx0DqwPc6SE33n0fL98HKAc2tkTvnJ3Jos Osaaz6nwvBO0grF3EuwMGLcHW2z/v83pnyEierJise6+9NaXvKLuVr7UQl6bWQKbbbZiVYSapiH 0LCkxV44rS70v/yhyITyqGwiO61ChC/b+XewbxYB48QBgP9cVLL0cQZsd/FWQyrYr6dgV3pMj7z XO6zgSeP8CUg== X-Received: by 2002:a05:6a20:7346:b0:3b9:545d:c006 with SMTP id adf61e73a8af0-3c110009a30mr16747753637.15.1784050072006; Tue, 14 Jul 2026 10:27:52 -0700 (PDT) Received: from lgs.. ([101.76.249.46]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ca5b3643399sm10684428a12.22.2026.07.14.10.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 10:27:51 -0700 (PDT) From: Guangshuo Li To: Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" , Peter Wang , Bean Huo , Can Guo , Adrian Hunter , Wang Shuaiwei , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Guangshuo Li Subject: [PATCH v2] scsi: ufs: core: cancel RTC work in active-active suspend Date: Wed, 15 Jul 2026 01:27:26 +0800 Message-ID: <20260714172726.1736967-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 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" UFS RTC support schedules ufs_rtc_update_work to periodically update the device RTC. The work can issue query commands and access the UFS host controller. A previous change moved the RTC work cancellation before the PRE_CHANGE vendor suspend callback to close a race in the common suspend path. However, the active-active path jumps directly to vops_suspend after flushing exception handling work and therefore bypasses the cancellation. If the RTC work runs while the vendor suspend callback is gating or otherwise changing hardware state, it can access the controller during suspend and trigger an SError. Cancel the RTC work before entering the vendor suspend callback in the active-active path. Since this path now cancels the work, move the RTC work scheduling outside the device and link state restoration block in the resume path. This restarts RTC updates after an active-active suspend and resume cycle. Fixes: b0bd84c39289 ("scsi: ufs: core: Fix SError in ufshcd_rtc_work() duri= ng UFS suspend") Signed-off-by: Guangshuo Li Reviewed-by: Bart Van Assche Reviewed-by: Bean Huo Reviewed-by: Peter Wang --- v2: - Correct the Fixes tag. - Restart the RTC update work from the common resume path. drivers/ufs/core/ufshcd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index d3044a3089b5..c3b105b2678e 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10269,6 +10269,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba,= enum ufs_pm_op pm_op) req_link_state =3D=3D UIC_LINK_ACTIVE_STATE) { ufshcd_disable_auto_bkops(hba); flush_work(&hba->eeh_work); + cancel_delayed_work_sync(&hba->ufs_rtc_update_work); goto vops_suspend; } =20 @@ -10478,10 +10479,11 @@ static int __ufshcd_wl_resume(struct ufs_hba *hba= , enum ufs_pm_op pm_op) if (ret) goto set_old_link_state; ufshcd_set_timestamp_attr(hba); - schedule_delayed_work(&hba->ufs_rtc_update_work, - msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS)); } =20 + schedule_delayed_work(&hba->ufs_rtc_update_work, + msecs_to_jiffies(UFS_RTC_UPDATE_INTERVAL_MS)); + if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) ufshcd_enable_auto_bkops(hba); else --=20 2.43.0