All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NOMMU: implement access_remote_vm
@ 2011-03-25 20:32 Mike Frysinger
  2011-03-29  5:54 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mike Frysinger @ 2011-03-25 20:32 UTC (permalink / raw)
  To: uclinux-dev, David Howells, Greg Ungerer, Paul Mundt
  Cc: uclinux-dist-devel, linux-kernel

Recent vm changes brought in a new function which the core procfs code
utilizes.  So implement it for nommu systems too to avoid link failures.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 mm/nommu.c |   52 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index cb86e7d..c4c542c 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1971,21 +1971,10 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 }
 EXPORT_SYMBOL(filemap_fault);
 
-/*
- * Access another process' address space.
- * - source/target buffer must be kernel space
- */
-int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
+static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
+		unsigned long addr, void *buf, int len, int write)
 {
 	struct vm_area_struct *vma;
-	struct mm_struct *mm;
-
-	if (addr + len < addr)
-		return 0;
-
-	mm = get_task_mm(tsk);
-	if (!mm)
-		return 0;
 
 	down_read(&mm->mmap_sem);
 
@@ -2010,6 +1999,43 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
 	}
 
 	up_read(&mm->mmap_sem);
+
+	return len;
+}
+
+/**
+ * @access_remote_vm - access another process' address space
+ * @mm:		the mm_struct of the target address space
+ * @addr:	start address to access
+ * @buf:	source or destination buffer
+ * @len:	number of bytes to transfer
+ * @write:	whether the access is a write
+ *
+ * The caller must hold a reference on @mm.
+ */
+int access_remote_vm(struct mm_struct *mm, unsigned long addr,
+		void *buf, int len, int write)
+{
+	return __access_remote_vm(NULL, mm, addr, buf, len, write);
+}
+
+/*
+ * Access another process' address space.
+ * - source/target buffer must be kernel space
+ */
+int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
+{
+	struct mm_struct *mm;
+
+	if (addr + len < addr)
+		return 0;
+
+	mm = get_task_mm(tsk);
+	if (!mm)
+		return 0;
+
+	len = __access_remote_vm(tsk, mm, addr, buf, len, write);
+
 	mmput(mm);
 	return len;
 }
-- 
1.7.4.1


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

* Re: [PATCH] NOMMU: implement access_remote_vm
  2011-03-25 20:32 [PATCH] NOMMU: implement access_remote_vm Mike Frysinger
@ 2011-03-29  5:54 ` Simon Horman
  2011-03-29  8:58   ` Wan ZongShun
  2011-03-29  9:48 ` [uClinux-dev] " Ithamar R. Adema
  2011-03-29 10:20 ` Greg Ungerer
  2 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2011-03-29  5:54 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: uclinux-dev, David Howells, Greg Ungerer, Paul Mundt,
	uclinux-dist-devel, linux-kernel

On Fri, Mar 25, 2011 at 04:32:28PM -0400, Mike Frysinger wrote:
> Recent vm changes brought in a new function which the core procfs code
> utilizes.  So implement it for nommu systems too to avoid link failures.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

This resolves a build problem that I observed this afternoon.

Drive-by Tested-by: Simon Horman <horms@verge.net.au>


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

* Re: [PATCH] NOMMU: implement access_remote_vm
  2011-03-29  5:54 ` Simon Horman
@ 2011-03-29  8:58   ` Wan ZongShun
  0 siblings, 0 replies; 6+ messages in thread
From: Wan ZongShun @ 2011-03-29  8:58 UTC (permalink / raw)
  To: Simon Horman
  Cc: Mike Frysinger, uclinux-dev, David Howells, Greg Ungerer,
	Paul Mundt, uclinux-dist-devel, linux-kernel

2011/3/29 Simon Horman <horms@verge.net.au>:
> On Fri, Mar 25, 2011 at 04:32:28PM -0400, Mike Frysinger wrote:
>> Recent vm changes brought in a new function which the core procfs code
>> utilizes.  So implement it for nommu systems too to avoid link failures.
>>
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>
> This resolves a build problem that I observed this afternoon.

oh, I just find this build error about access_remote_vm, this patch
will fix my issue.

thanks!

>
> Drive-by Tested-by: Simon Horman <horms@verge.net.au>
>
> --
> 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/
>



-- 
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel@lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900@googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com@gmail.com

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

