From: Alison Schofield <alison.schofield@intel.com>
To: Avi Weiss <thnkslprpt@gmail.com>
Cc: <djbw@kernel.org>, <vishal.l.verma@intel.com>,
<dave.jiang@intel.com>, <iweiny@kernel.org>,
<nvdimm@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] nvdimm/pmem: propagate personality discovery errors
Date: Wed, 2 Dec 2026 15:56:23 -0800 [thread overview]
Message-ID: <axCwJ--9bVAmkOGT@aschofie-mobl2.lan> (raw)
In-Reply-To: <20261108082115.2029038-2-thnkslprpt@gmail.com>
On Sun, Nov 08, 2026 at 10:21:16AM +0200, Avi Weiss wrote:
> nd_pmem_probe() ignores errors from BTT discovery and only propagates
> -EOPNOTSUPP from PFN and DAX discovery. Allocation failures can therefore
> be mistaken for an absent personality, allowing a namespace to fall back
> to raw PMEM.
>
> Report -ENOMEM when allocating the BTT, PFN, or DAX info-block buffer
> fails, retaining the existing device cleanup paths. Propagate discovery
> errors other than -ENODEV and -ENXIO, and keep raw-PMEM fallback for
> those two error codes.
Hi Avi,
Thanks for the updates from v1.
This has checkpatch errors, trailing whitespace, and renders some code
dead, so it'll need another rev. Please go ahead and rebase on 7.4-rc5.
I had a conflict applying your rc1 based version because there were
tree-wide changes to the devm_kalloc helpers in rc2.
FYI - 4dd10fbbeb9c treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family
>
> Fixes: 8c2f7e8658df ("libnvdimm: infrastructure for btt devices")
> Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
> ---
>
> v2:
> - return -ENOMEM for BTT, PFN, and DAX superblock buffer
> allocation failures, retaining the existing cleanup paths
> - correct/clarify the comment describing raw-PMEM fallback and
> namespace-seed advancement
> - rebase to v7.4-rc1
>
> drivers/nvdimm/btt_devs.c | 4 +++-
> drivers/nvdimm/dax_devs.c | 4 +++-
> drivers/nvdimm/pfn_devs.c | 4 +++-
> drivers/nvdimm/pmem.c | 19 ++++++++-----------
> 4 files changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c
> index d6b2f157368f6..c3c5cb686743b 100644
> --- a/drivers/nvdimm/btt_devs.c
> +++ b/drivers/nvdimm/btt_devs.c
> @@ -349,7 +349,9 @@ int nd_btt_probe(struct device *dev, struct nd_namespace_common *ndns)
> if (!btt_dev)
> return -ENOMEM;
> btt_sb = devm_kzalloc(dev, sizeof(*btt_sb), GFP_KERNEL);
> - rc = __nd_btt_probe(to_nd_btt(btt_dev), ndns, btt_sb);
> + rc = -ENOMEM;
> + if (btt_sb)
> + rc = __nd_btt_probe(to_nd_btt(btt_dev), ndns, btt_sb);
This check makes the btt_sb test in __nd_btt_probe() dead code.
The pfn_sb test in nd_pfn_validate() is dead now too.
-- Alison
> dev_dbg(dev, "btt: %s\n", rc == 0 ? dev_name(btt_dev) : "<none>");
> if (rc < 0) {
> struct nd_btt *nd_btt = to_nd_btt(btt_dev);
> diff --git a/drivers/nvdimm/dax_devs.c b/drivers/nvdimm/dax_devs.c
> index decc70f2fe3ff..4d4048578efac 100644
> --- a/drivers/nvdimm/dax_devs.c
> +++ b/drivers/nvdimm/dax_devs.c
> @@ -113,7 +113,9 @@ int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns)
> pfn_sb = devm_kmalloc(dev, sizeof(*pfn_sb), GFP_KERNEL);
> nd_pfn = &nd_dax->nd_pfn;
> nd_pfn->pfn_sb = pfn_sb;
> - rc = nd_pfn_validate(nd_pfn, DAX_SIG);
> + rc = -ENOMEM;
> + if (pfn_sb)
> + rc = nd_pfn_validate(nd_pfn, DAX_SIG);
> dev_dbg(dev, "dax: %s\n", rc == 0 ? dev_name(dax_dev) : "<none>");
> if (rc < 0) {
> nd_detach_ndns(dax_dev, &nd_pfn->ndns);
> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> index 8fa9c16aba7ea..39b8d5eed7ef5 100644
> --- a/drivers/nvdimm/pfn_devs.c
> +++ b/drivers/nvdimm/pfn_devs.c
> @@ -637,7 +637,9 @@ int nd_pfn_probe(struct device *dev, struct nd_namespace_common *ndns)
> pfn_sb = devm_kmalloc(dev, sizeof(*pfn_sb), GFP_KERNEL);
> nd_pfn = to_nd_pfn(pfn_dev);
> nd_pfn->pfn_sb = pfn_sb;
> - rc = nd_pfn_validate(nd_pfn, PFN_SIG);
> + rc = -ENOMEM;
> + if (pfn_sb)
> + rc = nd_pfn_validate(nd_pfn, PFN_SIG);
> dev_dbg(dev, "pfn: %s\n", rc == 0 ? dev_name(pfn_dev) : "<none>");
> if (rc < 0) {
> nd_detach_ndns(pfn_dev, &nd_pfn->ndns);
> diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> index 0766a6949b285..efdb804ad5d78 100644
> --- a/drivers/nvdimm/pmem.c
> +++ b/drivers/nvdimm/pmem.c
> @@ -632,28 +632,25 @@ static int nd_pmem_probe(struct device *dev)
> ret = nd_btt_probe(dev, ndns);
> if (ret == 0)
> return -ENXIO;
> + else if (ret != -ENODEV && ret != -ENXIO)
> + return ret;
>
> /*
> - * We have two failure conditions here, there is no
> - * info reserver block or we found a valid info reserve block
> - * but failed to initialize the pfn superblock.
> - *
> - * For the first case consider namespace as a raw pmem namespace
> - * and attach a disk.
> - *
> - * For the latter, consider this a success and advance the namespace
> - * seed.
> + * An absent or unreadable PFN/DAX info block allows probing the
> + * next personality or falling back to raw PMEM. Other errors
> + * are propagated, including -EOPNOTSUPP, which causes
> + * nvdimm_bus_probe() to advance the namespace seed.
> */
> ret = nd_pfn_probe(dev, ndns);
> if (ret == 0)
> return -ENXIO;
> - else if (ret == -EOPNOTSUPP)
> + else if (ret != -ENODEV && ret != -ENXIO)
> return ret;
>
> ret = nd_dax_probe(dev, ndns);
> if (ret == 0)
> return -ENXIO;
> - else if (ret == -EOPNOTSUPP)
> + else if (ret != -ENODEV && ret != -ENXIO)
> return ret;
>
> /* probe complete, attach handles namespace enabling */
>
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
> --
> 2.43.0
>
prev parent reply other threads:[~2026-12-02 23:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 8:21 Avi Weiss
2026-12-02 23:56 ` Alison Schofield [this message]
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=axCwJ--9bVAmkOGT@aschofie-mobl2.lan \
--to=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=djbw@kernel.org \
--cc=iweiny@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=thnkslprpt@gmail.com \
--cc=vishal.l.verma@intel.com \
/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
all inboxes | Powered by JetHome®