linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] remap_pfn_range: store vm_pgoff for all linear_over_vma_region mappings
@ 2008-10-23 22:09 Venki Pallipadi
  2008-10-23 22:43 ` Venki Pallipadi
  2008-10-24  1:08 ` Nick Piggin
  0 siblings, 2 replies; 4+ messages in thread
From: Venki Pallipadi @ 2008-10-23 22:09 UTC (permalink / raw)
  To: npiggin, hugh; +Cc: apkm, Ingo Molnar, linux-kernel


While working on x86 PAT, we are having some hurdles with tracking
remap_pfn_range() regions, as later we do not have any information to say
whether that PFNMAP mapping is linear for the entire vma range or
it is smaller granularity regions within the vma.

A simple solution to this is to use vm_pgoff as an indicator for
linear mapping over the vma region. Currently, remap_pfn_range
only sets vm_pgoff only for COW mappings. Below patch changes the
logic and sets the vm_pgoff irrespective of COW.

>From our understanding of the code, this should not break anyone.
Just sending it as an RFC to get feedback on whether it is OK to do
something like this or are there any corner cases that we may
break or watch out for.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>

---
 mm/memory.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Index: linux-2.6/mm/memory.c
===================================================================
--- linux-2.6.orig/mm/memory.c	2008-10-21 09:58:47.000000000 -0700
+++ linux-2.6/mm/memory.c	2008-10-23 13:38:26.000000000 -0700
@@ -1575,11 +1575,10 @@ int remap_pfn_range(struct vm_area_struc
 	 * behaviour that some programs depend on. We mark the "original"
 	 * un-COW'ed pages by matching them up with "vma->vm_pgoff".
 	 */
-	if (is_cow_mapping(vma->vm_flags)) {
-		if (addr != vma->vm_start || end != vma->vm_end)
-			return -EINVAL;
+	if (addr == vma->vm_start && end == vma->vm_end)
 		vma->vm_pgoff = pfn;
-	}
+	else if (is_cow_mapping(vma->vm_flags))
+		return -EINVAL;
 
 	vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] remap_pfn_range: store vm_pgoff for all linear_over_vma_region mappings
  2008-10-23 22:09 [RFC] remap_pfn_range: store vm_pgoff for all linear_over_vma_region mappings Venki Pallipadi
@ 2008-10-23 22:43 ` Venki Pallipadi
  2008-10-24  1:08 ` Nick Piggin
  1 sibling, 0 replies; 4+ messages in thread
From: Venki Pallipadi @ 2008-10-23 22:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: npiggin, hugh, Ingo Molnar, linux-kernel


[Sorry for the duplicate. Correctly sending to Andrew this time.]

