From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [PATCH] Add sigdebug unit test
Date: Thu, 26 Jan 2012 15:36:04 +0100 [thread overview]
Message-ID: <4F2164D4.2050501@domain.hid> (raw)
In-Reply-To: <4F214D7A.5020901@domain.hid>
On 2012-01-26 13:56, Jan Kiszka wrote:
>>> To trigger the enforced task termination without leaving any broken
>>> states behind, there is one option: rt_task_spin. Surprisingly for me,
>>> it actually spins in the kernel, thus triggers the second level if
>>> waiting long enough. I wonder, though, if that behavior shouldn't be
>>> improved, ie. the spinning loop be closed in user space - which would
>>> take away that option again.
>>>
>>> Thoughts?
>>>
>>
>> Tick-based timing is going to be the problem for determining the
>> spinning delay, unless we expose it in the vdso on a per-skin basis,
>> which won't be pretty.
>
> I see. But we should possibly add some signal-pending || amok test to
> that kernel loop. That would also kill my test design, but it makes
> otherwise some sense I guess.
I'm thinking of a change like this:
diff --git a/ksrc/skins/native/syscall.c b/ksrc/skins/native/syscall.c
index acf0375..39204b4 100644
--- a/ksrc/skins/native/syscall.c
+++ b/ksrc/skins/native/syscall.c
@@ -1020,13 +1020,21 @@ static int __rt_timer_inquire(struct pt_regs *regs)
static int __rt_timer_spin(struct pt_regs *regs)
{
+ xnthread_t *thread = xnpod_current_thread();
+ struct task_struct *p = current;
+ RTIME etime;
RTIME ns;
if (__xn_safe_copy_from_user(&ns, (void __user *)__xn_reg_arg1(regs),
sizeof(ns)))
return -EFAULT;
- rt_timer_spin(ns);
+ etime = xnarch_get_cpu_tsc() + xnarch_ns_to_tsc(ns);
+ while ((SRTIME)(xnarch_get_cpu_tsc() - etime) < 0) {
+ if (signal_pending(p) || xnthread_amok_p(thread))
+ return -EINTR;
+ cpu_relax();
+ }
return 0;
}
Regarding testability of the second watchdog state: We could add a
syscall to sigtest_module e.g which has the current rt_timer_spin
semantics.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-01-26 14:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-25 16:21 [Xenomai-core] [PATCH] Add sigdebug unit test Jan Kiszka
2012-01-25 16:35 ` Gilles Chanteperdrix
2012-01-25 16:47 ` Jan Kiszka
2012-01-25 16:52 ` Jan Kiszka
2012-01-25 17:02 ` Gilles Chanteperdrix
2012-01-25 17:10 ` Jan Kiszka
2012-01-25 17:44 ` Gilles Chanteperdrix
2012-01-25 18:05 ` Jan Kiszka
2012-01-26 10:36 ` Jan Kiszka
2012-01-26 11:20 ` Philippe Gerum
2012-01-26 12:56 ` Jan Kiszka
2012-01-26 14:36 ` Jan Kiszka [this message]
2012-01-26 15:39 ` Jan Kiszka
2012-01-26 14:55 ` Gilles Chanteperdrix
2012-01-26 15:06 ` Jan Kiszka
2012-01-26 15:52 ` Gilles Chanteperdrix
2012-01-26 16:11 ` Jan Kiszka
2012-01-26 16:41 ` Gilles Chanteperdrix
2012-01-25 22:18 ` 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=4F2164D4.2050501@domain.hid \
--to=jan.kiszka@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.