Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Dec 2025 14:17:22 +0000
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1fad49baf390 - main - sdhci: Try to complete the last transaction if dumping
Message-ID:  <6942bb72.39406.4933958a@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=1fad49baf390cb52f238e6c352d0bc0893c008c3

commit 1fad49baf390cb52f238e6c352d0bc0893c008c3
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2025-12-17 14:15:40 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2025-12-17 14:17:06 +0000

    sdhci: Try to complete the last transaction if dumping
    
    If the kernel panics while a thread is in the middle of an SDHCI
    transaction, trying to dump to a dump target on the MMC would result in
    a hang.  Fix this by completing the transaction first.
    
    Reviewed by:    imp
    Obtained from:  Hewlett Packard Enterprise
    Differential Revision:  https://reviews.freebsd.org/D54255
---
 sys/dev/sdhci/sdhci.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c
index b53b85bf44c2..0426d9d27916 100644
--- a/sys/dev/sdhci/sdhci.c
+++ b/sys/dev/sdhci/sdhci.c
@@ -2183,6 +2183,18 @@ sdhci_generic_acquire_host(device_t brdev __unused, device_t reqdev)
 	int err = 0;
 
 	SDHCI_LOCK(slot);
+	/*
+	 * If the bus is busy at dump time, it may have stopped in the middle of
+	 * a transaction.  Try to complete that transaction before continuing.
+	 */
+	if (slot->bus_busy && dumping) {
+		SDHCI_UNLOCK(slot);
+		while (slot->req != NULL) {
+			sdhci_generic_intr(slot);
+			DELAY(10);
+		}
+		return (0);
+	}
 	while (slot->bus_busy)
 		msleep(slot, &slot->mtx, 0, "sdhciah", 0);
 	slot->bus_busy++;


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6942bb72.39406.4933958a>