On Thu, Oct 23, 2008 at 03:09:14PM -0700, Venki Pallipadi wrote:
> 
> While working on x86 PAT, we are having some hurdles with tracking
> remap_pfn_range() regions, as later we do not have any information to say
> whether that PFNMAP mapping is linear for the entire vma range or
> it is smaller granularity regions within the vma.
> 
> A simple solution to this is to use vm_pgoff as an indicator for
> linear mapping over the vma region. Currently, remap_pfn_range
> only sets vm_pgoff only for COW mappings. Below patch changes the
> logic and sets the vm_pgoff irrespective of COW.
> 
> From our understanding of the code, this should not break anyone.
> Just sending it as an RFC to get feedback on whether it is OK to do
> something like this or are there any corner cases that we may
> break or watch out for.
> 
> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> 
> ---
>  mm/memory.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/mm/memory.c
> ===================================================================
> --- linux-2.6.orig/mm/memory.c	2008-10-21 09:58:47.000000000 -0700
> +++ linux-2.6/mm/memory.c	2008-10-23 13:38:26.000000000 -0700
> @@ -1575,11 +1575,10 @@ int remap_pfn_range(struct vm_area_struc
>  	 * behaviour that some programs depend on. We mark the "original"
>  	 * un-COW'ed pages by matching them up with "vma->vm_pgoff".
>  	 */
> -	if (is_cow_mapping(vma->vm_flags)) {
> -		if (addr != vma->vm_start || end != vma->vm_end)
> -			return -EINVAL;
> +	if (addr == vma->vm_start && end == vma->vm_end)
>  		vma->vm_pgoff = pfn;
> -	}
> +	else if (is_cow_mapping(vma->vm_flags))
> +		return -EINVAL;
>  
>  	vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
>  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] remap_pfn_range: store vm_pgoff for all linear_over_vma_region mappings
  2008-10-23 22:09 [RFC] remap_pfn_range: store vm_pgoff for all linear_over_vma_region mappings Venki Pallipadi
  2008-10-23 22:43 ` Venki Pallipadi
@ 2008-10-24  1:08 ` Nick Piggin
  2008-10-24  4:13   ` Pallipadi, Venkatesh
  1 sibling, 1 reply; 4+ messages in thread
From: Nick Piggin @ 2008-10-24  1:08 UTC (permalink / raw)
  To: Venki Pallipadi; +Cc: hugh, apkm, Ingo Molnar, linux-kernel

On Thu, Oct 23, 2008 at 03:09:14PM -0700, Venki Pallipadi wrote:
> 
> While working on x86 PAT, we are having some hurdles with tracking
> remap_pfn_range() regions, as later we do not have any information to say
> whether that PFNMAP mapping is linear for the entire vma range or
> it is smaller granularity regions within the vma.
> 
> A simple solution to this is to use vm_pgoff as an indicator for
> linear mapping over the vma region. Currently, remap_pfn_range
> only sets vm_pgoff only for COW mappings. Below patch changes the
> logic and sets the vm_pgoff irrespective of COW.
> 
> >From our understanding of the code, this should not break anyone.
> Just sending it as an RFC to get feedback on whether it is OK to do
> something like this or are there any corner cases that we may
> break or watch out for.
> 
> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>

Hmm, I can'tthink of why it would break, but I would like to see an
entire patch. Obviously you won't try to decode this vma stuff
directly from the PAT code, but just call mm helpers... ?

Thanks,
Nick
 
> ---
>  mm/memory.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/mm/memory.c
> ===================================================================
> --- linux-2.6.orig/mm/memory.c	2008-10-21 09:58:47.000000000 -0700
> +++ linux-2.6/mm/memory.c	2008-10-23 13:38:26.000000000 -0700
> @@ -1575,11 +1575,10 @@ int remap_pfn_range(struct vm_area_struc
>  	 * behaviour that some programs depend on. We mark the "original"
>  	 * un-COW'ed pages by matching them up with "vma->vm_pgoff".
>  	 */
> -	if (is_cow_mapping(vma->vm_flags)) {
> -		if (addr != vma->vm_start || end != vma->vm_end)
> -			return -EINVAL;
> +	if (addr == vma->vm_start && end == vma->vm_end)
>  		vma->vm_pgoff = pfn;
> -	}
> +	else if (is_cow_mapping(vma->vm_flags))
> +		return -EINVAL;
>  
>  	vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
>  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [RFC] remap_pfn_range: store vm_pgoff for all linear_over_vma_region mappings
  2008-10-24  1:08 ` Nick Piggin
@ 2008-10-24  4:13   ` Pallipadi, Venkatesh
  0 siblings, 0 replies; 4+ messages in thread
From: Pallipadi, Venkatesh @ 2008-10-24  4:13 UTC (permalink / raw)
  To: Nick Piggin; +Cc: hugh, Andrew Morton, Ingo Molnar, linux-kernel

 

>-----Original Message-----
>From: Nick Piggin [mailto:npiggin@suse.de] 
>Sent: Thursday, October 23, 2008 6:08 PM
>To: Pallipadi, Venkatesh
>Cc: hugh@veritas.com; apkm@linux-os.sc.intel.com; Ingo Molnar; 
>linux-kernel
>Subject: Re: [RFC] remap_pfn_range: store vm_pgoff for all 
>linear_over_vma_region mappings
>
>On Thu, Oct 23, 2008 at 03:09:14PM -0700, Venki Pallipadi wrote:
>> 
>> While working on x86 PAT, we are having some hurdles with tracking
>> remap_pfn_range() regions, as later we do not have any 
>information to say
>> whether that PFNMAP mapping is linear for the entire vma range or
>> it is smaller granularity regions within the vma.
>> 
>> A simple solution to this is to use vm_pgoff as an indicator for
>> linear mapping over the vma region. Currently, remap_pfn_range
>> only sets vm_pgoff only for COW mappings. Below patch changes the
>> logic and sets the vm_pgoff irrespective of COW.
>> 
>> >From our understanding of the code, this should not break anyone.
>> Just sending it as an RFC to get feedback on whether it is OK to do
>> something like this or are there any corner cases that we may
>> break or watch out for.
>> 
>> Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
>> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
>
>Hmm, I can'tthink of why it would break, but I would like to see an
>entire patch. Obviously you won't try to decode this vma stuff
>directly from the PAT code, but just call mm helpers... ?
>

Yes. We are thinking of it as a call similar to is_cow_mapping().
May be is_linear_vma_mapping() or something like that. We should
have the rest of the patches by next week.

Thanks,
Venki

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-10-24  4:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-23 22:09 [RFC] remap_pfn_range: store vm_pgoff for all linear_over_vma_region mappings Venki Pallipadi
2008-10-23 22:43 ` Venki Pallipadi
2008-10-24  1:08 ` Nick Piggin
2008-10-24  4:13   ` Pallipadi, Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).