From: Jan Kiszka <jan.kiszka@domain.hid>
To: Andreas Glatz <AndreasGlatz@domain.hid>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] Kernel oops when reading /proc/xenomai/stats
Date: Thu, 11 Feb 2010 09:11:56 +0100 [thread overview]
Message-ID: <4B73BBCC.6040907@domain.hid> (raw)
In-Reply-To: <245373446233674495BCA5CA2FC1EB173713B4D0D1@domain.hid>
Andreas Glatz wrote:
> Hi,
>
>>>>> That's the kernel oops with additional debugging info (starts with 'HUHU' - see code below the oops):
>>>>>
>>>>> HUHU count=1 xnintr_count=-12
>>>> That's not good. What is your Xenomai version?
>>> Hardware=MPC8360, Linux=2.6.32, Xenomai=2.4.10, ipipe=2.8-00
>>>
>>>> Does everything work fine if you application terminates normally and
>>>> deletes the rt_intr objects explicitly?
>>> Checking...
>>>
>> And then you may want to track this down at the site that decrements
>> xnintr_count, ie. rt_intr_delete -> xnintr_detach.
>
> This Email contains three patches.
Good catches! But please post them as separated patches following the
well-know standards (proper subject, a short description, signed-off,
inlined patch against xenomai.git).
>
> The problem was in rt_intr_delete():
>
> First xnintr_detach() was called followed by xnintr_destroy() which in
> turn called xnintr_detach() once more. I'm assuming xnintr_destroy()
> is the right one to call.
>
> --- A/kernel/xenomai/skins/native/intr.c 2009-12-08 18:30:05.000000000 -0500
> +++ B/kernel/xenomai/skins/native/intr.c 2010-02-10 17:30:41.000000000 -0500
> @@ -373,8 +373,7 @@
>
> xnlock_put_irqrestore(&nklock, s);
>
> - err = xnintr_detach(&intr->intr_base);
> - xnintr_destroy(&intr->intr_base);
> + err = xnintr_destroy(&intr->intr_base);
Yep, that detach used to be redundant for a fairly long time.
But the actual bug is in xnintr_irq_attach/detach for
!CONFIG_XENO_OPT_SHIRQ: Those functions fail to maintain and evaluate
XN_ISR_ATTACHED like their big brothers do. So, if you are already at
it... :)
>
> if (rc == XNSYNCH_RESCHED)
> /* Some task has been woken up as a result of the deletion:
>
> This change makes xnintr_destroy() return the return value of
> xnintr_detach() as described in the comment.
>
> --- A/kernel/xenomai/nucleus/intr.c 2009-12-08 18:30:05.000000000 -0500
> +++ B/kernel/xenomai/nucleus/intr.c 2010-02-10 17:25:47.000000000 -0500
> @@ -638,7 +640,7 @@
> * @param intr The descriptor address of the interrupt object to
> * destroy.
> *
> - * @return 0 is returned on success. Otherwise, -EBUSY is returned if
> + * @return 0 is returned on success. Otherwise, -EINVAL is returned if
> * an error occurred while detaching the interrupt (see
> * xnintr_detach()).
> *
> @@ -654,8 +656,7 @@
>
> int xnintr_destroy(xnintr_t *intr)
> {
> - xnintr_detach(intr);
> - return 0;
> + return xnintr_detach(intr);
> }
>
> /*!
>
> I also found a minor issue. I think noone ever noticed that because
> the second parameter passed to xeno_flush_rq() is always named rq.
>
> --- A/include/xenomai/native/ppd.h 2009-12-08 18:30:05.000000000 -0500
> +++ B/include/xenomai/native/ppd.h 2010-02-10 17:36:18.000000000 -0500
> @@ -104,7 +104,7 @@
> if (unlikely(err)) { \
> if ((__rq) != &__native_global_rholder.__name##q) { \
> xnlock_get_irqsave(&nklock, s); \
> - nholder = popq((rq), holder); \
> + nholder = popq((__rq), holder); \
> appendq(&__native_global_rholder.__name##q, holder); \
> obj->rqueue = &__native_global_rholder.__name##q; \
> }
>
>
> Andreas
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2010-02-11 8:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-10 18:11 [Xenomai-help] Kernel oops when reading /proc/xenomai/stats Andreas Glatz
2010-02-10 18:22 ` Jan Kiszka
2010-02-10 18:23 ` Andreas Glatz
2010-02-10 18:33 ` Jan Kiszka
2010-02-10 22:52 ` Andreas Glatz
2010-02-11 8:11 ` Jan Kiszka [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-02-12 23:36 Andreas Glatz
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=4B73BBCC.6040907@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=AndreasGlatz@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.