From: Philippe Gerum <rpm@xenomai.org>
To: Dmitry Adamushko <dmitry.adamushko@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [pipe.c] hairy synchronization -> "flush the output queue upon closure"
Date: Fri, 18 Nov 2005 11:14:26 +0100 [thread overview]
Message-ID: <437DA982.3040603@domain.hid> (raw)
In-Reply-To: <OF9CBDF2DC.75483853-ONC12570BD.0036121E-C12570BD.0036D59F@datacon.at>
Dmitry Adamushko wrote:
> yep, it's a problem since data may be client-dependent. In such a case,
> for a new client old messages are just irrelevant. And xnpipe_release()
> cleans up the queus but, well, does it too earlier.
>
> so,
>
> 1) should xnpipe_open_handler() and xnpipe_close_handler() be called
> without holding a lock?
>
Yes, it on purpose. I know this make things a bit trickier since this breaks the overall
atomicity of the caller, but open/close hooks are expected to initiate/finalize
communication sessions, and that may take an unbounded amount of time, so we definitely
don't want to do this with the superlock being held.
> they are not used currently so I can't see.
>
> I intend to make xnpipe_open() completely atomic.
>
> 2) the cleaning of the queues (inq, outq) must take place atomically at
> the time when XNPIPE_USER_CONN is dropped.
>
> it's about something like
>
> lock();
>
> __clrbits(state->status,XNPIPE_USER_CONN);
>
> // clean up all the queues
>
> unlock();
>
> it looks like we can't make the whole xnpipe_release() atomic because of
> PREEMPT_RT + wake_up_interruptible_all() things, right? Or no.
You must _never_ _ever_ reschedule with the nucleus lock held; this is a major cause of
jittery I recently stumbled upon that was induced by xnpipe_read_wait() at that time. So
indeed, xnpipe_release() cannot be made atomic this way under a fully preemptible kernel.
>
>
> ---
>
> Dmitry
>
--
Philippe.
next prev parent reply other threads:[~2005-11-18 10:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-18 9:43 [Xenomai-core] [pipe.c] hairy synchronization -> "flush the output queue upon closure" Dmitry Adamushko
2005-11-18 9:58 ` Dmitry Adamushko
2005-11-18 10:14 ` Philippe Gerum [this message]
2005-11-18 10:17 ` Philippe Gerum
2005-11-18 10:43 ` Dmitry Adamushko
2005-11-18 11:07 ` Philippe Gerum
2005-11-18 12:43 ` Dmitry Adamushko
2005-11-20 10:20 ` Philippe Gerum
2005-11-18 11:53 ` Sebastian Smolorz
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=437DA982.3040603@domain.hid \
--to=rpm@xenomai.org \
--cc=dmitry.adamushko@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.