All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, andy@greyhouse.net, davem@davemloft.net,
	fubar@us.ibm.com
Subject: Re: [PATCH net-next 1/5] bonding: convert to list API and replace bond's custom list
Date: Wed, 31 Jul 2013 21:00:35 +0200	[thread overview]
Message-ID: <51F95ED3.3020104@redhat.com> (raw)
In-Reply-To: <20130731115657.4262a7fe@nehalam.linuxnetplumber.net>

On 07/31/2013 08:56 PM, Stephen Hemminger wrote:
> On Wed, 31 Jul 2013 20:44:49 +0200
> Nikolay Aleksandrov <nikolay@redhat.com> wrote:
> 
>> On 07/31/2013 08:37 PM, Stephen Hemminger wrote:
>>> On Wed, 31 Jul 2013 17:12:29 +0200
>>> Nikolay Aleksandrov <nikolay@redhat.com> wrote:
>>>
>>>> diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
>>>> index 390061d..80e288c 100644
>>>> --- a/drivers/net/bonding/bond_3ad.c
>>>> +++ b/drivers/net/bonding/bond_3ad.c
>>>> @@ -143,10 +143,13 @@ static inline struct bonding *__get_bond_by_port(struct port *port)
>>>>   */
>>>>  static inline struct port *__get_first_port(struct bonding *bond)
>>>>  {
>>>> +	struct slave *first_slave;
>>>> +
>>>>  	if (bond->slave_cnt == 0)
>>>>  		return NULL;
>>>> +	first_slave = bond_first_slave(bond);
>>>
>>> As Jay said, it would be be better to have bond_first_slave return
>>> NULL (if no slaves), and eliminate slave_cnt. It would also fix
>>> a race here between slave_cnt and all slave's being removed.
>>>
>> Hi Stephen,
>> First off - thank you for the review.
>>
>> What do you mean by eliminate slave_cnt ?
>> We need it for various calculations throughout the bonding.
>> There's no race here because read_lock(&bond->lock) is held every time this
>> is called and slave_cnt can change only under write_lock of the same lock,
>> the 3ad code is not yet converted to RCU.
>>
>> Nik
> 
> I would hope the goal would be to eliminate all read_lock's and allow
> it to be totally RCU based.
> 
> You could then reduce slave_cnt to being only accessed by under a spin_lock
> when doing management actions.
> 
Yes, that is the end goal. And my end-implementation does just that -
removes curr_slave_lock completely and makes bond->lock a spinlock. But for
now we need it for the parts that aren't converted, as I said in the
beginning I'm doing the conversion gradually and there will be a special
series that takes care of 3ad mode as there are many potential problems for
RCU there because of its current design.

  reply	other threads:[~2013-07-31 19:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 15:12 [PATCH net-next 0/5] bonding: groundwork and initial conversion to RCU Nikolay Aleksandrov
2013-07-31 15:12 ` [PATCH net-next 1/5] bonding: convert to list API and replace bond's custom list Nikolay Aleksandrov
2013-07-31 18:28   ` Jay Vosburgh
2013-07-31 18:42     ` Nikolay Aleksandrov
2013-07-31 18:37   ` Stephen Hemminger
2013-07-31 18:44     ` Nikolay Aleksandrov
2013-07-31 18:56       ` Stephen Hemminger
2013-07-31 19:00         ` Nikolay Aleksandrov [this message]
2013-07-31 18:38   ` Stephen Hemminger
2013-07-31 18:49     ` Nikolay Aleksandrov
2013-07-31 15:12 ` [PATCH net-next 2/5] bonding: remove unnecessary read_locks of curr_slave_lock Nikolay Aleksandrov
2013-07-31 15:12 ` [PATCH net-next 3/5] bonding: simplify broadcast_xmit function Nikolay Aleksandrov
2013-07-31 15:12 ` [PATCH net-next 4/5] bonding: factor out slave id tx code and simplify xmit paths Nikolay Aleksandrov
2013-07-31 15:12 ` [PATCH net-next 5/5] bonding: initial RCU conversion Nikolay Aleksandrov
2013-08-01  6:46   ` Ding Tianhong
2013-08-01  7:55     ` Nikolay Aleksandrov
2013-07-31 15:27 ` [PATCH net-next 0/5] bonding: groundwork and initial conversion to RCU Eric Dumazet
2013-07-31 15:39 ` Nikolay Aleksandrov
2013-07-31 18:03 ` Jiri Pirko

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=51F95ED3.3020104@redhat.com \
    --to=nikolay@redhat.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.