From: Thomas Hellstrom <thellstrom@vmware.com>
To: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Linux kernel mailing list <linux-kernel@vger.kernel.org>,
"Siddha, Suresh B" <suresh.b.siddha@intel.com>,
Nick Piggin <npiggin@suse.de>
Subject: Re: 2.6.29 pat issue
Date: Tue, 10 Mar 2009 09:22:03 +0100 [thread overview]
Message-ID: <49B6232B.4050503@vmware.com> (raw)
In-Reply-To: <20090310013953.GA11312@linux-os.sc.intel.com>
Pallipadi, Venkatesh wrote:
> On Fri, Mar 06, 2009 at 03:44:07PM -0800, Thomas Hellstrom wrote:
>
>> We get the warning when we insert RAM pages using vm_insert_pfn().
>> Having normal RAM pages backing a PFN papping is a valid thing.
>>
>>
>
> OK. Below is the updated patch that should fix this fully. Can you confirm?
>
> Thanks,
> Venki
>
>
Yes, this patch should fix the problem. I'm still concerned about the
overhead of going through the
RAM test for each inserted page.
Why can't a pfn_valid() test be used in vm_insert_pfn()?
Thanks,
Thomas
> From: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> Subject: [PATCH] VM, x86 PAT: Change implementation of is_linear_pfn_mapping
>
> Use of vma->vm_pgoff to identify the pfnmaps that are fully mapped at
> mmap time is broken, as vm_pgoff can also be set when full mapping is
> not setup at mmap time.
> http://marc.info/?l=linux-kernel&m=123383810628583&w=2
>
> Change the logic to overload VM_NONLINEAR flag along with VM_PFNMAP to
> mean full mapping setup at mmap time. This distinction is needed by
> x86 PAT code.
>
> Regression reported at
> http://bugzilla.kernel.org/show_bug.cgi?id=12800
>
> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> ---
> arch/x86/mm/pat.c | 5 +++--
> include/linux/mm.h | 8 +++++++-
> mm/memory.c | 6 ++++--
> 3 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
> index 2ed3715..640339e 100644
> --- a/arch/x86/mm/pat.c
> +++ b/arch/x86/mm/pat.c
> @@ -677,10 +677,11 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
> is_ram = pat_pagerange_is_ram(paddr, paddr + size);
>
> /*
> - * reserve_pfn_range() doesn't support RAM pages.
> + * reserve_pfn_range() doesn't support RAM pages. Maintain the current
> + * behavior with RAM pages by returning success.
> */
> if (is_ram != 0)
> - return -EINVAL;
> + return 0;
>
> ret = reserve_memtype(paddr, paddr + size, want_flags, &flags);
> if (ret)
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 065cdf8..6c3fc3a 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -127,6 +127,12 @@ extern unsigned int kobjsize(const void *objp);
> #define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP)
>
> /*
> + * pfnmap vmas that are fully mapped at mmap time (not mapped on fault).
> + * Used by x86 PAT to identify such PFNMAP mappings and optimize their handling.
> + */
> +#define VM_PFNMAP_AT_MMAP (VM_NONLINEAR | VM_PFNMAP)
> +
> +/*
> * mapping from the currently active vm_flags protection bits (the
> * low four bits) to a page protection mask..
> */
> @@ -145,7 +151,7 @@ extern pgprot_t protection_map[16];
> */
> static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
> {
> - return ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff);
> + return ((vma->vm_flags & VM_PFNMAP_AT_MMAP) == VM_PFNMAP_AT_MMAP);
> }
>
> static inline int is_pfn_mapping(struct vm_area_struct *vma)
> diff --git a/mm/memory.c b/mm/memory.c
> index baa999e..d7df5ba 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -1665,9 +1665,10 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
> * behaviour that some programs depend on. We mark the "original"
> * un-COW'ed pages by matching them up with "vma->vm_pgoff".
> */
> - if (addr == vma->vm_start && end == vma->vm_end)
> + if (addr == vma->vm_start && end == vma->vm_end) {
> vma->vm_pgoff = pfn;
> - else if (is_cow_mapping(vma->vm_flags))
> + vma->vm_flags |= VM_PFNMAP_AT_MMAP;
> + } else if (is_cow_mapping(vma->vm_flags))
> return -EINVAL;
>
> vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
> @@ -1679,6 +1680,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
> * needed from higher level routine calling unmap_vmas
> */
> vma->vm_flags &= ~(VM_IO | VM_RESERVED | VM_PFNMAP);
> + vma->vm_flags &= ~VM_PFNMAP_AT_MMAP;
> return -EINVAL;
> }
>
>
next prev parent reply other threads:[~2009-03-10 8:22 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 12:47 2.6.29 pat issue Thomas Hellström
2009-02-05 18:03 ` Pallipadi, Venkatesh
2009-02-05 21:32 ` Thomas Hellstrom
2009-02-05 23:08 ` Pallipadi, Venkatesh
2009-02-06 9:51 ` Thomas Hellström
2009-02-06 1:11 ` Eric W. Biederman
2009-02-06 9:43 ` Thomas Hellström
2009-03-04 6:08 ` Pallipadi, Venkatesh
2009-03-04 9:56 ` Thomas Hellstrom
2009-03-06 22:38 ` Pallipadi, Venkatesh
2009-03-06 23:44 ` Thomas Hellstrom
2009-03-10 1:39 ` Pallipadi, Venkatesh
2009-03-10 8:22 ` Thomas Hellstrom [this message]
2009-03-10 17:42 ` Pallipadi, Venkatesh
2009-03-11 9:17 ` Thomas Hellstrom
2009-03-11 9:33 ` Ingo Molnar
2009-03-11 17:54 ` [PATCH] VM, x86, PAT: Change implementation of is_linear_pfn_mapping Pallipadi, Venkatesh
2009-03-11 22:09 ` Frans Pop
2009-03-12 0:31 ` Pallipadi, Venkatesh
2009-03-12 3:22 ` Pallipadi, Venkatesh
2009-03-12 5:45 ` Frans Pop
2009-03-12 18:59 ` Pallipadi, Venkatesh
2009-03-12 20:30 ` Frans Pop
2009-03-12 22:48 ` Pallipadi, Venkatesh
2009-03-13 0:36 ` Ingo Molnar
2009-03-13 0:45 ` [PATCH] VM, x86, PAT: Change is_linear_pfn_mapping to not use vm_pgoff Pallipadi, Venkatesh
2009-03-13 4:03 ` [tip:x86/urgent] " Pallipadi, Venkatesh
2009-03-13 16:25 ` Nick Piggin
2009-03-13 17:00 ` Pallipadi, Venkatesh
2009-03-14 2:52 ` Nick Piggin
2009-03-13 23:35 ` [PATCH] Add a new vm flag to track full pfnmap at mmap Pallipadi, Venkatesh
2009-03-14 2:53 ` Nick Piggin
2009-03-14 8:54 ` [tip:x86/urgent] VM, x86, PAT: add " Pallipadi, Venkatesh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49B6232B.4050503@vmware.com \
--to=thellstrom@vmware.com \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=suresh.b.siddha@intel.com \
--cc=venkatesh.pallipadi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox