All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [patch] fault mmaped area upon rtdm_mmap_to_user.
@ 2008-11-15 23:55 Gilles Chanteperdrix
  2008-11-16 10:41 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Gilles Chanteperdrix @ 2008-11-15 23:55 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai core

Hi Jan,

I have just commited a modification of the nucleus heap which allows
faulting newly mapped pages. However, I noticed that we should modify
rtdm_mmap_to_user as in the attached patch.

At this chance, I also noticed that there is no way to ask for uncached
memory to rtdm_mmap_to_user, how do you think we should change
rtdm_mmap_to_user to allow this?

Regards.

Index: ksrc/skins/rtdm/drvlib.c
===================================================================
--- ksrc/skins/rtdm/drvlib.c	(revision 4390)
+++ ksrc/skins/rtdm/drvlib.c	(working copy)
@@ -1781,6 +1781,7 @@ static int rtdm_mmap_buffer(struct file
 {
 	struct rtdm_mmap_data *mmap_data = filp->private_data;
 	unsigned long vaddr, paddr, maddr, size;
+	int ret;

 	vma->vm_ops = mmap_data->vm_ops;
 	vma->vm_private_data = mmap_data->vm_private_data;
@@ -1810,15 +1811,25 @@ static int rtdm_mmap_buffer(struct file
 			vaddr += PAGE_SIZE;
 			mapped_size += PAGE_SIZE;
 		}
-		return 0;
+#ifdef xnarch_fault_range
+		xnarch_fault_range(vma);
+#endif /* xnarch_fault_range */
+		ret = 0;
 	} else
 #endif /* CONFIG_MMU */
 	if (mmap_data->src_paddr)
-	  	return xnarch_remap_io_page_range(filp, vma, maddr, paddr,
-						  size, PAGE_SHARED);
-	else
-		return xnarch_remap_kmem_page_range(vma, maddr, paddr,
-						    size, PAGE_SHARED);
+	  	ret = xnarch_remap_io_page_range(filp, vma, maddr, paddr,
+						 size, PAGE_SHARED);
+	else {
+		ret = xnarch_remap_kmem_page_range(vma, maddr, paddr,
+						   size, PAGE_SHARED);
+#ifdef xnarch_fault_range
+		if (!ret)
+			xnarch_fault_range(vma);
+#endif /* xnarch_fault_range */
+	}
+
+	return ret;
 }

 static struct file_operations rtdm_mmap_fops = {


-- 
					    Gilles.


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

* Re: [Xenomai-core] [patch] fault mmaped area upon rtdm_mmap_to_user.
  2008-11-15 23:55 [Xenomai-core] [patch] fault mmaped area upon rtdm_mmap_to_user Gilles Chanteperdrix
@ 2008-11-16 10:41 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2008-11-16 10:41 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Xenomai core

[-- Attachment #1: Type: text/plain, Size: 2176 bytes --]

Gilles Chanteperdrix wrote:
> Hi Jan,
> 
> I have just commited a modification of the nucleus heap which allows
> faulting newly mapped pages. However, I noticed that we should modify
> rtdm_mmap_to_user as in the attached patch.

No general concerns, please just provide an empty xnarch_fault_range as
default to avoid the #ifdefs. Is this an ARM-only issue?

> 
> At this chance, I also noticed that there is no way to ask for uncached
> memory to rtdm_mmap_to_user, how do you think we should change
> rtdm_mmap_to_user to allow this?

Look like we would have to introduce a 'flags' argument to
rtdm_mmap_to_user. That's 2.5 material, where we'll change a few RTDM
APIs anyway.

Jan

> 
> Regards.
> 
> Index: ksrc/skins/rtdm/drvlib.c
> ===================================================================
> --- ksrc/skins/rtdm/drvlib.c	(revision 4390)
> +++ ksrc/skins/rtdm/drvlib.c	(working copy)
> @@ -1781,6 +1781,7 @@ static int rtdm_mmap_buffer(struct file
>  {
>  	struct rtdm_mmap_data *mmap_data = filp->private_data;
>  	unsigned long vaddr, paddr, maddr, size;
> +	int ret;
> 
>  	vma->vm_ops = mmap_data->vm_ops;
>  	vma->vm_private_data = mmap_data->vm_private_data;
> @@ -1810,15 +1811,25 @@ static int rtdm_mmap_buffer(struct file
>  			vaddr += PAGE_SIZE;
>  			mapped_size += PAGE_SIZE;
>  		}
> -		return 0;
> +#ifdef xnarch_fault_range
> +		xnarch_fault_range(vma);
> +#endif /* xnarch_fault_range */
> +		ret = 0;
>  	} else
>  #endif /* CONFIG_MMU */
>  	if (mmap_data->src_paddr)
> -	  	return xnarch_remap_io_page_range(filp, vma, maddr, paddr,
> -						  size, PAGE_SHARED);
> -	else
> -		return xnarch_remap_kmem_page_range(vma, maddr, paddr,
> -						    size, PAGE_SHARED);
> +	  	ret = xnarch_remap_io_page_range(filp, vma, maddr, paddr,
> +						 size, PAGE_SHARED);
> +	else {
> +		ret = xnarch_remap_kmem_page_range(vma, maddr, paddr,
> +						   size, PAGE_SHARED);
> +#ifdef xnarch_fault_range
> +		if (!ret)
> +			xnarch_fault_range(vma);
> +#endif /* xnarch_fault_range */
> +	}
> +
> +	return ret;
>  }
> 
>  static struct file_operations rtdm_mmap_fops = {
> 
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

end of thread, other threads:[~2008-11-16 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-15 23:55 [Xenomai-core] [patch] fault mmaped area upon rtdm_mmap_to_user Gilles Chanteperdrix
2008-11-16 10:41 ` Jan Kiszka

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.