From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Philippe Gerum <rpm@xenomai.org>
Cc: Jan Kiszka <jan.kiszka@domain.hid>, xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] False positive XENO_BUGON(NUCLEUS, need_resched == 0)?
Date: Wed, 1 Sep 2010 13:12:57 +0200 [thread overview]
Message-ID: <20100901111257.GA13058@domain.hid> (raw)
In-Reply-To: <1283338335.1709.1923.camel@domain.hid>
On Wed, Sep 01, 2010 at 12:52:15PM +0200, Philippe Gerum wrote:
> On Wed, 2010-09-01 at 10:39 +0200, Gilles Chanteperdrix wrote:
> > Philippe Gerum wrote:
> > > On Mon, 2010-08-30 at 17:39 +0200, Jan Kiszka wrote:
> > >> Philippe Gerum wrote:
> > >>> Ok, Gilles did not grumble at you, so I'm daring the following patch,
> > >>> since I agree with you here. Totally untested, not even compiled, just
> > >>> for the fun of getting lockups and/or threads in limbos. Nah, just
> > >>> kidding, your shiny SMP box should be bricked even before that:
> > >>>
> > >>> diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h
> > >>> index f75c6f6..6ad66ba 100644
> > >>> --- a/include/nucleus/sched.h
> > >>> +++ b/include/nucleus/sched.h
> > >>> @@ -184,10 +184,9 @@ static inline int xnsched_self_resched_p(struct xnsched *sched)
> > >>> #define xnsched_set_resched(__sched__) do { \
> > >>> xnsched_t *current_sched = xnpod_current_sched(); \
> > >>> xnarch_cpu_set(xnsched_cpu(__sched__), current_sched->resched); \
> > >> To increase the probability of regressions: What about moving the above
> > >> line...
> > >>
> > >>> - if (unlikely(current_sched != (__sched__))) \
> > >>> - xnarch_cpu_set(xnsched_cpu(__sched__), (__sched__)->resched); \
> > >>> setbits(current_sched->status, XNRESCHED); \
> > >>> - /* remote will set XNRESCHED locally in the IPI handler */ \
> > >>> + if (current_sched != (__sched__)) \
> > >>> + setbits((__sched__)->status, XNRESCHED); \
> > >> ...into this conditional block? Then you should be able to...
> > >>
> > >>> } while (0)
> > >>>
> > >>> void xnsched_zombie_hooks(struct xnthread *thread);
> > >>> diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
> > >>> index 623bdff..cff76c2 100644
> > >>> --- a/ksrc/nucleus/pod.c
> > >>> +++ b/ksrc/nucleus/pod.c
> > >>> @@ -285,13 +285,6 @@ void xnpod_schedule_handler(void) /* Called with hw interrupts off. */
> > >>> xnshadow_rpi_check();
> > >>> }
> > >>> #endif /* CONFIG_SMP && CONFIG_XENO_OPT_PRIOCPL */
> > >>> - /*
> > >>> - * xnsched_set_resched() did set the resched mask remotely. We
> > >>> - * just need to make sure that our rescheduling request won't
> > >>> - * be filtered out locally when testing for XNRESCHED
> > >>> - * presence.
> > >>> - */
> > >>> - setbits(sched->status, XNRESCHED);
> > >>> xnpod_schedule();
> > >>> }
> > >>>
> > >>> @@ -2167,10 +2160,10 @@ static inline int __xnpod_test_resched(struct xnsched *sched)
> > >>> {
> > >>> int cpu = xnsched_cpu(sched), resched;
> > >>>
> > >>> - resched = xnarch_cpu_isset(cpu, sched->resched);
> > >>> - xnarch_cpu_clear(cpu, sched->resched);
> > >>> + resched = testbits(sched->status, XNRESCHED);
> > >>> #ifdef CONFIG_SMP
> > >>> /* Send resched IPI to remote CPU(s). */
> > >>> + xnarch_cpu_clear(cpu, sched->resched);
> > >> ...drop the line above as well.
> > >>
> > >>> if (unlikely(xnsched_resched_p(sched))) {
> > >>> xnarch_send_ipi(sched->resched);
> > >>> xnarch_cpus_clear(sched->resched);
> > >>>
> > >
> > > Yes, I do think that we are way too stable on SMP boxes these days.
> > > Let's merge this as well to bring the fun back.
> > >
> >
> > The current cpu bit in the resched cpu mask allowed us to know whether
> > the local cpu actually needed rescheduling. At least on SMP. It may
> > happen that only remote cpus were set, so, in that case, we were only
> > sending the IPI, then exiting __xnpod_schedule.
> >
>
> So the choice here is, in SMP non-debug mode only, between:
>
> - setting and clearing a bit at each local rescheduling unconditionally
> - peeking at the runqueue uselessly at each rescheduling only involving
> remote threads
>
> The answer does not seem obvious.
Well... It will probably even be hard to come up with a benchmark which
shows a difference between the two solutions. So, if the current one is
the simplest one, then so be it.
--
Gilles.
next prev parent reply other threads:[~2010-09-01 11:12 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
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 [this message]
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=20100901111257.GA13058@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=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.