* Re: [uClinux-dev] [PATCH] NOMMU: implement access_remote_vm
  2011-03-25 20:32 [PATCH] NOMMU: implement access_remote_vm Mike Frysinger
  2011-03-29  5:54 ` Simon Horman
@ 2011-03-29  9:48 ` Ithamar R. Adema
  2011-03-29 10:20 ` Greg Ungerer
  2 siblings, 0 replies; 6+ messages in thread
From: Ithamar R. Adema @ 2011-03-29  9:48 UTC (permalink / raw)
  To: uClinux development list
  Cc: David Howells, Greg Ungerer, Paul Mundt, uclinux-dist-devel,
	linux-kernel

On Fri, 2011-03-25 at 16:32 -0400, Mike Frysinger wrote:
> Recent vm changes brought in a new function which the core procfs code
> utilizes.  So implement it for nommu systems too to avoid link failures.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

This patch fixes the problem for my NXP lpc2k ARM7TDMI architecture that
I'm mainlining currently, so you can add my:

Tested-by: Ithamar Adema <ithamar.adema@team-embedded.nl>

Regards,

Ithamar.



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

* Re: [PATCH] NOMMU: implement access_remote_vm
  2011-03-25 20:32 [PATCH] NOMMU: implement access_remote_vm Mike Frysinger
  2011-03-29  5:54 ` Simon Horman
  2011-03-29  9:48 ` [uClinux-dev] " Ithamar R. Adema
@ 2011-03-29 10:20 ` Greg Ungerer
  2011-03-31  6:14   ` [uClinux-dev] " Wan ZongShun
  2 siblings, 1 reply; 6+ messages in thread
From: Greg Ungerer @ 2011-03-29 10:20 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: uclinux-dev, David Howells, Greg Ungerer, Paul Mundt,
	uclinux-dist-devel, linux-kernel

On 26/03/11 06:32, Mike Frysinger wrote:
> Recent vm changes brought in a new function which the core procfs code
> utilizes.  So implement it for nommu systems too to avoid link failures.
>
> Signed-off-by: Mike Frysinger<vapier@gentoo.org>

Looks good.

Acked-by: Greg Ungerer <gerg@uclinux.org>


> ---
>   mm/nommu.c |   52 +++++++++++++++++++++++++++++++++++++++-------------
>   1 files changed, 39 insertions(+), 13 deletions(-)
>
> diff --git a/mm/nommu.c b/mm/nommu.c
> index cb86e7d..c4c542c 100644
> --- a/mm/nommu.c
> +++ b/mm/nommu.c
> @@ -1971,21 +1971,10 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
>   }
>   EXPORT_SYMBOL(filemap_fault);
>
> -/*
> - * Access another process' address space.
> - * - source/target buffer must be kernel space
> - */
> -int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
> +static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
> +		unsigned long addr, void *buf, int len, int write)
>   {
>   	struct vm_area_struct *vma;
> -	struct mm_struct *mm;
> -
> -	if (addr + len<  addr)
> -		return 0;
> -
> -	mm = get_task_mm(tsk);
> -	if (!mm)
> -		return 0;
>
>   	down_read(&mm->mmap_sem);
>
> @@ -2010,6 +1999,43 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
>   	}
>
>   	up_read(&mm->mmap_sem);
> +
> +	return len;
> +}
> +
> +/**
> + * @access_remote_vm - access another process' address space
> + * @mm:		the mm_struct of the target address space
> + * @addr:	start address to access
> + * @buf:	source or destination buffer
> + * @len:	number of bytes to transfer
> + * @write:	whether the access is a write
> + *
> + * The caller must hold a reference on @mm.
> + */
> +int access_remote_vm(struct mm_struct *mm, unsigned long addr,
> +		void *buf, int len, int write)
> +{
> +	return __access_remote_vm(NULL, mm, addr, buf, len, write);
> +}
> +
> +/*
> + * Access another process' address space.
> + * - source/target buffer must be kernel space
> + */
> +int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
> +{
> +	struct mm_struct *mm;
> +
> +	if (addr + len<  addr)
> +		return 0;
> +
> +	mm = get_task_mm(tsk);
> +	if (!mm)
> +		return 0;
> +
> +	len = __access_remote_vm(tsk, mm, addr, buf, len, write);
> +
>   	mmput(mm);
>   	return len;
>   }


-- 
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close                             FAX:         +61 7 3217 5323
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com

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

* Re: [uClinux-dev] Re: [PATCH] NOMMU: implement access_remote_vm
  2011-03-29 10:20 ` Greg Ungerer
