From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793862922; b=AeZ13/U+wBbfbZ9Ut92uSE2CB8VUgxHqj3fUBOO19gzT01/YhYGOL7xno3YZQwxX+99U EU/oxwIFDdwvoKm6R1x0VEFYjU/49DS6usJjVexrx8PaVynYu/x+XLBhjUFjNnBBCpVFX bj0mYvwzQ1qawp7Q8gwB6OAJtKVDSAUPpmKFvCJD8cuhGzz/EUY3jIItZWQSJBMpv2fzU 4f9zECh7QnaT8dDwOfFLrMiqq8gYZ4mgWfbvaqjinVLGK+wWPooaTpQ8X96hlAqH88ODQ wddnqGM9uYpNjNDNF00BrLEBE4Ex9m6kqF8TEVF3U13zonGwWw6N9MdEnsu4Qn1t8Og== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793862922; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:Mime-Version: X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=SW9ZPipNuscFWkNo5bCucZS2yHxtHk2aYOPHX7h5/6s=; b=C1OokjdPYQ+X/zWPh2itqnHMSl3ggrXBp6ZJLONijkSXiLwhmgSQxw1KyyHcF68KEb7G DP89ZaiWP11lEhr0MfHvsu99mUXBrqlXvYHsK1r2KubpKW/0jVUcw33Un3JxcOQF+mC/X m5oRvAd2tZFx1ic6HoqYafL3Lrb5SBeqGx0cygRQVUqK2ov7co65XcQ2FilX1lyVPHnG3 ck4dLUrk3Nh6RdUx94h+rGyYTCKg3uYnSdG4sEaq/v80vex+wVcp8a/mkOyDR1S81xgIQ 1jBQZc9r87pkJz5BJsQO4DpiDK9KExnEEqC8GwamOA8t0PLV2hntragztPD/XvplPjA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--stanleyjhu.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=gR3EVBc5; arc=none smtp.remote-ip=74.125.82.71 Received: from mail-dl1-f71.google.com (mail-dl1-f71.google.com [74.125.82.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A5D2606A32C for ; Thu, 5 Nov 2026 07:15:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2A5D2606A32C 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--stanleyjhu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=gR3EVBc5 Received: by mail-dl1-f71.google.com with SMTP id a92af1059eb24-14373747468so3462706c88.1 for ; Wed, 04 Nov 2026 23:15:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1793862921; x=1794467721; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=SW9ZPipNuscFWkNo5bCucZS2yHxtHk2aYOPHX7h5/6s=; b=gR3EVBc5cwBFGiZJEZhn3p+sOuzdvOSrBVvARK2Q7ODF9k4n8HTazz+zu3CQgwr2Nq eeMf+dAHqvSP0dr4/5ZPNxMJUYR9z1nIZLBwjIJuAnhyf88TF8VJg/7Ky8kkqqPIxuIE vkmHjbdPpPEX1pEayx/o8z+UOiZzqsyTmSjwPfiDYVvO3TAbhgqc9LgqofOVWHi5zbiS 7JrKr4MAd7U2sFAYUfUQ3bpzAGgx3+cil8Bx1q71UFnfeuy7po/D6xamRP4yFPCZCoNm sEdjdaCpY7+Jw0g2rqw0pDiUS13ZIUh9sZgYu+o0UZJiye0FjEHXXTeGR0Yec4rA70dS LzXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793862921; x=1794467721; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=SW9ZPipNuscFWkNo5bCucZS2yHxtHk2aYOPHX7h5/6s=; b=rXh3yJXNV/tbLp45Hda8DDoxJQE7NDWnRIpouKZNXqM1YH0YrJUa/U/wYpvHokBWaB O9EVHFJ5BpObcWWfsOIxdrlKLtSsLFoqk8LFdp7KICnlP6RbKTOp0AGPJQj+RbBCuxoH dJh1Er0A4xm3LKQ9L2Jygm1fS7uXj2w4KrA8rRrHz3jY468xKJl5DQbsRuExGi/BEqG3 tVIKgz+dv4wHF4euRlPlrDTME2g2NGjlIFMLLvleXw+flZ0eBC/hywOlGbUx1tPPGIVX Fv5ypiqwCfbVkLX8ljFxAeaH5NGYoXRv5Q79IJYXBAWrmk6Nxo5ZNDtNwDl6zYUK8eBD LaaA== X-Forwarded-Encrypted: i=1; AKwUvBwNk1Ubea8PcGGD3tvskuJXhVSx0TfXO7yP+tUGPdZzTVXFEq/37uiulKDZKD2FvtHTWBo3uNIuLtSRuu4=@vger.kernel.org X-Gm-Message-State: APuU4Z8s15ildWUSKzLxsHLz9Kk6YNxTJ9jqtCHK05O3afkD5yA7xHcA TOtVacPsBI8NWWheCAUXTgpUKiyxEo1XV53JUj4TKTv5adzicvMRJYMJ8bsqQANQ8H7OC60UXV+ UOlWNt+Y/Fv05gFxMISy9NQ== X-Received: from dldyr6-n2.prod.google.com ([2002:a05:701b:4506:20b0:1b2:48db:23f6]) (user=stanleyjhu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:701b:2702:b0:143:5cb4:30 with SMTP id a92af1059eb24-1ac5577508cmr25171030c88.3.1793862920763; Wed, 04 Nov 2026 23:15:20 -0800 (PST) Date: Thu, 5 Nov 2026 15:15:16 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 X-Mailer: git-send-email 2.56.0.398.g882cbad275-goog Message-ID: <20261105071518.1458428-1-stanleyjhu@google.com> Subject: [PATCH 0/2] scsi: ufs: core: Fix post-reset runtime PM recovery after eef1d74bf88f From: Stanley Jhu To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: Alim Akhtar , Bart Van Assche , Bean Huo , Brian Norris , Can Guo , Peter Wang , John Garry , "Rafael J . Wysocki" , Praveen Talari , linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Stanley Jhu Content-Type: text/plain; charset="UTF-8" Since commit eef1d74bf88f ("PM: runtime: Only set runtime_error on suspend callback failures"), rpm_resume() resets ufs_device_wlun to RPM_SUSPENDED and leaves power.runtime_error at 0 when W-LUN runtime resume fails. When error handling subsequently resets and restores the host and link, two runtime PM recovery gaps are exposed: 1. ufshcd_err_handling_prepare() calls ufshcd_vops_resume() while ufs_device_wlun remains RPM_SUSPENDED, so the next ufs_device_wlun runtime resume calls ufshcd_vops_resume() a second consecutive time without an intervening ufshcd_vops_suspend(), leaking core_clk and iface_clk enable counts in ufs_qcom_resume() via qcom_ice_resume(). 2. ufshcd_recover_pm_error() checks only power.runtime_error and skips consumer queue recovery, leaving waking I/O blocked in __bio_queue_enter() until another request touches the same queue. Patch 1 tracks POST_CHANGE variant suspend state in hba->is_vops_suspended so ufshcd_vops_resume() pairs 1:1 with ufshcd_vops_suspend() across error recovery. Patch 2 wakes consumer request queues when ufs_device_wlun is runtime-suspended in ufshcd_recover_pm_error() so consumer pm_request_resume() resumes ufs_device_wlun via the runtime PM device link. This series applies on top of two prerequisite patches so repeated post-failure W-LUN runtime resumes keep wlun q->pm_only and clk_gating.active_reqs balanced: - Message-ID: <20261104112744.1630864-1-stanleyjhu@google.com> ("[PATCH v2] block: Keep RPM_ACTIVE in blk_pre_runtime_resume() when already active") - Message-ID: <20261029040002.2100002-1-stanleyjhu@google.com> ("scsi: ufs: core: Keep clock-gating hold on failed W-LUN runtime resume") Tested: QEMU ARM64 UFS in SDB and MCQ modes with injected W-LUN runtime-resume START STOP UNIT and fatal UIC error recovery, verifying immediate consumer wake, 1:1 variant suspend/resume pairing, and idle clock gating. Stanley Jhu (2): scsi: ufs: core: Skip redundant variant resume after error recovery power-up scsi: ufs: core: Wake consumer queues on suspended W-LUN recovery drivers/ufs/core/ufshcd-priv.h | 21 ++++++++++++++++----- drivers/ufs/core/ufshcd.c | 4 +++- include/ufs/ufshcd.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-) -- 2.56.0.385.gac671c819a-goog