All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] False positive XENO_BUGON(NUCLEUS, need_resched == 0)?
Date: Fri, 27 Aug 2010 19:29:19 +0200	[thread overview]
Message-ID: <4C77F5EF.3010701@domain.hid> (raw)
In-Reply-To: <4C77F142.4030103@domain.hid>

Jan Kiszka wrote:
> Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> Gilles Chanteperdrix wrote:
>>>> Jan Kiszka wrote:
>>>>> Hi,
>>>>>
>>>>> I'm hitting that bug check in __xnpod_schedule after
>>>>> xnintr_clock_handler issued a xnpod_schedule like this:
>>>>>
>>>>> 	if (--sched->inesting == 0) {
>>>>> 		__clrbits(sched->status, XNINIRQ);
>>>>> 		xnpod_schedule();
>>>>> 	}
>>>>>
>>>>> Either the assumption behind the bug check is no longer correct (no call
>>>>> to xnpod_schedule() without a real need), or we should check for
>>>>> __xnpod_test_resched(sched) in xnintr_clock_handler (but under nklock then).
>>>>>
>>>>> Comments?
>>>> You probably have a real bug. This BUG_ON means that the scheduler is
>>>> about to switch context for real, whereas the resched bit is not set,
>>>> which is wrong.
>>> This happened over my 2.6.35 port - maybe some spurious IRQ enabling.
>>> Debugging further...
>> You should look for something which changes the scheduler state without
>> setting the resched bit, or for something which clears the bit without
>> taking the scheduler changes into account.
> 
> It looks like a generic Xenomai issue on SMP boxes, though a mostly
> harmless one:
> 
> The task that was scheduled in without XNRESCHED set locally has been
> woken up by a remote CPU. The waker requeued the task and set the
> resched condition for itself and in the resched proxy mask for the
> remote CPU. But there is at least one place in the Xenomai code where we
> drop the nklock between xnsched_set_resched and xnpod_schedule:
> do_taskexit_event (I bet there are even more). Now the resched target
> CPU runs into a timer handler, issues xnpod_schedule unconditionally,
> and happens to find the woken-up task before it is actually informed via
> an IPI.
> 
> I think this is a harmless race, but it ruins the debug assertion
> "need_resched != 0".

Not that harmless, since without the debugging code, we would miss the
reschedule too...

-- 
					    Gilles.


  reply	other threads:[~2010-08-27 17:29 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-27  9:22 [Xenomai-core] False positive XENO_BUGON(NUCLEUS, need_resched == 0)? Jan Kiszka
2010-08-27  9:43 ` Gilles Chanteperdrix
2010-08-27 12:32   ` Jan Kiszka
2010-08-27 12:39     ` Gilles Chanteperdrix
2010-08-27 17:09       ` Jan Kiszka
2010-08-27 17:29         ` Gilles Chanteperdrix [this message]
2010-08-27 17:31           ` Gilles Chanteperdrix
2010-08-27 17:51             ` Jan Kiszka
2010-08-27 18:01               ` Gilles Chanteperdrix
2010-08-27 18:09                 ` Jan Kiszka
2010-08-28 16:40                   ` Philippe Gerum
2010-08-30  8:51                     ` Jan Kiszka
2010-08-30  9:15                       ` Jan Kiszka
2010-08-30 15:11                       ` Philippe Gerum
2010-08-30 15:39                         ` Jan Kiszka
2010-08-31  7:09                           ` Philippe Gerum
2010-08-31 14:52                             ` Philippe Gerum
2010-09-01  8:39                             ` Gilles Chanteperdrix
2010-09-01 10:52                               ` Philippe Gerum
2010-09-01 11:12                                 ` Gilles Chanteperdrix
2010-08-30 15:52                         ` 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=4C77F5EF.3010701@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=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.