@ 2011-03-31  6:14   ` Wan ZongShun
  0 siblings, 0 replies; 6+ messages in thread
From: Wan ZongShun @ 2011-03-31  6:14 UTC (permalink / raw)
  To: uClinux development list
  Cc: Greg Ungerer, Mike Frysinger, linux-kernel, Greg Ungerer,
	uclinux-dist-devel

2011/3/29 Greg Ungerer <gerg@snapgear.com>:
> On 26/03/11 06:32, Mike Frysinger wrote:
>>
>> Recent vm changes brought in a new function which the core procfs code
>> utilizes.  So implement it for nommu systems too to avoid link failures.
>>
>> Signed-off-by: Mike Frysinger<vapier@gentoo.org>
>
> Looks good.
>
> Acked-by: Greg Ungerer <gerg@uclinux.org>
>

It applys to my nuc700 arm7tdmi platform, thanks!

Tested-by: Wan ZongShun <mcuos.com@gmail.com>

>
>> ---
>>  mm/nommu.c |   52 +++++++++++++++++++++++++++++++++++++++-------------
>>  1 files changed, 39 insertions(+), 13 deletions(-)
>>
>> diff --git a/mm/nommu.c b/mm/nommu.c
>> index cb86e7d..c4c542c 100644
>> --- a/mm/nommu.c
>> +++ b/mm/nommu.c
>> @@ -1971,21 +1971,10 @@ int filemap_fault(struct vm_area_struct *vma,
>> struct vm_fault *vmf)
>>  }
>>  EXPORT_SYMBOL(filemap_fault);
>>
>> -/*
>> - * Access another process' address space.
>> - * - source/target buffer must be kernel space
>> - */
>> -int access_process_vm(struct task_struct *tsk, unsigned long addr, void
>> *buf, int len, int write)
>> +static int __access_remote_vm(struct task_struct *tsk, struct mm_struct
>> *mm,
>> +               unsigned long addr, void *buf, int len, int write)
>>  {
>>        struct vm_area_struct *vma;
>> -       struct mm_struct *mm;
>> -
>> -       if (addr + len<  addr)
>> -               return 0;
>> -
>> -       mm = get_task_mm(tsk);
>> -       if (!mm)
>> -               return 0;
>>
>>        down_read(&mm->mmap_sem);
>>
>> @@ -2010,6 +1999,43 @@ int access_process_vm(struct task_struct *tsk,
>> unsigned long addr, void *buf, in
>>        }
>>
>>        up_read(&mm->mmap_sem);
>> +
>> +       return len;
>> +}
>> +
>> +/**
>> + * @access_remote_vm - access another process' address space
>> + * @mm:                the mm_struct of the target address space
>> + * @addr:      start address to access
>> + * @buf:       source or destination buffer
>> + * @len:       number of bytes to transfer
>> + * @write:     whether the access is a write
>> + *
>> + * The caller must hold a reference on @mm.
>> + */
>> +int access_remote_vm(struct mm_struct *mm, unsigned long addr,
>> +               void *buf, int len, int write)
>> +{
>> +       return __access_remote_vm(NULL, mm, addr, buf, len, write);
>> +}
>> +
>> +/*
>> + * Access another process' address space.
>> + * - source/target buffer must be kernel space
>> + */
>> +int access_process_vm(struct task_struct *tsk, unsigned long addr, void
>> *buf, int len, int write)
>> +{
>> +       struct mm_struct *mm;
>> +
>> +       if (addr + len<  addr)
>> +               return 0;
>> +
>> +       mm = get_task_mm(tsk);
>> +       if (!mm)
>> +               return 0;
>> +
>> +       len = __access_remote_vm(tsk, mm, addr, buf, len, write);
>> +
>>        mmput(mm);
>>        return len;
>>  }
>
>
> --
> ------------------------------------------------------------------------
> Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
> SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
> 8 Gardner Close                             FAX:         +61 7 3217 5323
> Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev@uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev@uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
>



-- 
*linux-arm-kernel mailing list
mail addr:linux-arm-kernel@lists.infradead.org
you can subscribe by:
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

* linux-arm-NUC900 mailing list
mail addr:NUC900@googlegroups.com
main web: https://groups.google.com/group/NUC900
you can subscribe it by sending me mail:
mcuos.com@gmail.com

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

end of thread, other threads:[~2011-03-31  6:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-25 20:32 [PATCH] NOMMU: implement access_remote_vm Mike Frysinger
2011-03-29  5:54 ` Simon Horman
2011-03-29  8:58   ` Wan ZongShun
2011-03-29  9:48 ` [uClinux-dev] " Ithamar R. Adema
2011-03-29 10:20 ` Greg Ungerer
2011-03-31  6:14   ` [uClinux-dev] " Wan ZongShun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.