From: Shawn Lin <shawn.lin@rock-chips.com>
To: Ulf Hansson <ulfh@kernel.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Shawn Lin <shawn.lin@rock-chips.com>
Subject: [PATCH 4/4] mmc: dw_mmc: expose the watchdog state in debugfs
Date: Thu, 27 Aug 2026 15:58:06 +0800 [thread overview]
Message-ID: <1787817486-137277-5-git-send-email-shawn.lin@rock-chips.com> (raw)
In-Reply-To: <1787817486-137277-1-git-send-email-shawn.lin@rock-chips.com>
Debugging hangs on the request legs now means asking 'what was the
watchdog guarding and until when?' Expose the awaited events, the
valid states, and the absolute deadline of the current watch next to
the existing pending_events/completed_events nodes; all three zero out
once a leg is settled or the watch fired.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/mmc/host/dw_mmc.c | 6 ++++++
drivers/mmc/host/dw_mmc.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 6852c05..ff0b25d 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -108,6 +108,7 @@ static void dw_mci_wd_arm(struct dw_mci *host, unsigned long ms,
host->wd_events = events;
host->wd_states = states;
+ host->wd_deadline_ns = ktime_get_ns() + (u64)ms * NSEC_PER_MSEC;
hrtimer_start(&host->wd_timer, ms_to_ktime(ms), HRTIMER_MODE_REL);
}
@@ -167,6 +168,7 @@ static enum hrtimer_restart dw_mci_watchdog_fn(struct hrtimer *t)
host->wd_events = 0;
host->wd_states = 0;
+ host->wd_deadline_ns = 0;
spin_unlock_irqrestore(&host->irq_lock, irqflags);
@@ -300,6 +302,10 @@ static void dw_mci_init_debugfs(struct dw_mci *host)
&host->pending_events);
debugfs_create_xul("completed_events", 0400, root,
&host->completed_events);
+ debugfs_create_x64("wd_deadline_ns", 0400, root,
+ &host->wd_deadline_ns);
+ debugfs_create_xul("wd_events", 0400, root, &host->wd_events);
+ debugfs_create_xul("wd_states", 0400, root, &host->wd_states);
#ifdef CONFIG_FAULT_INJECTION
fault_create_debugfs_attr("fail_data_crc", root, &host->fail_data_crc);
#endif
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 7b70392..12b88e7 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -240,6 +240,7 @@ struct dw_mci {
struct hrtimer wd_timer;
unsigned long wd_events;
unsigned long wd_states;
+ u64 wd_deadline_ns;
#ifdef CONFIG_FAULT_INJECTION
struct fault_attr fail_data_crc;
--
2.7.4
next prev parent reply other threads:[~2026-08-27 9:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 7:58 [PATCH 0/4] mmc: dw_mmc: replace three fallback timers with a single watchdog Shawn Lin
2026-08-27 7:58 ` [PATCH 1/4] mmc: dw_mmc: add central watchdog and convert CTO onto it Shawn Lin
2026-08-27 7:58 ` [PATCH 2/4] mmc: dw_mmc: convert DTO onto the central watchdog Shawn Lin
2026-08-27 7:58 ` [PATCH 3/4] mmc: dw_mmc: absorb CMD11 timeout into " Shawn Lin
2026-08-27 7:58 ` Shawn Lin [this message]
2026-09-10 16:05 ` [PATCH 0/4] mmc: dw_mmc: replace three fallback timers with a single watchdog Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1787817486-137277-5-git-send-email-shawn.lin@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=jh80.chung@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=ulfh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox