All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Rosenfeld Rosas <lbocseg@domain.hid>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [PATCH] provide rtdm_mmap_to_user / rtdm_munmap
Date: Tue, 14 Feb 2006 00:04:19 -0200	[thread overview]
Message-ID: <43F13AA3.3090702@domain.hid> (raw)
In-Reply-To: <43F126D4.4040407@domain.hid>

Jan Kiszka escreveu:

>Rodrigo Rosenfeld Rosas wrote:
>  
>
>>Jan Kiszka escreveu:
>>    
>>
>>>Ok, but even if you decide to let rt-mmap be non-deterministic, you
>>>still need some means to prevent the scenario you described above.
>>>Actually, all you need is some callback when the mapped memory block was
>>>actually released (munmap/application exit). Such a callback can be
>>>registered inside the rtdm_mmap handler as a vma_fileop.
>>>      
>>>
>>I have never worked with vma_fileop... I would need to learn it first.
>>    
>>
>
>Here is the patch to offer you access to those ops. Revert the previous
>version, then apply this one.
>
Actually I would have to revert the modifications I had to do for the 
patch to apply (some rejected chunks). But I think I'll update to the 
last SVN xenomai. BTW, is this patch for the SVN or 2.1 or 2.0.2 
xenomai? Or it would apply for all of them?

> It still needs some final documentation
>notes and a test on kernel 2.4. But is should already work on 2.6.
>  
>
I forgot to mention, I have one more problem. Since I call mmap on 
driver initialization (thus before any rtdm_dev_open), I do not have any 
rtdm_user_info_t, so I need to use current instead, but I'm not sure if 
this will work. Maybe mmap needs the 'current' struct of the user 
program... I don't know this very well... If that is true, so I'll have 
to do the maps in a non-rt context anyway...

>I also attached a demo for the handler usage based on my previous test
>framework. Just grab the pattern and put some useful code in the close
>handler...
>
>  
>
>>> It will run in
>>>non-RT, and could be used to mark the related hardware buffer as finally
>>>free for re-allocation.
>>>      
>>>
>>Now, I did realize that there is one more problem on my current design.
>>If the user application exits or is terminated, I'm not sure if the
>>close handler is called if the user forgot/was not able to. If it is
>>not, the buffer would be marked as used until I reloaded the driver...
>>Is the close handler invocated on application termination?
>>    
>>
>
>Yep, this is a general issue you cannot avoid: all skin objects besides
>task are only released when the user-space application cleans it up as
>it's ought to. There is no tracking of used resources, no auto-cleanup.
>If your application fails to close a device or socket, you will get a
>stalled handle which can be found in /proc/xenomai/rtdm/open_files.
>Writing the file descriptor number to this particular proc-file (e.g.
>"echo 3 > /proc/xeno...") will trigger an enforced close and will
>release the file descriptor again. Useful when debugging such broken
>applications.
>  
>
Yes, sorry... I forgot I've already read this... :)

Rodrigo.


	

	
		
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 




  reply	other threads:[~2006-02-14  2:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-10  0:09 [Xenomai-core] [PATCH] provide rtdm_mmap_to_user / rtdm_munmap Jan Kiszka
2006-02-10  0:37 ` Jan Kiszka
2006-02-10 20:58   ` Rodrigo Rosenfeld Rosas
2006-02-10 21:28     ` Rodrigo Rosenfeld Rosas
2006-02-11  0:35       ` Jan Kiszka
2006-02-11 13:11         ` Rodrigo Rosenfeld Rosas
2006-02-11 13:29           ` Jan Kiszka
2006-02-11 19:44             ` Rodrigo Rosenfeld Rosas
2006-02-12 22:45               ` Jan Kiszka
2006-02-13  3:22                 ` Rodrigo Rosenfeld Rosas
2006-02-14  0:39                   ` Jan Kiszka
2006-02-14  2:04                     ` Rodrigo Rosenfeld Rosas [this message]
2006-02-14  7:55                       ` Jan Kiszka
  -- strict thread matches above, loose matches on Subject: below --
2006-02-14 13:14 Rodrigo Rosenfeld Rosas
2006-02-14 19:13 ` Philippe Gerum
2006-02-15  0:30 ` Jan Kiszka
2006-02-15 14:53   ` Rodrigo Rosenfeld Rosas
2006-02-16 17:14     ` Rodrigo Rosenfeld Rosas

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=43F13AA3.3090702@domain.hid \
    --to=lbocseg@domain.hid \
    --cc=jan.kiszka@domain.hid \
    --cc=xenomai@xenomai.org \
    /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 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.