Messages in this thread | | | From | Dan Williams <> | Date | Fri, 4 Feb 2022 13:10:53 -0800 | Subject | Re: [PATCH V8 43/44] nvdimm/pmem: Enable stray access protection |
| |
On Thu, Jan 27, 2022 at 9:55 AM <ira.weiny@intel.com> wrote: > > From: Ira Weiny <ira.weiny@intel.com> > > Now that all valid kernel access' to PMEM have been annotated with > {__}pgmap_mk_{readwrite,noaccess}() PGMAP_PROTECTION is safe to enable > in the pmem layer. > > Implement the pmem_map_protected() and pmem_mk_{readwrite,noaccess}() to > communicate this memory has extra protection to the upper layers if > PGMAP_PROTECTION is specified. > > Internally, the pmem driver uses a cached virtual address, > pmem->virt_addr (pmem_addr). Use __pgmap_mk_{readwrite,noaccess}() > directly when PGMAP_PROTECTION is active on the device. > > Signed-off-by: Ira Weiny <ira.weiny@intel.com> > > --- > Changes for V8 > Rebase to 5.17-rc1 > Remove global param > Add internal structure which uses the pmem device and pgmap > device directly in the *_mk_*() calls. > Add pmem dax ops callbacks > Use pgmap_protection_available() > s/PGMAP_PKEY_PROTECT/PGMAP_PROTECTION > --- > drivers/nvdimm/pmem.c | 52 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 51 insertions(+), 1 deletion(-) > > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c > index 58d95242a836..2afff8157233 100644 > --- a/drivers/nvdimm/pmem.c > +++ b/drivers/nvdimm/pmem.c > @@ -138,6 +138,18 @@ static blk_status_t read_pmem(struct page *page, unsigned int off, > return BLK_STS_OK; > } > > +static void __pmem_mk_readwrite(struct pmem_device *pmem) > +{ > + if (pmem->pgmap.flags & PGMAP_PROTECTION) > + __pgmap_mk_readwrite(&pmem->pgmap); > +} > + > +static void __pmem_mk_noaccess(struct pmem_device *pmem) > +{ > + if (pmem->pgmap.flags & PGMAP_PROTECTION) > + __pgmap_mk_noaccess(&pmem->pgmap); > +} > +
Per previous feedback let's find a way for the pmem driver to stay out of the loop, and just let these toggles by pgmap generic operations.
| |