From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 C85FB33F8DA for ; Thu, 29 Jan 2026 16:52:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769705560; cv=none; b=mUcUE1DjqSdCSVqWjEPTGZ1SqeSehBytugE84DDM1A0JeuWiSIcOe6axPmFWJFqrbgbkd33uw2jWaezm4RPcwWSNdWnNrULm34IGPcgoA/st08GAkT1PP1VNsh87QKHdDeTumpPa/0wzdSQWTQ2CNH+BTha+ykbDRWA0jIwjlEY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769705560; c=relaxed/simple; bh=B1MPTM/kJP5aRghCWlM0TtdejrUwSpsLDbd7d2LgvqE=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=aY3E17P62wAl5okjqsOOphjLwLQFV85fVKBDN2NZagqrtfC62n7XLt4jurrHkgIJzfPq+oOiUjEl5VOkOBQ581B3dpX6No4WaIba9UPVrUz/DdI1zh6Q/EbGGp2S/INd5o4jgxdprIwgFfEKoQcjHybaBKjeYwBSRW9LVVf1o5g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--thomasyen.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=bNwmq8wy; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--thomasyen.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bNwmq8wy" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-352ec74a925so2095799a91.2 for ; Thu, 29 Jan 2026 08:52:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769705558; x=1770310358; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=xcI8KLWScQWADlApPVsSl8lWzsA1EUoFkehAyhaBPxM=; b=bNwmq8wyFYJMZ0neaxdFwkcnXta0wpe21vKFaIUtdA93jw2ttSVtfY8LBsSLnxaK8O miilxEuSKXfmSk+Stv2M6anfMbIpmhvHv7atm9N7TKXvsH6a5+kk46ZjT/XOjWTA3Xk1 fcvTCB+pzXiTodOI+yNiig9bF0SdntWNGNCdA7hHWj+jYZkR2Cr+ELAMM6a/LjlGCTwE LZDRRkeAO3VuPtUEaX8sev9d00ZnQoUrkfR32dEbF03AHMLW/oVlCo53jhdBaKr57Jkg PE6KQcaJKOpoaENMPcu4u873Bjn+G9IAusQ+Pwr8kRTgE9FUx2Al9cJZkmN4XfvXQDA5 KPxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769705558; x=1770310358; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=xcI8KLWScQWADlApPVsSl8lWzsA1EUoFkehAyhaBPxM=; b=mzDH8oG6Q+wpLOBOHiyJuYrNw71ZWcz+W6f3jRu1Ez7I2AVRmmIJ5hYvru1jlYSwmG bLilOchcZdc+8f9RHm46SV0Cf8Kr6cMkmA7PihQQQ6F25JxeG5bMjfgMiQaCHc1wXBYq 0TPYzSkbCtODqCuuA3mHrOXgTwn2UN2a0Au6fedJzIJsYSL4S81qPvbQzFEBHdNh8sVu w0Ggcd5zyc1yckfMoOvRLufq0AC+5IiczAUKZ7Kp2k8zFyl6zvjXPzXTXp9rzpgAGaTV /ZdhwVsu3HWkYpRJ7l+pw5avn5YQMKxWTQb4hmiK8LuK0/ESlH2h2eiDAGVqNvFMNEd+ 6cVg== X-Forwarded-Encrypted: i=1; AJvYcCUy81ntMkR9R1TlwxBWAjrjYkrbdhUJoOsU2aXR82m7WkgCO8HZG1+OP0td7im0+ub2cWziU+cPFuEfoes=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7gcTm19D3aVTF7eUYWJt6BE1gEYmpVdVRmxlKclaCWqBa8YS0 8w8D37O5+5xWusK9Yw1pYw/xTfB+LEfsIspTU4kIV0afMfEbpxU4mCsmVaJiB5htGIxZiIr+NcI h0B0AwZeQ0E25Or/2Dw== X-Received: from pgg10.prod.google.com ([2002:a05:6a02:4d8a:b0:bc4:233b:be04]) (user=thomasyen job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:b82:b0:364:13ab:4119 with SMTP id adf61e73a8af0-38ec628953cmr8347913637.15.1769705557995; Thu, 29 Jan 2026 08:52:37 -0800 (PST) Date: Fri, 30 Jan 2026 00:51:51 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.53.0.rc1.225.gd81095ad13-goog Message-ID: <20260129165156.956601-1-thomasyen@google.com> Subject: [PATCH v4 1/1] scsi: ufs: core: Flush exception handling work when RPM level is zero From: Thomas Yen To: martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com Cc: Thomas Yen , Stable Tree , Alim Akhtar , Avri Altman , Bart Van Assche , Peter Wang , Bean Huo , Adrian Hunter , "Bao D. Nguyen" , Subhash Jadavani , Dolev Raviv , Sujit Reddy Thumma , "open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER" , open list Content-Type: text/plain; charset="UTF-8" Ensure that the exception event handling work is explicitly flushed during suspend when the runtime power management level is set to UFS_PM_LVL_0. When the RPM level is zero, the device power mode and link state both remain active. Previously, the UFS core driver bypassed flushing exception event handling jobs in this configuration. This created a race condition where the driver could attempt to access the host controller to handle an exception after the system had already entered a deep power-down state, resulting in a system crash. Explicitly flush this work and disable auto BKOPs before the suspend callback proceeds. This guarantees that pending exception tasks complete and prevents illegal hardware access during the power-down sequence. Fixes: 57d104c153d3 ("scsi: ufs: ufshcd: Fix link state during system suspend") Signed-off-by: Thomas Yen Cc: Stable Tree --- v4: - Add Fixes tag. v3: - Add logic to disable BKOPs. v2: - Add Cc: stable tag. - Reformat commit message text for better line wrapping. drivers/ufs/core/ufshcd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 0369043ca010..8c88dd5c2cca 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9997,6 +9997,8 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) if (req_dev_pwr_mode == UFS_ACTIVE_PWR_MODE && req_link_state == UIC_LINK_ACTIVE_STATE) { + ufshcd_disable_auto_bkops(hba); + flush_work(&hba->eeh_work); goto vops_suspend; } base-commit: a48ca06cf343423faa01c573aeafba9fa5f92577 -- 2.53.0.rc1.225.gd81095ad13-goog