All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ignacio García Pérez" <iggarpe@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>, xenomai@xenomai.org
Subject: [Xenomai-help] Re: [Xenomai-core] More on rt pipes usage
Date: Tue, 15 Nov 2005 17:41:19 +0100	[thread overview]
Message-ID: <437A0FAF.5050303@domain.hid> (raw)
In-Reply-To: <4379E194.2050202@domain.hid>

Philippe Gerum wrote:

> Ignacio García Pérez wrote:
>
>> Hi,
>>
>> Suppose I have a kernel rt task that samples data at a certain rate and
>> writes it as messages into a rt pipe, from which it is read by a user
>> space non rt program.
>>
>> I want to limit the number of messages that are put into the pipe,
>> because otherwise if the user space program dies, it will grow endlessly
>> till it exausts the rt heap.
>>
>> What I want to do is to have a pipe that can hold a limited number of
>> messages such that rt_pipe_write will fail if it is full.
>>
>> Is there a way to know how many messages are there in the pipe?
>>
>> Even if there is a way, to prevent a (harmless) race condition, I would
>> need to lock the pipe between checking the number of messages and
>> calling rt_pipe_write. As far as I know, pipe locking belongs to the
>> nucleus and I'd like to stay in the native skin as much as possible.
>>
>> Another method would be to count how many messages I write, but then I'd
>> need some hook that notifies me when the user space program reads a
>> message so I can decrement the count.
>>
>> Any ideas?
>
>
> The plan is to be able to tell the pipe manager to use a user-provided
> heap instead of the system one; this way, exhausting the local heap
> (*) in RT space would be a clear sign that non-RT must be allowed to
> consume the pending data first. A simple interface to do that is
> missing, but the pipe manager already works with a variable heap pointer.

That mechanism would work only if you allow a local heap for *each* pipe
(otherwise one abused pipe may clobber others).

Personally, I need this feature to manage extreme error cases (the user
process dying). There is no point in knowing when the non-RT processing
is overwhelmed, because if that happens there is nothing you can do.

If you are producing more RT data that your non-RT processes can
consume, then you'll exhaust storage sooner or later. If you have RT
data production peaks, it's your responsibility to allocate enough
storage to provide for the worst case.

In other words. RT processes may *never* have to wait for non-RT
processes, because then they would become also non-RT.

So, the only use I can think of for limited pipe storage (be it in
message count or used memory) is to detect fatal error conditions, such
as the case of no one consuming data. And at least in my case, I
absolutely need this feature (if the non-RT process dies for any reason,
the system must not collapse).

>
> (*) Using the overall available memory seems a better metric than the
> number of pending messages, since it may often happen that messages
> have different sizes.
>
Mmm... yeah, you are probably right. I mentioned the number of messages
because I noticed the elems field in the queue structure and though it
would be easier to implement using it.

However, being this limitation just an "electric fence" for out of hand
scenarios, the way you express the limit is not critial. If no one is
consuming data from non-RT space, the limit will be reached no matter if
you express it as messages or as memory.

Nacho.




  reply	other threads:[~2005-11-15 16:41 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-10 21:05 [Xenomai-help] Creation of a rt-queue from the user space ROSSIER Daniel
2005-11-11  9:30 ` [Xenomai-help] printk Ignacio García Pérez
2005-11-11 11:07   ` Dmitry Adamushko
2005-11-14 10:52     ` Ignacio García Pérez
2005-11-14 11:26       ` Philippe Gerum
2005-11-14 12:03         ` Dmitry Adamushko
2005-11-14 13:22           ` Philippe Gerum
2005-11-14 13:47             ` Philippe Gerum
2005-11-14 14:50               ` [Xenomai-core] " Dmitry Adamushko
2005-11-14 15:56                 ` [Xenomai-core] rt_pipe_* usage Ignacio García Pérez
2005-11-14 16:15                   ` [Xenomai-core] More on rt pipes usage Ignacio García Pérez
2005-11-15 13:24                     ` Philippe Gerum
2005-11-15 16:41                       ` Ignacio García Pérez [this message]
2005-11-14 16:23                   ` [Xenomai-core] rt_pipe_* usage Dmitry Adamushko
2005-11-14 16:36                     ` Ignacio García Pérez
2005-11-15 12:41                       ` [Xenomai-core] Web site error (API doc search) Ignacio García Pérez
2005-11-15 13:16                       ` [Xenomai-core] rt_pipe_* usage Philippe Gerum
2005-11-15 16:22                         ` Ignacio García Pérez
2005-11-16  5:38                           ` Philippe Gerum
2005-11-15  9:38                 ` [Xenomai-core] Re: [Xenomai-help] printk Philippe Gerum
2005-11-15 10:00                   ` Dmitry Adamushko
2005-11-16 12:58                     ` Philippe Gerum
2005-11-16 14:44                       ` Dmitry Adamushko
2005-11-17  9:44                       ` [Xenomai-help] Blocking reads from pipes Ignacio García Pérez
2005-11-17 10:21                         ` Romain Lenglet
2005-11-17 13:16                           ` Ignacio García Pérez
2005-11-17 15:11                             ` Dmitry Adamushko
2005-11-17 17:24                               ` Gilles Chanteperdrix
2005-11-17 17:55                                 ` [Xenomai-core] " Dmitry Adamushko
2005-11-17 19:17                                   ` Gilles Chanteperdrix
2005-11-17 19:45                                     ` Dmitry Adamushko
2005-11-18  8:57                                       ` Ignacio García Pérez
2005-11-18  9:10                                         ` Dmitry Adamushko
2005-11-17 19:40                                 ` Dmitry Adamushko
2005-11-17 10:46                         ` Dmitry Adamushko
2005-11-14 12:15       ` [Xenomai-help] xn_pipe_create [minor] Ignacio García Pérez
2005-11-14 13:53         ` Dmitry Adamushko
2005-11-14 16:28           ` Ignacio García Pérez
2005-11-14 16:29             ` Philippe Gerum
2005-11-14 16:41               ` Ignacio García Pérez
2005-11-14 16:52                 ` Dmitry Adamushko
2005-11-14 17:38                   ` Philippe Gerum
2005-11-14 18:33                     ` Dmitry Adamushko
2005-11-15  8:04                       ` Philippe Gerum
2005-11-14 18:03                   ` [Xenomai-help] Strange pipe behaviour Ignacio García Pérez
2005-11-16  5:45                     ` Philippe Gerum
2005-11-16  7:45                       ` Ignacio García Pérez
2005-11-16 11:45                         ` Philippe Gerum
2005-11-14 16:40             ` [Xenomai-help] xn_pipe_create [minor] Dmitry Adamushko
2005-11-12 19:45   ` [Xenomai-help] printk Philippe Gerum
2005-11-14 10:47   ` [Xenomai-help] Invalid characters in task's names Ignacio García Pérez
2005-11-14 11:39     ` Philippe Gerum
2005-11-11 14:08 ` [Xenomai-help] Creation of a rt-queue from the user space Jan Kiszka

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=437A0FAF.5050303@domain.hid \
    --to=iggarpe@domain.hid \
    --cc=rpm@xenomai.org \
    --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.