netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: "Keller, Jacob E" <jacob.e.keller@intel.com>,
	"vyasevic@redhat.com" <vyasevic@redhat.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"dingtianhong@huawei.com" <dingtianhong@huawei.com>,
	"vfalico@gmail.com" <vfalico@gmail.com>,
	"kaber@trash.net" <kaber@trash.net>,
	"jiri@resnulli.us" <jiri@resnulli.us>
Subject: Re: [PATCH v3 2/4] net: Allow for more then a single subclass for netif_addr_lock
Date: Wed, 04 Jun 2014 19:17:33 -0400	[thread overview]
Message-ID: <538FA90D.3050307@gmail.com> (raw)
In-Reply-To: <1401918131.24086.9.camel@jekeller-desk1.amr.corp.intel.com>

On 06/04/2014 05:42 PM, Keller, Jacob E wrote:
> On Fri, 2014-05-16 at 17:04 -0400, Vlad Yasevich wrote:
>> Currently netif_addr_lock_nested assumes that there can be only
>> a single nesting level between 2 devices.  However, if we
>> have multiple devices of the same type stacked, this fails.
>> For example:
>>  eth0 <-- vlan0.10 <-- vlan0.10.20
>>
>> A more complicated configuration may stack more then one type of
>> device in different order.
>> Ex:
>>   eth0 <-- vlan0.10 <-- macvlan0 <-- vlan1.10.20 <-- macvlan1
>>
>> This patch adds an ndo_* function that allows each stackable
>> device to report its nesting level.  If the device doesn't
>> provide this function default subclass of 1 is used.
>>
>> Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
>> ---
>>  include/linux/netdevice.h | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>> index fb912e8..9d4b1f1 100644
>> --- a/include/linux/netdevice.h
>> +++ b/include/linux/netdevice.h
>> @@ -1144,6 +1144,7 @@ struct net_device_ops {
>>  	netdev_tx_t		(*ndo_dfwd_start_xmit) (struct sk_buff *skb,
>>  							struct net_device *dev,
>>  							void *priv);
>> +	int			(*ndo_get_lock_subclass)(struct net_device *dev);
>>  };
>>  
>>  /**
>> @@ -2950,7 +2951,12 @@ static inline void netif_addr_lock(struct net_device *dev)
>>  
>>  static inline void netif_addr_lock_nested(struct net_device *dev)
>>  {
>> -	spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING);
>> +	int subclass = SINGLE_DEPTH_NESTING;
>> +
>> +	if (dev->netdev_ops->ndo_get_lock_subclass)
>> +		subclass = dev->netdev_ops->ndo_get_lock_subclass(dev);
>> +
>> +	spin_lock_nested(&dev->addr_list_lock, subclass);
>>  }
>>  
> 
> Hi,
> 
> I know this has already been applied. However, this commit causes a
> warning in include/linux/netdevice.h when W=1
> 
> In file included from ixgbe/ixgbe.h:35:0,
>                  from ixgbe/ixgbe_lib.c:29:
> include/linux/netdevice.h: In function ‘netif_addr_lock_nested’:
> include/linux/netdevice.h:2954:6: warning: variable ‘subclass’ set but not used [-Wunused-but-set-variable]
>   int subclass = SINGLE_DEPTH_NESTING;
>       ^
> 
> This only occurs if CONFIG_DEBUG_LOCK_ALLOC=Y, and there seems to be no
> easy fix for the warning, due to how spin_lock_nested is a macro that
> discards the second parameter when DEBUG_LOCK_ALLOC is disabled.
> 
> I'm not sure how big a deal this is, considering that it only occurs at
> W=1, and the patch is already committed.
> 

Yuck.  It's actually raw_spin_lock_nested() macro that discards the
subclass argument...

We could do something really silly like:

# define raw_spin_lock_nested(lock, subclass) \
                             sublcass;_raw_spin_lock(lock)

That seems to get rid of the warning for me.

-vlad

>>  static inline void netif_addr_lock_bh(struct net_device *dev)
> 
> Regards,
> Jake
> 
> N�����r��y���b�X��ǧv�^�)޺{.n�+���z�^�)���w*\x1fjg���\x1e�����ݢj/���z�ޖ��2�ޙ���&�)ߡ�a��\x7f��\x1e�G���h�\x0f�j:+v���w�٥
> 

  parent reply	other threads:[~2014-06-04 23:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16 21:04 [PATCH v3 0/4] Fix lockdep issues with stacked devices Vlad Yasevich
2014-05-16 21:04 ` [PATCH v3 1/4] net: Find the nesting level of a given device by type Vlad Yasevich
2014-05-17  2:16   ` David Miller
2014-05-16 21:04 ` [PATCH v3 2/4] net: Allow for more then a single subclass for netif_addr_lock Vlad Yasevich
2014-06-04 21:42   ` Keller, Jacob E
2014-06-04 21:53     ` David Miller
2014-06-04 22:50       ` Keller, Jacob E
2014-06-04 23:17     ` Vlad Yasevich [this message]
2014-05-16 21:04 ` [PATCH v3 3/4] vlan: Fix lockdep warning with stacked vlan devices Vlad Yasevich
2014-05-16 21:04 ` [PATCH v3 4/4] macvlan: Fix lockdep warnings with stacked macvlan devices Vlad Yasevich
2014-05-18 16:36   ` Patrick McHardy

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=538FA90D.3050307@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=dingtianhong@huawei.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=vfalico@gmail.com \
    --cc=vyasevic@redhat.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).