From: Philippe Gerum <rpm@xenomai.org>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] Pending ownership and resource stealing
Date: Fri, 12 May 2006 00:39:12 +0200 [thread overview]
Message-ID: <4463BD10.9060200@domain.hid> (raw)
In-Reply-To: <17507.29090.396675.139304@domain.hid>
Gilles Chanteperdrix wrote:
> Philippe Gerum wrote:
> > Gilles Chanteperdrix wrote:
> > > Philippe Gerum wrote:
> > > > prio(task1) > prio(task2)
> > > >
> > > > 1. task1 grabs a resource
> > > > 2. task1 sleeps for some time
> > > > 3. task2 blocks requesting the resource
> > > > 4. task1 wakes up from the sleep and releases the resource to task2
> > > > 5. task1 wants the resource back immediately and calls
> > > > xnsynch_sleep_on() since the ownership has been transferred to task2
> > > > since step 4.
> > > > 6a. old way: task1 would block and task2 would run anyway, with a PIP
> > > > boost, blocking task1 until the resource is released
> > > > 6b. new way: task1 steals the resource previously granted to task2
> > > > directly from xnsynch_sleep_on(), but doing so, nobody downstream has
> > > > had a chance to update any skin-specific data, such as an additional
> > > > "owner" field.
> > >
> > > Posix skin mutexes work the new way without calling xnsynch_sleep_on, so
> > > probably need fixing.
> > >
> >
> > I don't see any additional information maintained by the skin, aside of
> > the sem->count field, so that should be ok as it is. Is there anything
> > else recorded for tracking the current ownership of a sem-mutex object?
>
> The mutex->count field is unconditionnaly set to 0 and task2 woken up
> when task1 releases the mutex, so that when task1 want the mutex again,
> it will appear as free, and task1 will get it without calling
> xnsynch_sleep_on, task2 will eventually wakeup spuriously or not
> depending on whether the mutex is free. So, setting the count to 0 when
> waking up seems wrong.
>
We just need to set it to 1 instead, just like if we were returning from
mutex_trylock_internal() successfully.
> In a nut shell, the posix skin should be changed to use the new feature
> instead of implementing its own behaviour.
>
There is no new feature per se, just an additional case upon return from
xnsynch_sleep_on() to take into account.
--
Philippe.
next prev parent reply other threads:[~2006-05-11 22:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-10 7:58 [Xenomai-core] [bug] zombie mutex owners Jan Kiszka
2006-05-10 9:16 ` Dmitry Adamushko
2006-05-10 10:07 ` Jan Kiszka
2006-05-10 10:40 ` Philippe Gerum
2006-05-10 10:52 ` Philippe Gerum
2006-05-10 11:49 ` Jan Kiszka
2006-05-10 16:39 ` Philippe Gerum
2006-05-10 12:28 ` Philippe Gerum
2006-05-10 16:55 ` [Xenomai-core] Pending ownership and resource stealing Philippe Gerum
2006-05-10 17:34 ` Gilles Chanteperdrix
2006-05-10 18:39 ` Philippe Gerum
2006-05-10 20:00 ` Gilles Chanteperdrix
2006-05-10 21:25 ` Philippe Gerum
2006-05-11 17:17 ` Gilles Chanteperdrix
2006-05-11 22:39 ` Philippe Gerum [this message]
2006-05-10 17:34 ` Jan Kiszka
2006-05-10 21:23 ` Philippe Gerum
2006-05-11 7:56 ` 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=4463BD10.9060200@domain.hid \
--to=rpm@xenomai.org \
--cc=gilles.chanteperdrix@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.