From: Pavel Machek <pma@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: Jan Kiszka <jan.kiszka@domain.hid>, xenomai@xenomai.org
Subject: Re: [Xenomai-help] kernel oopses when killing realtime task
Date: Wed, 13 Oct 2010 11:26:17 +0200 [thread overview]
Message-ID: <20101013092617.GB6902@domain.hid> (raw)
In-Reply-To: <1286961375.1759.71.camel@domain.hid>
Hi!
> > Thanks!
> >
> > I hope I applied the patch correctly, it was slightly
> > tricky... Unfortunately, it causes hang at first attempt to kill
> > realtime task :-(.
>
> Ah. Weird. The IRQ drain code is supposed to be called only when an
> interrupt is unregistered from the Xenomai layer, which is not directly
> related to killing a task. Maybe some of the task cleanup code involves
> unregistering IRQs though, so this might explain.
Task cleanup definitely unregisters IRQ, yes.
> > > +void ipipe_drain_interrupt(struct ipipe_domain *ipd, unsigned int irq)
> > > +{
> > > + struct ipipe_percpu_domain_data *p;
> > > + unsigned long flags;
> > > + int cpu;
> > > +
> > > + flags = ipipe_critical_enter(NULL);
> > > + clear_bit(IPIPE_HANDLE_FLAG, &ipd->irqs[irq].control);
> > > + clear_bit(IPIPE_STICKY_FLAG, &ipd->irqs[irq].control);
> > > + set_bit(IPIPE_PASS_FLAG, &ipd->irqs[irq].control);
> > > + ipipe_critical_exit(flags);
> > > +
> > > + for_each_online_cpu(cpu) {
> > > + local_irq_save_hw(flags);
> > > + p = ipipe_percpudom_ptr(ipd, cpu);
> > > + do {
> > > + local_irq_restore_hw(flags);
> > > + cpu_relax();
> > > + local_irq_save_hw(flags);
> > > + } while (test_bit(irq, p->irqpend_lomask) ||
> > > + test_bit(IPIPE_STALL_FLAG, &p->status));
> > > + local_irq_restore_hw(flags);
> > > + }
> > > +}
> > > +EXPORT_SYMBOL_GPL(ipipe_drain_interrupt);
> > > +
> >
> > This is the interesting place, right?
>
> Yes. I messed up. We need the test on the STALL bit to make 100% sure
> that we are not about clearing the function pointer under the feet of
> the wired IRQ dispatcher, but at the same time, we enter the drain
> routine with the STALL bit set for the target domain. So this code is
> plain silly (patent not granted, way too much prior art).
:-).
> As a quick check, you could try removing the second test_bit from the
> end loop condition.
Yes, with IPIPE_STALL_FLAG test removed it "works", but I assume that
at that point it is placebo patch ;-).
Should we test IPIPE_STALL_FLAG on all but current CPUs?
Pavel
next prev parent reply other threads:[~2010-10-13 9:26 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-07 11:57 [Xenomai-help] kernel oopses when killing realtime task Pavel Machek
2010-10-07 12:11 ` Gilles Chanteperdrix
2010-10-07 13:00 ` Gilles Chanteperdrix
2010-10-07 12:32 ` Jan Kiszka
2010-10-08 7:01 ` Pavel Machek
2010-10-08 7:20 ` Gilles Chanteperdrix
2010-10-08 8:17 ` Philippe Gerum
2010-10-08 8:41 ` Jan Kiszka
2010-10-08 8:57 ` Philippe Gerum
2010-10-08 9:00 ` Philippe Gerum
2010-10-08 9:41 ` Philippe Gerum
2010-10-13 9:03 ` Pavel Machek
2010-10-13 9:16 ` Philippe Gerum
2010-10-13 9:26 ` Pavel Machek [this message]
2010-10-13 14:52 ` Philippe Gerum
2010-10-25 16:48 ` Philippe Gerum
2010-10-25 18:10 ` Jan Kiszka
2010-10-25 19:08 ` Philippe Gerum
2010-10-25 19:11 ` Philippe Gerum
2010-10-25 19:15 ` Jan Kiszka
2010-10-25 19:20 ` Philippe Gerum
2010-10-25 19:22 ` Jan Kiszka
2010-10-25 21:12 ` Philippe Gerum
2010-10-25 21:22 ` Jan Kiszka
2010-10-25 21:40 ` Philippe Gerum
2010-10-25 21:47 ` Jan Kiszka
2010-10-26 4:43 ` Philippe Gerum
2010-10-26 5:22 ` Jan Kiszka
2010-10-26 19:33 ` Jan Kiszka
2010-10-28 5:17 ` Philippe Gerum
2010-10-28 7:31 ` Jan Kiszka
2010-10-28 7:38 ` Jan Kiszka
2010-10-28 7:46 ` Philippe Gerum
2010-11-07 15:15 ` Philippe Gerum
2010-11-07 16:22 ` Jan Kiszka
2010-11-07 16:55 ` Philippe Gerum
2010-11-07 16:59 ` Philippe Gerum
2010-11-07 17:19 ` Philippe Gerum
2010-11-09 8:01 ` Jan Kiszka
2010-11-09 8:26 ` Philippe Gerum
2010-11-09 8:39 ` Jan Kiszka
2010-11-09 9:36 ` Philippe Gerum
2010-11-09 13:12 ` Jan Kiszka
2010-11-12 8:48 ` Philippe Gerum
2010-11-12 9:14 ` Jan Kiszka
2010-11-12 13:57 ` Philippe Gerum
2010-11-12 14:30 ` Jan Kiszka
2010-11-12 17:42 ` Philippe Gerum
2010-11-12 18:42 ` Jan Kiszka
2010-11-14 21:28 ` Philippe Gerum
2010-10-07 14:07 ` 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=20101013092617.GB6902@domain.hid \
--to=pma@domain.hid \
--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.