Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1403358 > unrolled thread
| Started by | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| First post | 2016-05-19 01:50 +0200 |
| Last post | 2016-05-23 11:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/2] libnvdimm, dax: autodetect fixes Dan Williams <dan.j.williams@intel.com> - 2016-05-19 01:50 +0200
[PATCH 2/2] libnvdimm, dax: fix alignment validation Dan Williams <dan.j.williams@intel.com> - 2016-05-19 01:50 +0200
Re: [PATCH 2/2] libnvdimm, dax: fix alignment validation Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-23 11:20 +0200
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2016-05-19 01:50 +0200 |
| Subject | [PATCH 0/2] libnvdimm, dax: autodetect fixes |
| Message-ID | <rAjnX-mm-7@gated-at.bofh.it> |
Now that the base device-DAX implementation is settling I am circling
back to further flesh out the ndctl unit tests. These 2 fixes fell out
as a result.
---
Dan Williams (2):
libnvdimm, dax: autodetect support
libnvdimm, dax: fix alignment validation
drivers/nvdimm/dax_devs.c | 35 +++++++++++++++++++++++++++++++++++
drivers/nvdimm/nd.h | 11 +++++++++--
drivers/nvdimm/pfn.h | 1 +
drivers/nvdimm/pfn_devs.c | 20 +++++++++++++-------
drivers/nvdimm/pmem.c | 3 ++-
5 files changed, 60 insertions(+), 10 deletions(-)
[toc] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2016-05-19 01:50 +0200 |
| Subject | [PATCH 2/2] libnvdimm, dax: fix alignment validation |
| Message-ID | <rAjnX-mm-9@gated-at.bofh.it> |
| In reply to | #1403358 |
Testing the dax-device autodetect support revealed a probe failure with
the following result:
dax0.1: bad offset: 0x8200000 dax disabled
The original pfn-device implementation inferred the alignment from
ilog2(offset), now that the alignment is explicit the is_power_of_2()
needs replacing with a real sanity check against the recorded alignment.
Otherwise the alignment check is useless in the implicit case and only
the minimum size of the offset matters.
This self-consistency check is further validated by the probe path that
will re-check that the offset is large enough to contain all the
metadata required to enable the device.
Cc: <stable@vger.kernel.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/nvdimm/pfn_devs.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
index 816cd9828ca5..33c97076ddf0 100644
--- a/drivers/nvdimm/pfn_devs.c
+++ b/drivers/nvdimm/pfn_devs.c
@@ -416,6 +416,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
return -ENODEV;
}
+ nd_pfn->align = le32_to_cpu(pfn_sb->align);
if (nd_pfn->align > nvdimm_namespace_capacity(ndns)) {
dev_err(&nd_pfn->dev, "alignment: %lx exceeds capacity %llx\n",
nd_pfn->align, nvdimm_namespace_capacity(ndns));
@@ -436,8 +437,8 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
return -EBUSY;
}
- nd_pfn->align = le32_to_cpu(pfn_sb->align);
- if (!is_power_of_2(offset) || offset < PAGE_SIZE) {
+ if ((nd_pfn->align && !IS_ALIGNED(offset, nd_pfn->align))
+ || !IS_ALIGNED(offset, PAGE_SIZE)) {
dev_err(&nd_pfn->dev, "bad offset: %#llx dax disabled\n",
offset);
return -ENXIO;
[toc] | [prev] | [next] | [standalone]
| From | Johannes Thumshirn <jthumshirn@suse.de> |
|---|---|
| Date | 2016-05-23 11:20 +0200 |
| Subject | Re: [PATCH 2/2] libnvdimm, dax: fix alignment validation |
| Message-ID | <rBUbM-3YT-21@gated-at.bofh.it> |
| In reply to | #1403359 |
On Wed, May 18, 2016 at 04:44:07PM -0700, Dan Williams wrote: > Testing the dax-device autodetect support revealed a probe failure with > the following result: > > dax0.1: bad offset: 0x8200000 dax disabled > > The original pfn-device implementation inferred the alignment from > ilog2(offset), now that the alignment is explicit the is_power_of_2() > needs replacing with a real sanity check against the recorded alignment. > Otherwise the alignment check is useless in the implicit case and only > the minimum size of the offset matters. > > This self-consistency check is further validated by the probe path that > will re-check that the offset is large enough to contain all the > metadata required to enable the device. > > Cc: <stable@vger.kernel.org> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web