On Fri, Sep 30, 2016 at 1:10 PM, Vishal Verma <vishal.l.verma@xxxxxxxxx> wrote: > pmem_do_bvec used to kmap_atomic at the begin, and only unmap at the > end. Things like nvdimm_clear_poison may want to do nvdimm subsystem > bookkeeping operations that may involve taking locks or doing memory > allocations, and we can't do that from the atomic context. Reduce the > atomic context to just what needs it - the memcpy to/from pmem. > > Cc: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx> > Signed-off-by: Vishal Verma <vishal.l.verma@xxxxxxxxx> > --- > drivers/nvdimm/pmem.c | 28 +++++++++++++++++++++++----- > 1 file changed, 23 insertions(+), 5 deletions(-) > > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c > index 571a6c7..ca038d8 100644 > --- a/drivers/nvdimm/pmem.c > +++ b/drivers/nvdimm/pmem.c > @@ -66,13 +66,32 @@ static void pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset, > invalidate_pmem(pmem->virt_addr + offset, len); > } > > +static void map_and_copy_to_pmem(void *pmem_addr, struct page *page, > + unsigned int off, unsigned int len) > +{ > + void *mem = kmap_atomic(page); > + > + memcpy_to_pmem(pmem_addr, mem + off, len); > + kunmap_atomic(mem); > +} > + > +static int map_and_copy_from_pmem(struct page *page, unsigned int off, > + void *pmem_addr, unsigned int len) > +{ > + int rc; > + void *mem = kmap_atomic(page); > + > + rc = memcpy_from_pmem(mem + off, pmem_addr, len); > + kunmap_atomic(mem); > + return rc; > +} Let's just name these write_pmem() and read_pmem() respectively. -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html