[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181018112929.GA2601@hmswarspite.think-freely.org>
Date:   Thu, 18 Oct 2018 07:29:29 -0400
From:   Neil Horman <nhorman@...driver.com>
To:     David Miller <davem@...emloft.net>
Cc:     dbanerje@...mai.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] netpoll: allow cleanup to be synchronous
On Wed, Oct 17, 2018 at 09:47:05PM -0700, David Miller wrote:
> From: Debabrata Banerjee <dbanerje@...mai.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
Powered by blists - more mailing lists
 
