From: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
To: Thomas Hellstrom <thellstrom@vmware.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: Fri, 06 Mar 2009 14:38:20 -0800 [thread overview]
Message-ID: <1236379100.4529.9.camel@localhost.localdomain> (raw)
In-Reply-To: <49AE5039.5050105@vmware.com>
On Wed, 2009-03-04 at 01:56 -0800, Thomas Hellstrom wrote:
> Hi!
>
> Pallipadi, Venkatesh wrote:
> > On Fri, Feb 06, 2009 at 01:43:08AM -0800, Thomas Hellström wrote:
> >
> >> Eric W. Biederman wrote:
> >>
> >>> Thomas Hellstrom <thellstrom@vmware.com> writes:
> >>>
> >>>
> >>>
> >>>
> >>>> Indeed, it's crucial to keep the mappings consistent, but failure to do so is a
> >>>> kernel driver bug, it should never be the result of invalid user data.
> >>>>
> >>>>
> >>> It easily can be. Think of an X server mmaping frame buffers. Or other
> >>> device bars.
> >>>
> >>>
> >>>
> >> Hmm, Yes you're right, although I'm still a bit doubtful about RAM pages.
> >>
> >> Wait. Now I see what's causing the problems. The code is assuming that
> >> VM_PFNMAP vmas never map RAM pages. That's also an invalid assumption.
> >> See comments in mm/memory.c
> >>
> >> So probably the attribute check should be done for the insert_pfn path
> >> of VM_MIXEDMAP as well. That's not done today.
> >>
> >> So there are three distinct bugs at this point:
> >>
> >> 1) VMAs with VM_PFNMAP are incorrectly assumed to be linear if
> >> vma->vm_pgoff non-null.
> >> 2) VM_PFNMAP VMA PTEs are incorrectly assumed to never point to physical
> >> RAM.
> >> 3) There is no check for the insert_pfn path of vm_insert_mixed().
> >>
> >>
> >
> > Patch below will solve (1) above.
> >
>
> Yes, hmm, but how about remap_pfn_range() having an optimized function
> to call into directly, instead of
> track_pfn_vma_new?
No. The idea was to have this flag set, only when full vma is mapped
using remap_pfn_range. In all other cases, insert_pfn or partial region
mapped in remap_pfn_range, we will use the slow path. Having said that,
the patch I had sent here missed one of the conditions. Refreshing the
patch.
>
> > About (2), Yes. we can optimize the PAT code if we use struct page to track
> > PFNMAP as long at memory is backed by a struct page. It has some complications
> > with refcounting the number of mappings and related things. We are actively
> > looking at it.
>
> Cool. Still, there needs to be a check for non-io pages in vm_insert_pfn
> to avoid hitting the WARN_ON_ONCE:
> + if (!pfn_valid(pfn)) //Pfn pointing to a non-ram page.
> track_pfn_vma_new()
About the WARN_ON. I am not completely clear aboue how/why you are
getting the warning. You will only get WARN_ON, if driver is trying to
map actual RAM pages using remap_pfn_range or vm_insert_pfn. That is a
valid warning, I think. If RAM is intended to be mapped, then driver
should be using insert_page or insert_mixed. No? Are you getting the
warning even when you use vm_insert_page or vm_insert_mixed?
Thanks,
Venki
next prev parent reply other threads:[~2009-03-06 22:41 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 [this message]
2009-03-06 23:44 ` Thomas Hellstrom
2009-03-10 1:39 ` Pallipadi, Venkatesh
2009-03-10 8:22 ` Thomas Hellstrom
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=1236379100.4529.9.camel@localhost.localdomain \
--to=venkatesh.pallipadi@intel.com \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=suresh.b.siddha@intel.com \
--cc=thellstrom@vmware.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