From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: "Marc Strämke" <marc.straemke@eltropuls.de>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] rtnet locking/socket SKBs
Date: Sun, 27 Sep 2015 23:32:36 +0200 [thread overview]
Message-ID: <20150927213236.GA23716@hermes.click-hack.org> (raw)
In-Reply-To: <8492059.5Osop05oYh@eltrolinux48.eltroad.eltropuls>
On Thu, Jun 04, 2015 at 12:41:47PM +0200, Marc Strämke wrote:
> Am Mittwoch, 3. Juni 2015, 19:09:36 schrieb Marc Strämke:
> > How is the reference count maintained for the rtdm devices, is that the
> > refcount in the rtdm_fd structure (fd->refs). There is also a driver
> > refcount, I am actually somewhat confused how this is maintained...
>
> So I got mostly down to the issue but I need some input from someone more
> knowledged in rtnets design:
> The reference count of an open AF_PACKET socket is not dropping to zero
> because there are still skb in the sockets skb pool and
> rtskb_socket_pool_trylock increments the fds reference
> count. rt_socket_cleanup would release the skb pool but never gets called.
>
> What I do not really understand at this moment is why the fd reference count
> gets incremented at all when the socket gets a skb in its pool?
> Is there any reason to not close a socket while it still has associated skbs
> in the pool? They will never get cleared if the application crashes If I am
> not mistaken.
Ok, so now I had a look at the issue. The counter is not dropping to
zero probably because you have unqueued messages in the socket
"incoming" queue, the pool is locked when a packet is out of the
pool, not when a packet is in the pool.
Anyway, you are right, this is redundant, but not only for
af_packet, also for udp and tcp: when the packet is outside any pool
or queue, the file descriptor is locked, so, the module can not be
removed and leak can not occur, so there is no reason to keep track
of the fact that it is outside any queue, and we can probably remove
the locking in the socket pools.
What may be missing is that creating sockets should lock the
corresponding kernel module.
--
Gilles.
https://click-hack.org
next prev parent reply other threads:[~2015-09-27 21:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 12:56 [Xenomai] Problem with RTNET Packet Socket (or RTDM in general) in Xenomai 3 Marc Strämke
2015-06-03 13:02 ` Gilles Chanteperdrix
2015-06-03 17:09 ` Marc Strämke
2015-06-04 10:41 ` [Xenomai] rtnet locking/socket SKBs Marc Strämke
2015-06-04 10:56 ` Gilles Chanteperdrix
2015-06-04 11:09 ` Marc Strämke
2015-06-04 11:12 ` [Xenomai] [PATCH] Proof of concept: disable locking in af_packet skb pool Marc Strämke
2015-06-04 14:15 ` Gilles Chanteperdrix
2015-06-04 11:20 ` [Xenomai] rtnet locking/socket SKBs Gilles Chanteperdrix
2015-06-04 11:31 ` Gilles Chanteperdrix
2015-06-04 12:35 ` Marc Strämke
2015-06-04 12:37 ` Gilles Chanteperdrix
2015-06-04 12:40 ` Marc Strämke
2015-06-04 14:07 ` Gilles Chanteperdrix
2015-09-27 21:32 ` Gilles Chanteperdrix [this message]
2015-09-29 21:59 ` Gilles Chanteperdrix
2015-09-30 14:33 ` Marc Strämke
2015-09-30 14:41 ` Gilles Chanteperdrix
2015-09-30 14:44 ` Marc Strämke
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=20150927213236.GA23716@hermes.click-hack.org \
--to=gilles.chanteperdrix@xenomai.org \
--cc=marc.straemke@eltropuls.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.