public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] mmc: Add pstore backend for crash dump storage on eMMC
@ 2026-03-19 18:57 Kamal Dasu
  2026-03-19 18:57 ` [PATCH v3 1/4] mmc: core: Add panic-context host operations for pstore backends Kamal Dasu
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Kamal Dasu @ 2026-03-19 18:57 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter, Kees Cook
  Cc: Tony Luck, Guilherme G . Piccoli, Florian Fainelli,
	Arend van Spriel, William Zhang, bcm-kernel-feedback-list,
	linux-mmc, linux-kernel, Kamal Dasu

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=[UTF-8], Size: 3702 bytes --]

This series adds mmcpstore, a pstore backend driver that enables
persistent storage of kernel crash logs on eMMC devices. When the
kernel panics, pstore captures the kmsg dump and writes it directly
to a dedicated MMC partition using polled I/O with interrupts
disabled.

Changes since v2 (RFC):
- Rebased onto v7.0-rc — no longer reverts any existing MMC core
  or SDHCI changes (v1/v2 accidentally reverted recent upstream
  commits due to being based on an older tree)
- Removed all erase/bitmap tracking logic — MMC/eMMC is managed
  flash and does not need erase-before-write; the pstore_zone
  framework handles zone management internally
- Uses standard MMC core request path (mmc_start_request) instead
  of hand-building mmc_request structs; panic-context I/O is
  handled through proper mmc_host_ops callbacks rather than ad-hoc
  code in the driver
- Added panic-context ops to mmc_host_ops and sdhci_ops for clean
  separation of panic and normal I/O paths
- Fixed deadlocks caused by spinlock contention during panic
  (lockless mmc_panic_claim_host using WRITE_ONCE)
- Fixed data corruption in pstore recovery (zlib_inflate failures)
  by letting the normal sdhci_request() path run instead of a
  custom panic request handler
- Added PM suspend/resume support with eMMC re-initialization
- Supports module loading or builtin loading of the driver
- Added MAINTAINERS entry
- Split into 4-patch series for reviewability

The series is structured as follows:

Patch 1 adds panic-context operations to struct mmc_host_ops and a
lockless mmc_panic_claim_host() for use during kernel panic when
other CPUs are stopped and may hold locks.

Patch 2 implements these panic-context operations in the SDHCI host
controller driver: draining in-flight requests, polling for
completion, and making the command retry path panic-safe.

Patch 3 adds mmc_blk_get_card_by_name() helper to look up an
mmc_card from a block device name, used by the mmcpstore module
path for card discovery.

Patch 4 adds the mmcpstore driver itself, which registers with the
pstore_blk framework and handles panic writes, PM suspend/resume,
and dual-path registration (direct probe hook for builtin,
mmc_blk_get_card_by_name() for module). Also adds probe/remove
hooks in block.c and declarations in block.h for the builtin path.

Tested on Broadcom STB platforms (ARM64) with SDHCI controllers,
verified panic dump recovery across multiple panic/reboot cycles
with kmsg, pmsg, and console pstore.

Previous submissions and related work:
  RFC v1: https://lore.kernel.org/linux-mmc/20221216212738.7928-1-kdasu.kdev@gmail.com/
  RFC v2: https://lore.kernel.org/linux-mmc/20221222185948.12717-1-kdasu.kdev@gmail.com/
  Marvell MMC pstore attempt (2020):
    https://lore.kernel.org/linux-mmc/20201207115753.21728-1-bbudiredla@marvell.com/
  pstore/blk documentation:
    https://www.kernel.org/doc/html/latest/admin-guide/pstore-blk.html

Kamal Dasu (4):
  mmc: core: Add panic-context host operations for pstore backends
  mmc: sdhci: Implement panic-context write support
  mmc: block: Add helper to look up mmc_card by device name
  mmc: core: Add MMC pstore backend driver

 MAINTAINERS                  |    6 +
 drivers/mmc/core/Kconfig     |   12 +
 drivers/mmc/core/Makefile    |    1 +
 drivers/mmc/core/block.c     |   56 ++
 drivers/mmc/core/block.h     |   18 +
 drivers/mmc/core/core.c      |   23 +
 drivers/mmc/core/mmcpstore.c | 1512 ++++++++++++++++++++++++++++++++++
 drivers/mmc/host/sdhci.c     |  164 +++-
 drivers/mmc/host/sdhci.h     |    6 +
 include/linux/mmc/host.h     |   12 +
 10 files changed, 1806 insertions(+), 4 deletions(-)
 create mode 100644 drivers/mmc/core/mmcpstore.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-03-20 16:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 18:57 [PATCH v3 0/4] mmc: Add pstore backend for crash dump storage on eMMC Kamal Dasu
2026-03-19 18:57 ` [PATCH v3 1/4] mmc: core: Add panic-context host operations for pstore backends Kamal Dasu
2026-03-19 18:57 ` [PATCH v3 2/4] mmc: sdhci: Implement panic-context write support Kamal Dasu
2026-03-20  3:40   ` kernel test robot
2026-03-20 16:22   ` kernel test robot
2026-03-19 18:57 ` [PATCH v3 3/4] mmc: block: Add helper to look up mmc_card by device name Kamal Dasu
2026-03-19 18:57 ` [PATCH v3 4/4] mmc: core: Add MMC pstore backend driver Kamal Dasu
2026-03-19 20:59   ` Kees Cook
2026-03-20 15:17   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox