All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [PATCH v2 1/4] POSIX: Fix SCHED_RR thread creation
Date: Wed, 18 Feb 2009 00:48:16 +0100	[thread overview]
Message-ID: <499B4CC0.9000803@domain.hid> (raw)
In-Reply-To: <499B04CA.3020509@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 2877 bytes --]

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Jan Kiszka wrote:
>>>>> Gilles Chanteperdrix wrote:
>>>>>> Jan Kiszka wrote:
>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>> Jan Kiszka wrote:
>>>>>>>>> Gilles Chanteperdrix wrote:
>>>>>>>>>> Jan Kiszka wrote:
>>>>>>>>>>> @@ -192,6 +192,9 @@ static void *__pthread_trampoline(void *arg)
>>>>>>>>>>>  
>>>>>>>>>>>  	param.sched_priority = iargs->prio;
>>>>>>>>>>>  	policy = iargs->policy;
>>>>>>>>>>> +	if (policy == SCHED_RR)
>>>>>>>>>>> +		/* Restrict round-robin scheduling to the Xenomai domain. */
>>>>>>>>>>> +		policy = SCHED_FIFO;
>>>>>>>>>> Should not there be the same thing in __wrap_pthread_setschedparam ?
>>>>>>>>> Yes, and setschedparam_ex, here we go:
>>>>>>>> Actually, I am wondering if we can not get rid of these calls to
>>>>>>>> __real_pthread_setschedparam, now that propagating kernel-space priority
>>>>>>>> to user-space is done by a signal ?
>>>>>>> Not with the existing code, as that only forwards prio changes, but no
>>>>>>> policy changes.
>>>>>> If we map SCHED_RR to SCHED_FIFO, are there any policy changes?
>>>>> Yes, the initial one. Keep in mind that not all pthread implementations
>>>>> may respect the pthread_attr or have problems assigning SCHED_FIFO to
>>>>> threads of non-root users.
>>>> Ok. What about calling xnshadow_renice in xnshadow_map ?
>>> Sorry, I can't follow. xnshadow_renice does not help user space to find
>>> the right policy, or what do you mean?
>> xnshadow_renice sends a signal to the user-space thread which in turn
>> calls __real_pthread_setschedparam.
> 
> Ah, and user space derives the policy from the prio. That's what I missed.
> 
>> The advantage of this solution is that it avoids calling
>> __real_pthread_setschedparam in many places in the user-space skins.
> 
> We would save the call in the trampolines at least (my other changes in
> the second revision were nonsense BTW - those paths belong to the
> non-Xenomai case). We would just have to pass the priority down on
> pthread_create as well.
> 
> Will look into this and come up with a new version for this patch. But
> that need not delay merging the others.

I played with it, but raising a signal from xnshadow_map is no good
idea: If we inject the signal before the migration, xnshadow_map fails
due to the pending signal, we exit to user space, run the signal,
restart the call, raise the signal, and so on. If we raise after
migration, we immediately force the new thread into secondary mode
again, definitely causing problems when the mode switch warning is
active, but also risking other regressions for xnshadow_map users that
expect to find themselves in primary mode on return.

In short: I think it is better to stick with my original version of this
patch.

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

  reply	other threads:[~2009-02-17 23:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-17 17:04 [Xenomai-core] [PATCH v2 0/4] Various fixes and cleanups Jan Kiszka
2009-02-17 17:04 ` [Xenomai-core] [PATCH v2 3/4] Add --enable-dlopen-skins configure switch Jan Kiszka
2009-02-17 17:04 ` [Xenomai-core] [PATCH v2 1/4] POSIX: Fix SCHED_RR thread creation Jan Kiszka
2009-02-17 17:15   ` Gilles Chanteperdrix
2009-02-17 17:28     ` Jan Kiszka
2009-02-17 17:37       ` Gilles Chanteperdrix
2009-02-17 17:47         ` Jan Kiszka
2009-02-17 17:50           ` Gilles Chanteperdrix
2009-02-17 17:57             ` Jan Kiszka
2009-02-17 18:17               ` Gilles Chanteperdrix
2009-02-17 18:19                 ` Jan Kiszka
2009-02-17 18:21                   ` Gilles Chanteperdrix
2009-02-17 18:41                     ` Jan Kiszka
2009-02-17 23:48                       ` Jan Kiszka [this message]
2009-02-18  7:51                         ` Jan Kiszka
2009-02-17 17:04 ` [Xenomai-core] [PATCH v2 4/4] POSIX: Do not auto-shadow main with dlopen enabled Jan Kiszka
2009-02-17 17:04 ` [Xenomai-core] [PATCH v2 2/4] Mark libs nodlopen on initial-exec TLS Jan Kiszka
2009-02-25 10:04 ` [Xenomai-core] [PATCH v2 0/4] Various fixes and cleanups Jan Kiszka
2009-02-25 11:19   ` Philippe Gerum

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=499B4CC0.9000803@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.