Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281394

Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping

From Toshi Kani <toshi.kani@hpe.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping
Date 2015-12-02 02:30 +0100
Message-ID <qB4p4-ui-17@gated-at.bofh.it> (permalink)
References <qy5B0-6Cy-11@gated-at.bofh.it> <qAENY-YF-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2015-11-30 at 14:08 -0800, Dan Williams wrote:
> On Mon, Nov 23, 2015 at 12:04 PM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > The following oops was observed when mmap() with MAP_POPULATE
> > pre-faulted pmd mappings of a DAX file.  follow_trans_huge_pmd()
> > expects that a target address has a struct page.
> > 
> >   BUG: unable to handle kernel paging request at ffffea0012220000
> >   follow_trans_huge_pmd+0xba/0x390
> >   follow_page_mask+0x33d/0x420
> >   __get_user_pages+0xdc/0x800
> >   populate_vma_page_range+0xb5/0xe0
> >   __mm_populate+0xc5/0x150
> >   vm_mmap_pgoff+0xd5/0xe0
> >   SyS_mmap_pgoff+0x1c1/0x290
> >   SyS_mmap+0x1b/0x30
> > 
> > Fix it by making the PMD pre-fault handling consistent with PTE.
> > After pre-faulted in faultin_page(), follow_page_mask() calls
> > follow_trans_huge_pmd(), which is changed to call follow_pfn_pmd()
> > for VM_PFNMAP or VM_MIXEDMAP.  follow_pfn_pmd() handles FOLL_TOUCH
> > and returns with -EEXIST.
> > 
> > Reported-by: Mauricio Porto <mauricio.porto@hpe.com>
> > Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> > Cc: Matthew Wilcox <willy@linux.intel.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> > ---
> 
> Hey Toshi,
> 
> I ended up fixing this differently with follow_pmd_devmap() introduced
> in this series:
> 
> https://lists.01.org/pipermail/linux-nvdimm/2015-November/003033.html
> 
> Does the latest libnvdimm-pending branch [1] pass your test case?

Hi Dan,

I ran several test cases, and they all hit the case "pfn not in memmap" in
__dax_pmd_fault() during mmap(MAP_POPULATE).  Looking at the dax.pfn, PFN_DEV is
set but PFN_MAP is not.  I have not looked into why, but I thought I let you
know first.  I've also seen the test thread got hung up at the end sometime.  

I also noticed that reason is not set in the case below.

                if (length < PMD_SIZE
                                || (pfn_t_to_pfn(dax.pfn) & PG_PMD_COLOUR)) {
                        dax_unmap_atomic(bdev, &dax);
                          goto fallback;
                }

Thanks,
-Toshi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-11-30 23:10 +0100
  Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-02 02:30 +0100
    Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-02 04:50 +0100
      Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-02 17:50 +0100
        Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-02 18:40 +0100
          Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-02 19:10 +0100
            Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-02 19:40 +0100
              Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-02 20:10 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-02 20:20 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-02 21:00 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-02 21:50 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-02 22:00 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-02 22:10 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-04 00:50 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-04 17:10 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dave Hansen <dave.hansen@intel.com> - 2015-12-02 23:10 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dave Hansen <dave.hansen@intel.com> - 2015-12-02 23:10 +0100
                Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-02 23:10 +0100
              Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-02 20:10 +0100
        Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Toshi Kani <toshi.kani@hpe.com> - 2015-12-03 00:30 +0100
          Re: [PATCH] mm: Fix mmap MAP_POPULATE for DAX pmd mapping Dan Williams <dan.j.williams@intel.com> - 2015-12-03 00:40 +0100

csiph-web