From: Jan Kiszka <jan.kiszka@domain.hid>
To: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [RFC][PATCH 6/9] Add XNSYNCH_FWDROB
Date: Mon, 01 Sep 2008 10:57:07 +0200 [thread overview]
Message-ID: <48BBAE63.8010008@domain.hid> (raw)
In-Reply-To: <48BBA9E6.5070400@domain.hid>
Intermediate helper as long as skins implement fast locking and related
owner tracking on their own: Add 'forward XN_ROBBED state' to the caller
of xnsynch_sleep_on so that the correct owner can be looked up there.
---
include/nucleus/synch.h | 3 ++-
ksrc/nucleus/pod.c | 6 ++++--
ksrc/nucleus/synch.c | 18 +++++++++++++-----
3 files changed, 19 insertions(+), 8 deletions(-)
Index: b/include/nucleus/synch.h
===================================================================
--- a/include/nucleus/synch.h
+++ b/include/nucleus/synch.h
@@ -30,10 +30,11 @@
#define XNSYNCH_NOPIP 0x0
#define XNSYNCH_PIP 0x2
#define XNSYNCH_DREORD 0x4
+#define XNSYNCH_FWDROB 0x8
#if defined(__KERNEL__) || defined(__XENO_SIM__)
-#define XNSYNCH_CLAIMED 0x8 /* Claimed by other thread(s) w/ PIP */
+#define XNSYNCH_CLAIMED 0x10 /* Claimed by other thread(s) w/ PIP */
/* Spare flags usable by upper interfaces */
#define XNSYNCH_SPARE0 0x01000000
Index: b/ksrc/nucleus/synch.c
===================================================================
--- a/ksrc/nucleus/synch.c
+++ b/ksrc/nucleus/synch.c
@@ -231,12 +231,20 @@ redo:
if (xnthread_test_info(thread, XNROBBED)) {
/* Somebody stole us the ownership while we were ready
to run, waiting for the CPU: we need to wait again
- for the resource. */
- if (timeout_mode != XN_RELATIVE || timeout == XN_INFINITE)
- goto redo;
+ for the resource, here or at caller site. */
+ if (timeout_mode != XN_RELATIVE || timeout == XN_INFINITE) {
+ if (testbits(synch->status, XNSYNCH_FWDROB))
+ goto unlock_and_exit;
+ else
+ goto redo;
+ }
timeout = xntimer_get_timeout_stopped(&thread->rtimer);
- if (timeout > 1) /* Otherwise, it's too late. */
- goto redo;
+ if (timeout > 1) { /* Otherwise, it's too late. */
+ if (testbits(synch->status, XNSYNCH_FWDROB))
+ goto unlock_and_exit;
+ else
+ goto redo;
+ }
xnthread_set_info(thread, XNTIMEO);
}
Index: b/ksrc/nucleus/pod.c
===================================================================
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -1400,13 +1400,15 @@ void xnpod_suspend_thread(xnthread_t *th
"(thread=%s, mask=%lx)?!",
thread->name, mask);
);
- xnthread_clear_info(thread, XNRMID | XNTIMEO);
+ xnthread_clear_info(thread,
+ XNRMID | XNTIMEO | XNROBBED);
xnthread_set_info(thread, XNBREAK);
goto unlock_and_exit;
}
#endif /* CONFIG_XENO_OPT_PERVASIVE */
- xnthread_clear_info(thread, XNRMID | XNTIMEO | XNBREAK | XNWAKEN | XNROBBED);
+ xnthread_clear_info(thread, XNRMID | XNTIMEO | XNBREAK |
+ XNWAKEN | XNROBBED);
}
/* Don't start the timer for a thread indefinitely delayed by
next prev parent reply other threads:[~2008-09-01 8:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-01 8:53 [Xenomai-core] [PATCH 0/9] Fast mutex rework, native support Jan Kiszka
2008-09-01 8:39 ` [Xenomai-core] [PATCH 1/9] Always register threads by their base Jan Kiszka
2008-09-01 8:44 ` [Xenomai-core] [PATCH 2/9] Switch to handle-based fast mutex owners Jan Kiszka
2008-09-01 11:58 ` Gilles Chanteperdrix
2008-09-01 13:48 ` Jan Kiszka
2008-09-01 14:00 ` Gilles Chanteperdrix
2008-09-01 14:03 ` Jan Kiszka
2008-09-01 14:08 ` Jan Kiszka
2008-09-02 12:31 ` Gilles Chanteperdrix
2008-09-05 8:34 ` [Xenomai-core] [PATCH 2/9] Switch to handle-based fast mutex owners - v2 Jan Kiszka
2008-09-05 9:40 ` Gilles Chanteperdrix
2008-09-05 9:46 ` Jan Kiszka
2008-09-05 9:50 ` Gilles Chanteperdrix
2008-09-05 9:55 ` Jan Kiszka
2008-09-05 9:57 ` Gilles Chanteperdrix
2008-09-01 8:45 ` [Xenomai-core] [PATCH 3/9] Remove xnarch_atomic_intptr wrappers Jan Kiszka
2008-09-01 8:47 ` [Xenomai-core] [PATCH 4/9] Spread xeno_set_current Jan Kiszka
2008-09-01 8:54 ` [Xenomai-core] [RFC][PATCH 5/9] Allow lock stealing via pthread_mutex_trylock Jan Kiszka
2008-09-01 9:58 ` Gilles Chanteperdrix
2008-09-01 8:57 ` Jan Kiszka [this message]
2008-09-01 10:00 ` [Xenomai-core] [RFC][PATCH 6/9] Add XNSYNCH_FWDROB Gilles Chanteperdrix
2008-09-01 9:01 ` [Xenomai-core] [RFC][PATCH 8/9] Native support for fast mutexes Jan Kiszka
2008-09-05 8:36 ` [Xenomai-core] [RFC][PATCH 8/9] Native support for fast mutexes - v2 Jan Kiszka
2008-09-01 9:06 ` [Xenomai-core] [RFC][PATCH 9/9] Optimize xnsynch_sleep_on for XN_NONBLOCK Jan Kiszka
2008-09-01 9:12 ` [Xenomai-core] [RFC][PATCH 7/9] Switch POSIX mutexes to XNSYNCH_FWDROB Jan Kiszka
2008-09-01 10:01 ` Gilles Chanteperdrix
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=48BBAE63.8010008@domain.hid \
--to=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.