From: Oliver O'Halloran <oohall@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Oliver O'Halloran <oohall@gmail.com>
Subject: [PATCH 5/7] powerpc/papr_scm: Fix DIMM device registration race
Date: Fri, 7 Dec 2018 02:17:12 +1100 [thread overview]
Message-ID: <20181206151714.28494-6-oohall@gmail.com> (raw)
In-Reply-To: <20181206151714.28494-1-oohall@gmail.com>
When a new nvdimm device is registered with libnvdimm via
nvdimm_create() it is added as a device on the nvdimm bus. The probe
function for the DIMM driver is potentially quite slow so actually
registering and probing the device is done in an async domain rather
than immediately after device creation. This can result in a race where
the region device (created 2nd) is probed first and fails to activate at
boot.
To fix this we use the same approach as the ACPI/NFIT driver which is to
check that all the DIMM devices registered successfully. LibNVDIMM
provides the nvdimm_bus_count_dimms() function which synchronises with
the async domain and verifies that the dimm was successfully registered
with the bus.
If either of these does not occur then we bail.
Fixes: b5beae5e224f ("powerpc/pseries: Add driver for PAPR SCM regions")
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
arch/powerpc/platforms/pseries/papr_scm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index 90203039dee8..871b386dd4b2 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -223,6 +223,9 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
goto err;
}
+ if (nvdimm_bus_check_dimm_count(p->bus, 1))
+ goto err;
+
/* now add the region */
memset(&mapping, 0, sizeof(mapping));
--
2.17.2
next prev parent reply other threads:[~2018-12-06 15:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 15:17 papr SCM driver fixes Oliver O'Halloran
2018-12-06 15:17 ` [PATCH 1/7] powerpc/papr_scm: Use depend instead of select Oliver O'Halloran
2018-12-10 2:43 ` [1/7] " Michael Ellerman
2018-12-06 15:17 ` [PATCH 2/7] powerpc/papr_scm: Fix resource end address Oliver O'Halloran
2018-12-06 15:17 ` [PATCH 3/7] powerpc/papr_scm: Update DT properties Oliver O'Halloran
2018-12-06 15:17 ` [PATCH 4/7] powerpc/papr_scm: Remove endian conversions Oliver O'Halloran
2018-12-06 15:17 ` Oliver O'Halloran [this message]
2018-12-06 15:17 ` [PATCH 6/7] powerpc/papr_scm: Use ibm,unit-guid as the iset cookie Oliver O'Halloran
2018-12-06 15:17 ` [PATCH 7/7] powerpc/mm: Fallback to RAM if the altmap is unusable Oliver O'Halloran
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=20181206151714.28494-6-oohall@gmail.com \
--to=oohall@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).