Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-11 Thread Eric W. Biederman
David, all. My apologies. I'm tired and I don't have the energy to grok yet another part of the kernel right now. So I can not productively participate in this discussion. I do agree that the locking below dev_unicast_add() that was exposed by the macvlan driver is unmaintainable even if it is

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-11 Thread David Miller
From: [EMAIL PROTECTED] (Eric W. Biederman) Date: Thu, 11 Oct 2007 10:33:39 -0600 > Having ASSERT_RTNL warn if you were sleeping does not seem > intuitive from the name. > > This instance of convoluted locking seems like a complete > one off to me, and if it will warn about other constructs > cur

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-11 Thread Eric W. Biederman
Herbert Xu <[EMAIL PROTECTED]> writes: > Well thanks to that warning we're on our way of improving the > code that triggered it in such a way that this warning will soon > go silent. > > That's precisely the reason why I object to having this warning > removed. Now you have a good point that this

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-11 Thread Herbert Xu
On Thu, Oct 11, 2007 at 02:23:35AM -0600, Eric W. Biederman wrote: > > > So I would object to a patch that caused the RTNL_ASSERT to not > > warn about being called in an atomic context. > > ASSERT_RTNL does not warn about being called in an atomic context > today! Well it did didn't it or we wou

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-11 Thread Eric W. Biederman
Herbert Xu <[EMAIL PROTECTED]> writes: > On Thu, Oct 11, 2007 at 12:57:31AM -0600, Eric W. Biederman wrote: >> >> There was a practical suggestion by Herbert that ASSERT_RTNL have a >> might_sleep() added. That suggestion will currently result in >> ASSERT_RTNL firing unnecessarily from the macvl

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-11 Thread Herbert Xu
On Thu, Oct 11, 2007 at 12:57:31AM -0600, Eric W. Biederman wrote: > > There was a practical suggestion by Herbert that ASSERT_RTNL have a > might_sleep() added. That suggestion will currently result in > ASSERT_RTNL firing unnecessarily from the macvlan_open code path. As I've already said we sh

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-10 Thread Eric W. Biederman
David Miller <[EMAIL PROTECTED]> writes: > From: [EMAIL PROTECTED] (Eric W. Biederman) > Date: Fri, 28 Sep 2007 18:59:08 -0600 > >> >> Currently we have the call path: >> macvlan_open -> dev_unicast_add -> __dev_set_rx_mode -> >> __dev_set_promiscuity -> ASSERT_RTNL -> mutex_trylock >> >> W

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-10 Thread David Miller
From: [EMAIL PROTECTED] (Eric W. Biederman) Date: Fri, 28 Sep 2007 18:59:08 -0600 > > Currently we have the call path: > macvlan_open -> dev_unicast_add -> __dev_set_rx_mode -> > __dev_set_promiscuity -> ASSERT_RTNL -> mutex_trylock > > When mutex debugging is on taking a mutex complains i

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-07 Thread Patrick McHardy
Herbert Xu wrote: > On Tue, Oct 02, 2007 at 05:29:11PM +0200, Patrick McHardy wrote: > >>I think this doesn't completely fix it, when dev_unicast_add is >>interrupted by dev_mc_add before the unicast changes are performed, >>they will get committed in the dev_mc_add context, so we might still >>ca

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-02 Thread Herbert Xu
On Tue, Oct 02, 2007 at 05:29:11PM +0200, Patrick McHardy wrote: > > I think this doesn't completely fix it, when dev_unicast_add is > interrupted by dev_mc_add before the unicast changes are performed, > they will get committed in the dev_mc_add context, so we might still > call change_flags with

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-02 Thread Patrick McHardy
On Tue, 2 Oct 2007, Herbert Xu wrote: On Sun, Sep 30, 2007 at 05:47:30PM +0200, Patrick McHardy wrote: I'm a bit uncomfortable with having a function (change_flags) that's sometimes in a sleepable context and sometimes running with BH disabled. So how about splitting up the unicast/multicast

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-10-02 Thread Herbert Xu
On Sun, Sep 30, 2007 at 05:47:30PM +0200, Patrick McHardy wrote: > > In the IPv6 case we're only changing the multicast list, > so we're never calling into __dev_set_promiscuity. > > I actually even added a comment about this :) > > /* Unicast addresses changes may only happen under the r

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-09-30 Thread Patrick McHardy
Herbert Xu wrote: > On Sat, Sep 29, 2007 at 05:32:41PM +0200, Patrick McHardy wrote: > >>For unicast addresses its not strictly necessary since they may >>only be changed under the RTNL anyway. The reason why it takes >>the tx_lock is for consistency with multicast address handling, >>which can't

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-09-29 Thread Herbert Xu
On Sat, Sep 29, 2007 at 11:18:18AM -0600, Eric W. Biederman wrote: > > Regardless of the correctness of where we have ASSERT_RTNL. > I think not actually taking the mutex on the assertion failure path > (just so we can release it), is still a good deal regardless. Provided that you add a might_sle

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-09-29 Thread Herbert Xu
On Sat, Sep 29, 2007 at 05:32:41PM +0200, Patrick McHardy wrote: > > For unicast addresses its not strictly necessary since they may > only be changed under the RTNL anyway. The reason why it takes > the tx_lock is for consistency with multicast address handling, > which can't rely on the RTNL sinc

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-09-29 Thread Patrick McHardy
Eric W. Biederman wrote: > Regardless of the correctness of where we have ASSERT_RTNL. > I think not actually taking the mutex on the assertion failure path > (just so we can release it), is still a good deal regardless. Agreed. I actually have an identical patch somewhere that I wanted to submit

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-09-29 Thread Eric W. Biederman
Herbert Xu <[EMAIL PROTECTED]> writes: > Eric W. Biederman <[EMAIL PROTECTED]> wrote: >> >> Currently we have the call path: >> macvlan_open -> dev_unicast_add -> __dev_set_rx_mode -> >>__dev_set_promiscuity -> ASSERT_RTNL -> mutex_trylock >> >> When mutex debugging is on taking a mutex

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-09-29 Thread Patrick McHardy
Herbert Xu wrote: > Eric W. Biederman <[EMAIL PROTECTED]> wrote: > >>Currently we have the call path: >>macvlan_open -> dev_unicast_add -> __dev_set_rx_mode -> >> __dev_set_promiscuity -> ASSERT_RTNL -> mutex_trylock >> >>When mutex debugging is on taking a mutex complains if we are not >>al

Re: [PATCH] rtnl: Simplify ASSERT_RTNL

2007-09-28 Thread Herbert Xu
Eric W. Biederman <[EMAIL PROTECTED]> wrote: > > Currently we have the call path: > macvlan_open -> dev_unicast_add -> __dev_set_rx_mode -> >__dev_set_promiscuity -> ASSERT_RTNL -> mutex_trylock > > When mutex debugging is on taking a mutex complains if we are not > allowed to sleep. At

[PATCH] rtnl: Simplify ASSERT_RTNL

2007-09-28 Thread Eric W. Biederman
Currently we have the call path: macvlan_open -> dev_unicast_add -> __dev_set_rx_mode -> __dev_set_promiscuity -> ASSERT_RTNL -> mutex_trylock When mutex debugging is on taking a mutex complains if we are not allowed to sleep. At that point we have called netif_tx_lock_bh so we are clear