Netdev List
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: David Miller <davem@davemloft.net>
Cc: dbanerje@akamai.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] netpoll: allow cleanup to be synchronous
Date: Thu, 18 Oct 2018 07:29:29 -0400	[thread overview]
Message-ID: <20181018112929.GA2601@hmswarspite.think-freely.org> (raw)
In-Reply-To: <20181017.214705.2139316496548022085.davem@davemloft.net>

On Wed, Oct 17, 2018 at 09:47:05PM -0700, David Miller wrote:
> From: Debabrata Banerjee <dbanerje@akamai.com>
> Date: Fri, 12 Oct 2018 12:59:29 -0400
> 
> > @@ -826,7 +826,10 @@ static void netpoll_async_cleanup(struct work_struct *work)
> >  
> >  void __netpoll_free_async(struct netpoll *np)
> >  {
> > -	schedule_work(&np->cleanup_work);
> > +	if (rtnl_is_locked())
> > +		__netpoll_cleanup(np);
> > +	else
> > +		schedule_work(&np->cleanup_work);
> >  }
> 
> rtnl_is_locked() says only that the RTNL mutex is held by someone.
> 
> It does not necessarily say that it is held by the current execution
> context.
> 
> Which means you could erronesly run this synchronously when another
> thread has the RTNL mutex held, not you.
> 
> I'm not applying this, sorry.
> 


Agreed, this doesn't make sense.  If you want a synchronous cleanup, create a
wrapper function that creates a wait queue, calls __netpoll_free_async, and
blocks on the wait queue completion.  Modify the cleanup_work method(s) to
complete the wait queue, and you've got what you want.

Neil

  reply	other threads:[~2018-10-18 19:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12 16:59 [PATCH net-next] netpoll: allow cleanup to be synchronous Debabrata Banerjee
2018-10-12 17:27 ` Banerjee, Debabrata
2018-10-18  4:47 ` David Miller
2018-10-18 11:29   ` Neil Horman [this message]
2018-10-18 15:17     ` Banerjee, Debabrata
2018-10-18 16:59       ` Neil Horman
2018-10-18 17:47         ` Banerjee, Debabrata

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=20181018112929.GA2601@hmswarspite.think-freely.org \
    --to=nhorman@tuxdriver.com \
    --cc=davem@davemloft.net \
    --cc=dbanerje@akamai.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox