[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101221105103.GA32744@htj.dyndns.org>
Date: Tue, 21 Dec 2010 11:51:04 +0100
From: Tejun Heo <tj@...nel.org>
To: David Miller <davem@...emloft.net>
Cc: mchan@...adcom.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next-2.6] bnx2: remove cancel_work_sync() from
remove_one
Hello, David.
On Mon, Dec 20, 2010 at 01:11:46PM -0800, David Miller wrote:
> It would but we can't just make the change over to del_timer_sync()
> otherwise we'd deadlock on netif_tx_lock().
>
> But I think things might be OK as-is.
>
> The timer is deleted by dev_deactivate_many() which resets the qdisc
> to the no-op qdisc. Then it deletes the timer.
>
> Any running timer will complete or see the no-op qdisc attached and
> return immediately.
>
> synchronize_rcu() is then executed which guarentees completion.
>
> Since both the watchdog timer itself and the del_timer() call run
> with netif_tx_lock() held, this makes sure the timer, once deleted,
> will only see the no-op qdisc and return immediately if it is
> amidst running, else it has already returned when the timer delete
> completes.
>
> So we might be OK here.
Yeah, I agree the synchronize_rcu() there would guarantee the actual
timer completion but as it currently stands it looks a bit too subtle.
Maybe it's a good idea to add a big fat comment explaining that the
the timer is guaranteed to stop after close() and how it's guaranteed
through synchronize_rcu() at the moment? Also, it might be better to
use synchronize_sched() there as timer synchronization through
synchronize_rcu() is more of a happy accident.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists