From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [bug] vfree/kfree under hard IRQ locks
Date: Sun, 11 Dec 2005 15:39:46 +0100 [thread overview]
Message-ID: <439C3A32.8020405@domain.hid> (raw)
In-Reply-To: <439C18EC.1070500@domain.hid>
Jan Kiszka wrote:
> Hi,
>
> I happened to stumble over this comment[1]. It made me curious,
> especially as it is not totally correct (the loop is executed in IRQ-off
> context, thus it *is* timecritical).
>
Critical should be understood here in the sense that IRQs are off while
the loop workload is high, which is fortunately not the case. Hence the
comment.
> While thinking about the possibility to convert the hard IRQ lock
> protection of kheapq into some Linux mutex or whatever, I analysed the
> contexts the users of this queue (__validate_heap_addr/xnheap_ioctl,
> xnheap_init_shared, xnheap_destroy_shared) execute in. Basically, it is
> Linux/secondary mode, but there are unfortunate exceptions:
>
> rt_heap_delete(): take nklock[2], then call xnheap_destroy_shared()[3].
> The latter will call __unreserve_and_free_heap()[4] which calls Linux
> functions like vfree()[5] or kfree()[6] -- I would say: not good! At
> least on SMP we could easily get trapped by non-deterministic waiting on
> Linux spinlocks inside those functions.
>
> The same applies to rt_queue_delete()[7].
>
Good spot. Better not calling the heap deletion routines under nklock
protection in the first place. The committed fix does just that for both
rt_heap_delete and rt_queue_delete.
> To clarify the relevance: These issues only concern the native skin, and
> they only hit during init and cleanup. Anyway, should get fixed.
>
> Jan
>
>
> [1]http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/nucleus/heap.c?v=SVN-trunk#L845
> [2]http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/skins/native/heap.c?v=SVN-trunk#L353
> [3]http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/skins/native/heap.c?v=SVN-trunk#L365
> [4]http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/nucleus/heap.c?v=SVN-trunk#L1157
> [5]http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/nucleus/heap.c?v=SVN-trunk#L1092
> [6]http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/nucleus/heap.c?v=SVN-trunk#L1100
> [7]http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/skins/native/queue.c?v=SVN-trunk#L338
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core
--
Philippe.
next prev parent reply other threads:[~2005-12-11 14:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-11 12:17 [Xenomai-core] [bug] vfree/kfree under hard IRQ locks Jan Kiszka
2005-12-11 14:39 ` Philippe Gerum [this message]
2005-12-11 17:36 ` Jan Kiszka
2005-12-11 18:12 ` Philippe Gerum
2005-12-11 18:29 ` Jan Kiszka
2005-12-11 19:06 ` Philippe Gerum
2005-12-11 19:22 ` Jan Kiszka
2005-12-11 20:23 ` Philippe Gerum
2005-12-30 12: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=439C3A32.8020405@domain.hid \
--to=rpm@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.