From: Kieran Mansley <kmansley@solarflare.com>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: muli@il.ibm.com, netdev@vger.kernel.org,
xen-devel@lists.xensource.com, Keir Fraser <keir@xensource.com>,
herbert@gondor.apana.org.au
Subject: Re: Re: [PATCH 3/4] [Net] Support Xen accelerated network plugin modules
Date: Tue, 22 May 2007 17:06:11 +0100 [thread overview]
Message-ID: <1179849971.28562.85.camel@moonstone.uk.level5networks.com> (raw)
In-Reply-To: <20070522080512.6c9528a1@freepuppy>
On Tue, 2007-05-22 at 08:05 -0700, Stephen Hemminger wrote:
> The same thing is already done to handle network protocols already.
> RCU is used for the object handle (including function pointers).
> You need to use:
> * put rcu structure in accelerator list member
> and initialize it to the callback
> * on addition increase refcount
> on deletion
> * call list_del_rcu() on removal
> * in rcu callback you do last step
> like drop module refcount and free.
Apologies for coming back to this, but I want to make sure this is going
to work before I write the code.
The current scheme uses a spin lock to protect the list and a reference
count for each item on that list. This reference count is initialised
to 1 when the accelerator module is loaded, incremented before each call
into the accelerator, decremented after it, and decremented when the
module's exit function is called as a result of rmmod being called on
the module. rmmod is then blocked. When the ref count reaches zero the
function pointers are set to NULL, resulting in no more calls into the
accelerator module, and the rmmod is unblocked. The accelerator now
exits safely.
The critical bits I don't understand about your suggested scheme are:
i) how deletion/list_del_rcu() is triggered (see below);
ii) how it prevents the accelerated module being unloaded in the middle
of call into that module.
I assume you're suggesting using the module use count to solve (ii), but
this essentially causes (i): if we increase the module use count for
each interface using the accelerator we can never unload the module
because there's no mechanism to request that an interface stop being
accelerated (and so decrease the ref count).
If you're suggesting using RCU to protect against the hooks being
modified during a call into them, that's only allowed if the protected
region doesn't block, and I'm not convinced that the protected regions
here (the calls into the accelerator module) will never block.
Apologies again if I've misinterpreted your suggestion,
Kieran
next prev parent reply other threads:[~2007-05-22 16:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-18 13:16 [PATCH 3/4] [Net] Support Xen accelerated network plugin modules Kieran Mansley
2007-05-21 17:50 ` Stephen Hemminger
2007-05-22 7:00 ` Kieran Mansley
2007-05-21 17:52 ` Stephen Hemminger
2007-05-22 7:15 ` Kieran Mansley
2007-05-22 7:28 ` Kieran Mansley
2007-05-22 7:48 ` [Xen-devel] " Keir Fraser
2007-05-22 7:59 ` Kieran Mansley
2007-05-22 12:44 ` Kieran Mansley
2007-05-22 14:07 ` Keir Fraser
2007-05-22 14:20 ` Kieran Mansley
2007-05-22 15:05 ` Stephen Hemminger
2007-05-22 16:06 ` Kieran Mansley [this message]
2007-05-25 6:53 ` Andi Kleen
2007-05-21 17:54 ` Stephen Hemminger
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=1179849971.28562.85.camel@moonstone.uk.level5networks.com \
--to=kmansley@solarflare.com \
--cc=herbert@gondor.apana.org.au \
--cc=keir@xensource.com \
--cc=muli@il.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
--cc=xen-devel@lists.xensource.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).