From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/rtdm: Fix driver reference counting
Date: Fri, 27 May 2016 10:33:33 +0200 [thread overview]
Message-ID: <20160527083333.GK22660@hermes.click-hack.org> (raw)
In-Reply-To: <57480435.7040408@web.de>
On Fri, May 27, 2016 at 10:24:21AM +0200, Jan Kiszka wrote:
> On 2016-05-27 08:58, Gilles Chanteperdrix wrote:
> > On Fri, May 27, 2016 at 08:36:43AM +0200, git repository hosting wrote:
> >> Module: xenomai-jki
> >> Branch: for-forge
> >> Commit: c9d83776c0ed882c71045dc32b340b57f88c5e00
> >> URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=c9d83776c0ed882c71045dc32b340b57f88c5e00
> >>
> >> Author: Jan Kiszka <jan.kiszka@siemens.com>
> >> Date: Fri May 27 08:32:41 2016 +0200
> >>
> >> cobalt/rtdm: Fix driver reference counting
> >>
> >> The rtdm smokey test triggered a BUG due to rtdm_dev_unregister not
> >> taking the reference counter of a driver into account. Fix this by
> >> moving the check into unregister_driver directly.
> >
> > Did you have a look at commit
> > 96e85548a56c8c7fbd6d64c079701483a8e5da27 ?
> > This looks like a revert, so since the commit was fixing something,
> > I believe you are reintroducting a bug.
> >
>
> Didn't see that. However, that commit was wrong because you were mixing
> up different reference counters. One is that for devices, which is
> decreased in __rtdm_put_device. The other is what un/register_driver
> have to handle: that of the corresponding rtdm_driver. A device might
> pass earlier than a driver because the latter may manage multiple
> devices - exactly what the unit test checks.
>
> Maybe you can describe what scenarios was triggering the issue back, and
> we can check if it reoccurred and fix it for good.
Well, that was pretty simple, removing kernel modules registering
devices (in my case it was rtnet.ko), would fail to unregister some
part of the driver (some proc or sys files if I remember correctly),
so that reinserting the driver would first cause some warning, and
after several rmmod/insmod result in a crash or a simple failure I
do not remember. I traced that to the fact that the test for the
reference counter in unregister_driver was failing because the
reference counter had already been decremented elsewhere. This was a
long time ago, I do not remember all the details, but I think it is
something like that.
--
Gilles.
https://click-hack.org
next prev parent reply other threads:[~2016-05-27 8:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1b6BNz-0003SF-Fa@sd-51317.xenomai.org>
2016-05-27 6:58 ` [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/rtdm: Fix driver reference counting Gilles Chanteperdrix
2016-05-27 8:24 ` Jan Kiszka
2016-05-27 8:33 ` Gilles Chanteperdrix [this message]
2016-05-27 9:10 ` Jan Kiszka
2016-05-27 9:39 ` Jan Kiszka
2016-05-27 10:50 ` 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=20160527083333.GK22660@hermes.click-hack.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@web.de \
--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.