All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>, Xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] Xenomai 3: smokey test sched_tp causes oops when run in gdb
Date: Mon, 16 Mar 2015 21:00:43 +0100	[thread overview]
Message-ID: <5507366B.7060304@xenomai.org> (raw)
In-Reply-To: <5507329D.1040907@siemens.com>

On 03/16/2015 08:44 PM, Jan Kiszka wrote:
> On 2015-03-16 20:41, Philippe Gerum wrote:
>> On 03/16/2015 08:35 PM, Jan Kiszka wrote:
>>> On 2015-03-16 20:24, Philippe Gerum wrote:
>>>> On 03/16/2015 06:16 PM, Jan Kiszka wrote:
>>>>> Don't understand the reason for this multiple calls in details yet, but
>>>>> you can also trigger the bug by invoking pthread_setschedparam_ex twice
>>>>> in smokey's sched-tp.c. Fix pushed to for-forge.
>>>>>
>>>>
>>>> This is what has to be fixed, because guarding would only paper over the
>>>> issue for TP, but the latter would bite the same way with other existing
>>>> or future policies.
>>>
>>> You mean push the guard into xnsched_set_policy, e.g.?
>>>
>>
>> Or fix what might be a signal restart issue so that we don't end up
>> twice in xnsched_set_policy().
> 
> Again, already calling pthread_setschedparam_ex twice in a row on the
> same thread triggers the bug. There is no way around such a guard.
> 

Then yes, the proper fix should be pushed to xnsched_set_policy() instead:

diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index a6469db..093e3be 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -387,9 +387,11 @@ int xnsched_set_policy(struct xnthread *thread,
 	 * affect the previous class (such as touching thread->rlink
 	 * for instance).
 	 */
-	ret = xnsched_declare(sched_class, thread, p);
-	if (ret)
-		return ret;
+	if (sched_class != thread->base_class) {
+		ret = xnsched_declare(sched_class, thread, p);
+		if (ret)
+			return ret;
+	}

 	/*
 	 * As a special case, we may be called from __xnthread_init()

-- 
Philippe.


      reply	other threads:[~2015-03-16 20:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-11 14:47 [Xenomai] Xenomai 3: smokey test sched_tp causes oops when run in gdb Jan Kiszka
2015-03-11 15:12 ` Philippe Gerum
2015-03-16 14:43 ` Philippe Gerum
2015-03-16 15:31   ` Jan Kiszka
2015-03-16 16:00     ` Jan Kiszka
2015-03-16 16:02       ` Jan Kiszka
2015-03-16 16:09       ` Philippe Gerum
2015-03-16 16:42         ` Jan Kiszka
2015-03-16 17:16           ` Jan Kiszka
2015-03-16 19:24             ` Philippe Gerum
2015-03-16 19:35               ` Jan Kiszka
2015-03-16 19:41                 ` Philippe Gerum
2015-03-16 19:44                   ` Jan Kiszka
2015-03-16 20:00                     ` Philippe Gerum [this message]

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=5507366B.7060304@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=jan.kiszka@siemens.com \
    --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.