All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: Xenomai core <Xenomai-core@domain.hid>
Subject: Re: [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Fix interrupt handler tails
Date: Mon, 20 Jun 2011 23:13:27 +0200	[thread overview]
Message-ID: <4DFFB7F7.3040308@domain.hid> (raw)
In-Reply-To: <4DFFB2F8.7090301@domain.hid>

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

On 2011-06-20 22:52, Gilles Chanteperdrix wrote:
> On 06/20/2011 10:41 PM, Jan Kiszka wrote:
>> xnarch_switch_to is the central entry point for everyone. It may decide
>> to branch to switch_to or __switch_to, or it simply handles all on its
>> own - that's depending on the arch.
> 
> No, the Linux kernel does not know anything about xnarch_switch_to, so
> the schedule() function continues to use switch_to happily.
> xnarch_switch_to is only used to switch from xnthread_t to xnthread_t,
> by __xnpod_schedule(). Now, that some architecture (namely x86) decide
> that xnarch_switch_to should use switch_to (or more likely an inner
> __switch_to) when the xnthread_t has a non NULL user_task member is an
> implementation detail.
> 
>> Can you point out where in those paths irqs are disabled again (after
>> entering xnarch_switch_to)
> 
> They are not disabled again after xnarch_switch_to, they are disabled
> when starting switch_to.
> 
>  and left off for each of the unlocked
>> switching archs? I'm still skeptical that the need for disable irqs
>> during thread switch on some archs also leads to unconditionally
>> disabled hard irqs when returning from xnarch_switch_to.
>>
>> But even if that's all the case today, we would better set this
>> requirement in stone:
>>
>> diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
>> index f2fc2ab..c4c5807 100644
>> --- a/ksrc/nucleus/pod.c
>> +++ b/ksrc/nucleus/pod.c
>> @@ -2273,6 +2273,8 @@ reschedule:
>>
>>  	xnpod_switch_to(sched, prev, next);
>>
>> +	XENO_BUGON(NUCLEUS, !irqs_disabled_hw());
>> +
> 
> You misunderstand me: only after the second half context switch in the
> case of xnshadow_relax are the interrupts disabled. Because this second
> half-switch started as a switch_to and not an xnarch_switch_to, so,
> started as:
> 
> #define switch_to(prev,next,last)                                       \
> do {                                                                    \
>         local_irq_disable_hw_cond();                                    \
>         last = __switch_to(prev,task_thread_info(prev),
> task_thread_info(next));        \
>         local_irq_enable_hw_cond();                                     \
> } while (0)
> 
> (On ARM for instance).

OK, that's now clear, thanks.

> 
> But that is true, we could assert this in the shadow epilogue case.
> 

I've queued a patch.

Jan


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

      reply	other threads:[~2011-06-20 21:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1QXaC2-0007dE-Ar@domain.hid>
2011-06-17 16:53 ` [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Fix interrupt handler tails Gilles Chanteperdrix
2011-06-17 17:03   ` Jan Kiszka
2011-06-17 18:55     ` Gilles Chanteperdrix
2011-06-18 10:21       ` Jan Kiszka
2011-06-18 12:09         ` Gilles Chanteperdrix
2011-06-18 12:10           ` Jan Kiszka
2011-06-18 12:56             ` Gilles Chanteperdrix
2011-06-18 13:07               ` Jan Kiszka
2011-06-18 13:12                 ` Gilles Chanteperdrix
2011-06-18 13:16                   ` Jan Kiszka
2011-06-18 13:40                     ` Gilles Chanteperdrix
2011-06-18 13:47                       ` Jan Kiszka
2011-06-18 14:01                         ` Gilles Chanteperdrix
2011-06-18 14:06                           ` Jan Kiszka
2011-06-18 15:01                             ` Gilles Chanteperdrix
2011-06-18 15:57                               ` Jan Kiszka
2011-06-18 13:58                   ` Jan Kiszka
2011-06-19 15:41                     ` Gilles Chanteperdrix
2011-06-20 16:43                       ` Jan Kiszka
2011-06-20 17:33                         ` Gilles Chanteperdrix
2011-06-20 19:38                           ` Jan Kiszka
2011-06-20 19:41                             ` Gilles Chanteperdrix
2011-06-20 19:41                               ` Jan Kiszka
2011-06-20 19:51                                 ` Gilles Chanteperdrix
2011-06-20 20:41                                   ` Jan Kiszka
2011-06-20 20:52                                     ` Gilles Chanteperdrix
2011-06-20 21:13                                       ` Jan Kiszka [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=4DFFB7F7.3040308@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=Xenomai-core@domain.hid \
    --cc=gilles.chanteperdrix@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.