Page MenuHomeFreeBSD

nvdimm(4): Only expose namespaces for accessible data SPAs
ClosedPublic

Authored by scottph on Oct 11 2019, 10:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 11:37 PM
Unknown Object (File)
Aug 31 2023, 1:58 PM
Unknown Object (File)
Jul 10 2023, 11:37 AM
Unknown Object (File)
Jun 27 2023, 7:38 AM
Unknown Object (File)
Jun 1 2023, 7:07 PM
Unknown Object (File)
May 5 2023, 12:27 PM
Unknown Object (File)
Apr 8 2023, 12:32 AM
Unknown Object (File)
Mar 21 2023, 8:30 PM
Subscribers

Details

Summary

Apply the same user accessible filter to namespaces as is applied
to full-SPA devices. Also, explicitly filter out control region
SPAs which don't expose the nvdimm data area.

MFC after: 1 week
Sponsored by: Intel Corporation

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/dev/nvdimm/nvdimm_spa.c
164 ↗(On Diff #63170)

Why the loop? Why not just a single line that's return? I'm guessing there is a field we need to check

sys/dev/nvdimm/nvdimm_spa.c
164 ↗(On Diff #63170)

SPA_TYPE_UNKNOWN = 127,
is outside the bounds of the array. How about:

return (spa_type >= 0 && spa_type < nitems(nvdimm_SPA_uuid_list) ? nvdimm_SPA_uuid_list[spa_type].u_usr_acc : false);

Do Control Region SPAs have namespaces? I'm still fairly new to NFIT.

sys/dev/nvdimm/nvdimm_spa.c
164 ↗(On Diff #63170)

I like the suggestion and the proposal. I'm not sure it needs to be a one-liner but I'm on-board with the bounds check approach. I'd probably spell it more like:

if ((int)spa_type < 0 || spa_type >= nitems(nvdimm_SPA_uuid_list))
    return (false);
return (nvdimm_SPA_uuid_list[spa_type].u_usr_acc);

But it doesn't really matter to me how it's formatted.

In D21987#480367, @cem wrote:

Do Control Region SPAs have namespaces? I'm still fairly new to NFIT.

No, namespaces should only apply to areas where there's a mapping to the dimm physical addresses, which I believe is never the case with a control region. Which leads me to think that this check is necessary (don't show namespaces for regions that we also hide) but not sufficient on its own.

scottph retitled this revision from nvdimm(4): Don't expose namespaces for inaccessible SPAs to nvdimm(4): Only expose namespaces for accessible data SPAs.
scottph edited the summary of this revision. (Show Details)
scottph marked 2 inline comments as done.
This revision is now accepted and ready to land.Nov 12 2019, 1:05 AM