archive mirror
 help / color / mirror / Atom feed
* [PATCH] libnvdimm: restore "libnvdimm: band aid btt vs clear poison locking"
@ 2017-05-01 17:19 Dan Williams
  0 siblings, 0 replies; only message in thread
From: Dan Williams @ 2017-05-01 17:19 UTC (permalink / raw)
  To: linux-nvdimm
  Cc: Dave Jiang, Toshi Kani, Vishal Verma, linux-kernel, linux-acpi,
	Jeff Moyer

This continues the 4.11 status quo of disabling of error clearing from
the BTT I/O path. Toshi found that even though we have eliminated all
the libnvdimm sources of sleeping-while-atomic triggers, we still have
sleeping operations that will occur in the path to send the ACPI DSM to
the DIMM to clear the error:

 BUG: sleeping function called from invalid context at mm/slab.h:432
 in_atomic(): 1, irqs_disabled(): 0, pid: 13353, name: dd
 Call Trace:
  acpi_nfit_ctl+0x1ef/0x7c0 [nfit]
  ? nsio_rw_bytes+0x152/0x280
  btt_write_pg+0x1d4/0x3d0 [nd_btt]
  btt_make_request+0x119/0x2d0 [nd_btt]

A solution for tracking and handling media errors natively in the BTT is

Cc: Jeff Moyer <>
Cc: Dave Jiang <>
Cc: Vishal Verma <>
Reported-by: Toshi Kani <>
Signed-off-by: Dan Williams <>
 drivers/nvdimm/claim.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index 35b210dc1e56..6945e35058bf 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -250,7 +250,16 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
 	if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align))) {
-		if (IS_ALIGNED(offset, 512) && IS_ALIGNED(size, 512)) {
+		/*
+		 * FIXME: nsio_rw_bytes() may be called from atomic
+		 * context in the btt case and the ACPI DSM path for
+		 * clearing the error takes sleeping locks and allocates
+		 * memory. An explicit error clearing path, and support
+		 * for tracking badblocks in BTT metadata is needed to
+		 * work around this collision.
+		 */
+		if (IS_ALIGNED(offset, 512) && IS_ALIGNED(size, 512)
+				&& (!ndns->claim || !is_nd_btt(ndns->claim))) {
 			long cleared;
 			cleared = nvdimm_clear_poison(&ndns->dev,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-01 17:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-01 17:19 [PATCH] libnvdimm: restore "libnvdimm: band aid btt vs clear poison locking" Dan Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).