net: introduce ethernet teaming device
Subsystems (4)
PATCH v8 1/1 net: introduce ethernet teaming device
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.
team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
Python binding of libteam was recently introduced. Daemon providing arpmon/miimon active-backup functionality will be introduced shortly. All what's necessary is already implemented in kernel team driver.
v7->v8:
- check ndo_ndo_vlan_rx_[add/kill]_vid functions before calling them.
- use dev_kfree_skb_any() instead of dev_kfree_skb()
v6->v7:
- transmit and receive functions are not checked in hot paths. That also resolves memory leak on transmit when no port is present
v5->v6:
- changed couple of _rcu calls to non _rcu ones in non-readers
v4->v5:
- team_change_mtu() uses team->lock while travesing though port list
- mac address changes are moved completely to jurisdiction of userspace daemon. This way the daemon can do FOM1, FOM2 and possibly other weird things with mac addresses. Only round-robin mode sets up all ports to bond's address then enslaved.
- Extended Kconfig text
v3->v4:
- remove redundant synchronize_rcu from __team_change_mode()
- revert "set and clear of mode_ops happens per pointer, not per byte"
- extend comment of function __team_change_mode()
v2->v3:
- team_change_mtu() uses rcu version of list traversal to unwind
- set and clear of mode_ops happens per pointer, not per byte
- port hashlist changed to be embedded into team structure
- error branch in team_port_enter() does cleanup now
- fixed rtln->rtnl
v1->v2:
- modes are made as modules. Makes team more modular and extendable.
- several commenters' nitpicks found on v1 were fixed
- several other bugs were fixed.
- note I ignored Eric's comment about roundrobin port selector as Eric's way may be easily implemented as another mode (mode "random") in future.
--- Documentation/networking/team.txt | 2 + MAINTAINERS | 7 + drivers/net/Kconfig | 2 + drivers/net/Makefile | 1 + drivers/net/team/Kconfig | 43 + drivers/net/team/Makefile | 7 + drivers/net/team/team.c | 1583 +++++++++++++++++++++++++++++ drivers/net/team/team_mode_activebackup.c | 137 +++ drivers/net/team/team_mode_roundrobin.c | 107 ++ include/linux/Kbuild | 1 + include/linux/if.h | 1 + include/linux/if_team.h | 242 +++++ 12 files changed, 2133 insertions(+), 0 deletions(-) create mode 100644 Documentation/networking/team.txt create mode 100644 drivers/net/team/Kconfig create mode 100644 drivers/net/team/Makefile create mode 100644 drivers/net/team/team.c create mode 100644 drivers/net/team/team_mode_activebackup.c create mode 100644 drivers/net/team/team_mode_roundrobin.c create mode 100644 include/linux/if_team.h
Documentation/networking/team.txt new file +2 -0
@@ -0,0 +1,2 @@ +Team devices are driven from userspace via libteam library which is here: + https://github.com/jpirko/libteam
MAINTAINERS +7 -0
@@ -6484,6 +6484,13 @@ W: http://tcp-lp-mod.sourceforge.net/ S: Maintained F: net/ipv4/tcp_lp.c +TEAM DRIVER +M: Jiri Pirko <[email protected]> +L: [email protected] +S: Supported +F: drivers/net/team/ +F: include/linux/if_team.h + TEGRA SUPPORT M: Colin Cross <[email protected]> M: Olof Johansson <[email protected]>
drivers/net/Kconfig +2 -0
@@ -125,6 +125,8 @@ config IFB 'ifb1' etc. Look at the iproute2 documentation directory for usage etc +source "drivers/net/team/Kconfig" + config MACVLAN tristate "MAC-VLAN support (EXPERIMENTAL)" depends on EXPERIMENTAL
drivers/net/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_NET) += Space.o loopback.o obj-$(CONFIG_NETCONSOLE) += netconsole.o obj-$(CONFIG_PHYLIB) += phy/ obj-$(CONFIG_RIONET) += rionet.o +obj-$(CONFIG_NET_TEAM) += team/ obj-$(CONFIG_TUN) += tun.o obj-$(CONFIG_VETH) += veth.o obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
drivers/net/team/Kconfig new file +43 -0
43 lines not on this page · raw message
drivers/net/team/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the network team driver +# + +obj-$(CONFIG_NET_TEAM) += team.o +obj-$(CONFIG_NET_TEAM_MODE_ROUNDROBIN) += team_mode_roundrobin.o +obj-$(CONFIG_NET_TEAM_MODE_ACTIVEBACKUP) += team_mode_activebackup.o
drivers/net/team/team.c new file +1583 -0
1,583 lines not on this page · raw message
drivers/net/team/team_mode_activebackup.c new file +137 -0
137 lines not on this page · raw message
drivers/net/team/team_mode_roundrobin.c new file +107 -0
107 lines not on this page · raw message
include/linux/Kbuild +1 -0
@@ -185,6 +185,7 @@ header-y += if_pppol2tp.h header-y += if_pppox.h header-y += if_slip.h header-y += if_strip.h +header-y += if_team.h header-y += if_tr.h header-y += if_tun.h header-y += if_tunnel.h
include/linux/if.h +1 -0
@@ -79,6 +79,7 @@#define IFF_TX_SKB_SHARING 0x10000/* The interface supports sharing * skbs on transmit */ #define IFF_UNICAST_FLT 0x20000/* Supports unicast filtering */ +#define IFF_TEAM_PORT 0x40000/* device used as team port */ #define IF_GET_IFACE 0x0001/* for querying only */ #define IF_GET_PROTO 0x0002
include/linux/if_team.h new file +242 -0
242 lines not on this page · raw message
Signature · 1 line
1.7.6
From: Jiri Pirko <[email protected]>
Date: Sat, 12 Nov 2011 09:16:48 +0100
Quoted 12 lines
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
Quoted 6 lines
Python binding of libteam was recently introduced. Daemon providing arpmon/miimon active-backup functionality will be introduced shortly. All what's necessary is already implemented in kernel team driver.
Signed-off-by Jiri Pirko <[email protected]>
Applied, thanks for all of your hard work.
Quoted 15 lines · David Miller
From: Jiri Pirko <[email protected]>
Date: Sat, 12 Nov 2011 09:16:48 +0100Quoted 12 lines
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
Quoted 8 lines
Quoted 6 lines
Python binding of libteam was recently introduced. Daemon providing arpmon/miimon active-backup functionality will be introduced shortly. All what's necessary is already implemented in kernel team driver.
Signed-off-by Jiri Pirko <[email protected]>Applied, thanks for all of your hard work.
I'm a bit surprised by this. Not only is this new function currently difficult to setup (it took me over an hour to go from a a fresh F16 install to one that had all the necessary libraries and tools to even configure a team device for the first time), but I was able to cause an Oops with v8 in only a few minutes of testing.
I have no problem with this functionality as an add-on and possibly future replacement to some of what currently exists with bonding, but it seems like what is included in the initial support should should:
1. Not panic easily.
2. Have userspace bits in place to actually test all the proposed kernel code. (Jiri admits there is no way to verify the active-backup code).
3. Have some known, published test results.
I hope Jiri will reconsider having a separate team tree for the next few weeks or months until these issues are worked out. I think the hard work will pay off and it is close to being ready; it just doesn't seem like it is right now.
Quoted 15 lines · Andy Gospodarek
I'm a bit surprised by this. Not only is this new function currently difficult to setup (it took me over an hour to go from a a fresh F16 install to one that had all the necessary libraries and tools to even configure a team device for the first time), but I was able to cause an Oops with v8 in only a few minutes of testing.
I have no problem with this functionality as an add-on and possibly future replacement to some of what currently exists with bonding, but it seems like what is included in the initial support should should:
1. Not panic easily.
2. Have userspace bits in place to actually test all the proposed kernel code. (Jiri admits there is no way to verify the active-backup code).
3. Have some known, published test results.
Quoted 5 lines
I hope Jiri will reconsider having a separate team tree for the next few weeks or months until these issues are worked out. I think the hard work will pay off and it is close to being ready; it just doesn't seem like it is right now.
Its marked EXPERIMENTAL, so probably some changes are expected before production mode :)
Quoted 17 lines · Mon, Nov 14, 2011 at 07:17:52PM CET, [email protected] wrote:
Quoted 15 lines · Andy Gospodarek
I'm a bit surprised by this. Not only is this new function currently difficult to setup (it took me over an hour to go from a a fresh F16 install to one that had all the necessary libraries and tools to even configure a team device for the first time), but I was able to cause an Oops with v8 in only a few minutes of testing.
I have no problem with this functionality as an add-on and possibly future replacement to some of what currently exists with bonding, but it seems like what is included in the initial support should should:
1. Not panic easily.
2. Have userspace bits in place to actually test all the proposed kernel code. (Jiri admits there is no way to verify the active-backup code).
3. Have some known, published test results.
Quoted 8 lines
Quoted 5 lines
I hope Jiri will reconsider having a separate team tree for the next few weeks or months until these issues are worked out. I think the hard work will pay off and it is close to being ready; it just doesn't seem like it is right now.
Its marked EXPERIMENTAL, so probably some changes are expected before production mode :)
Exactly. The primary goal was to get this broader audience so people use this and find bugs, like you did Andy :)
Quoted 3 lines
Quoted 55 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
Python binding of libteam was recently introduced. Daemon providing arpmon/miimon active-backup functionality will be introduced shortly. All what's necessary is already implemented in kernel team driver.
Signed-off-by Jiri Pirko <[email protected]>
v7->v8:
- check ndo_ndo_vlan_rx_[add/kill]_vid functions before calling them.
- usedev_kfree_skb_any()instead ofdev_kfree_skb()
v6->v7:
- transmit and receive functions are not checked in hot paths. That also resolves memory leak on transmit when no port is present
v5->v6:
- changed couple of_rcucalls to non_rcuones in non-readers
v4->v5:
-team_change_mtu()usesteam->lockwhile travesing though port list
- mac address changes are moved completely to jurisdiction of userspace daemon. This way the daemon can do FOM1, FOM2 and possibly other weird things with mac addresses. Only round-robin mode sets up all ports to bond's address then enslaved.
- ExtendedKconfigtext
v3->v4:
- remove redundantsynchronize_rcufrom__team_change_mode()
- revert "set and clear ofmode_opshappens per pointer, not per byte"
- extend comment of function__team_change_mode()
v2->v3:
-team_change_mtu()uses rcu version of list traversal to unwind
- set and clear ofmode_opshappens per pointer, not per byte
- port hashlist changed to be embedded into team structure
- error branch inteam_port_enter()does cleanup now
- fixedrtln->rtnl
Quoted 8 lines
v1->v2:
- modes are made as modules. Makes team more modular and extendable.
- several commenters' nitpicks found on v1 were fixed
- several other bugs were fixed.
- note I ignored Eric's comment about roundrobin port selector as Eric's way may be easily implemented as another mode (mode "random") in future.
You better get ready for v9.
Running the command:
# team_manual_control team0 set mode roundrobin
on a system with team0 running in roundrobin mode produces this:
[ 2127.785321] BUG: unable to handle kernel NULL pointer dereference at (null) [ 2127.788079] IP: [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.790847] PGD 13eecf067 PUD 13f758067 PMD 0 [ 2127.793603] Oops: 0000 [#1] SMP [ 2127.796352] CPU 7 [ 2127.796370] Modules linked in: team_mode_roundrobin(O) team(O) fcoe libfcoe libfc scsi_transport_fc scsi_tgt 8021q garp stp llc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables xt_state nf_conntrack snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device i2c_i801 joydev microcode shpchp snd_pcm snd_timer snd soundcore snd_page_alloc bnx2 iTCO_wdt iTCO_vendor_support e1000e uinput firewire_ohci firewire_core crc_itu_t i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: nf_defrag_ipv4] [ 2127.808223] [ 2127.811261] Pid: 7085, comm: team_manual_con Tainted: G O 3.2.0-rc1+ #1 Intel Corporation 2012 Client Platform/LosLunas CRB [ 2127.814421] RIP: 0010:[<ffffffffa0196edd>] [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.817597] RSP: 0018:ffff88012ec3d968 EFLAGS: 00010286 [ 2127.820758] RAX: 0000000000000000 RBX: ffff8801397bb600 RCX: ffffffffffffffff [ 2127.823947] RDX: ffff88013f4ba048 RSI: 0000000000000000 RDI: 0000000000000000 [ 2127.827154] RBP: ffff88012ec3d9c8 R08: ffff88013f4ba048 R09: 0000000000000004 [ 2127.830365] R10: 0000000000001bad R11: 0000000000000000 R12: ffff880143a8b740 [ 2127.833599] R13: ffff880143aca7e8 R14: ffff88013f4ba014 R15: ffff88013f4ba048 [ 2127.836838] FS: 00007fd65cdc8700(0000) GS:ffff88014e2e0000(0000) knlGS:0000000000000000 [ 2127.840102] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2127.843386] CR2: 0000000000000000 CR3: 0000000128531000 CR4: 00000000001406e0 [ 2127.846688] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2127.849987] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2127.853278] Process team_manual_con (pid: 7085, threadinfo ffff88012ec3c000, task ffff88013e842e40) [ 2127.856605] Stack: [ 2127.859898] 0000000000000000 ffff880143a8b7e8 0000000000000000 ffff88013f4ba01c [ 2127.863261] ffffffffa0019140 0000000500000000 0000000000000000 ffff8801397bb600 [ 2127.866623] ffff88012ec3da58 ffffffffa0197058 ffff880143a8b740 00000000fffffff4 [ 2127.869993] Call Trace: [ 2127.873344] [<ffffffffa0197058>] ? team_nl_fill_options_get_changed+0x240/0x240 [team] [ 2127.876750] [<ffffffffa0197078>] team_nl_fill_options_get+0x20/0x22 [team] [ 2127.880152] [<ffffffffa019763c>] team_nl_send_generic+0x41/0x85 [team] [ 2127.880156] [<ffffffffa01976f5>] team_nl_cmd_options_get+0x36/0x3f [team] [ 2127.880162] [<ffffffff813fbdce>] genl_rcv_msg+0x1d8/0x203 [ 2127.880165] [<ffffffff813fbbf6>] ? genl_rcv+0x2d/0x2d [ 2127.880169] [<ffffffff813fb7b2>] netlink_rcv_skb+0x42/0x8d [ 2127.880172] [<ffffffff813fbbef>] genl_rcv+0x26/0x2d [ 2127.880174] [<ffffffff813fb341>] netlink_unicast+0xec/0x156 [ 2127.880178] [<ffffffff813fb5a6>] netlink_sendmsg+0x1fb/0x233 [ 2127.880182] [<ffffffff813ca577>] sock_sendmsg+0xe6/0x109 [ 2127.880188] [<ffffffff81120c76>] ? __mem_cgroup_commit_charge+0x9d/0xa9 [ 2127.880192] [<ffffffff8112333b>] ? mem_cgroup_charge_common+0xb1/0xc3 [ 2127.880197] [<ffffffff81043ff5>] ? should_resched+0xe/0x2d [ 2127.880203] [<ffffffff814b6208>] ? _cond_resched+0xe/0x22 [ 2127.880206] [<ffffffff81043ff5>] ? should_resched+0xe/0x2d [ 2127.880209] [<ffffffff813d4433>] ? copy_from_user+0x2f/0x31 [ 2127.880212] [<ffffffff813d481e>] ? verify_iovec+0x52/0xa4 [ 2127.880215] [<ffffffff813ca85c>] __sys_sendmsg+0x213/0x2ba [ 2127.880220] [<ffffffff810fb1eb>] ? handle_mm_fault+0x1c8/0x1db [ 2127.880224] [<ffffffff814bab67>] ? do_page_fault+0x30c/0x37e [ 2127.880228] [<ffffffff814b7914>] ? _raw_spin_unlock_irqrestore+0x17/0x19 [ 2127.880232] [<ffffffff81045079>] ? __wake_up+0x44/0x4d [ 2127.880235] [<ffffffff813cc459>] sys_sendmsg+0x42/0x60 [ 2127.880239] [<ffffffff814be042>] system_call_fastpath+0x16/0x1b [ 2127.880241] Code: e9 24 01 00 00 be 01 00 00 00 48 89 df e8 aa f3 ff ff 48 85 c0 49 89 c7 0f 84 4b 01 00 00 49 8b 75 10 31 c0 48 83 c9 ff 48 89 f7 <f2> ae 48 89 df 89 ca 48 89 f1 be 01 00 00 00 f7 d2 e8 2f 4c 0a [ 2127.880263] RIP [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.880268] RSP <ffff88012ec3d968> [ 2127.880269] CR2: 0000000000000000 [ 2127.880287] ---[ end trace 3e104c6acd231d26 ]---
Can you provide a detailed report of the testing you have done on the team device? It seems proper testing would have found something like this.
Quoted 130 lines · Mon, Nov 14, 2011 at 06:18:40PM CET, [email protected] wrote:
Quoted 55 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
Python binding of libteam was recently introduced. Daemon providing arpmon/miimon active-backup functionality will be introduced shortly. All what's necessary is already implemented in kernel team driver.
Signed-off-by Jiri Pirko <[email protected]>
v7->v8:
- check ndo_ndo_vlan_rx_[add/kill]_vid functions before calling them.
- usedev_kfree_skb_any()instead ofdev_kfree_skb()
v6->v7:
- transmit and receive functions are not checked in hot paths. That also resolves memory leak on transmit when no port is present
v5->v6:
- changed couple of_rcucalls to non_rcuones in non-readers
v4->v5:
-team_change_mtu()usesteam->lockwhile travesing though port list
- mac address changes are moved completely to jurisdiction of userspace daemon. This way the daemon can do FOM1, FOM2 and possibly other weird things with mac addresses. Only round-robin mode sets up all ports to bond's address then enslaved.
- ExtendedKconfigtext
v3->v4:
- remove redundantsynchronize_rcufrom__team_change_mode()
- revert "set and clear ofmode_opshappens per pointer, not per byte"
- extend comment of function__team_change_mode()
v2->v3:
-team_change_mtu()uses rcu version of list traversal to unwind
- set and clear ofmode_opshappens per pointer, not per byte
- port hashlist changed to be embedded into team structure
- error branch inteam_port_enter()does cleanup now
- fixedrtln->rtnlQuoted 8 lines
v1->v2:
- modes are made as modules. Makes team more modular and extendable.
- several commenters' nitpicks found on v1 were fixed
- several other bugs were fixed.
- note I ignored Eric's comment about roundrobin port selector as Eric's way may be easily implemented as another mode (mode "random") in future.You better get ready for v9.
Running the command:
# team_manual_control team0 set mode roundrobinon a system with team0 running in roundrobin mode produces this:
[ 2127.785321] BUG: unable to handle kernel NULL pointer dereference at (null) [ 2127.788079] IP: [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.790847] PGD 13eecf067 PUD 13f758067 PMD 0 [ 2127.793603] Oops: 0000 [#1] SMP [ 2127.796352] CPU 7 [ 2127.796370] Modules linked in: team_mode_roundrobin(O) team(O) fcoe libfcoe libfc scsi_transport_fc scsi_tgt 8021q garp stp llc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables xt_state nf_conntrack snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device i2c_i801 joydev microcode shpchp snd_pcm snd_timer snd soundcore snd_page_alloc bnx2 iTCO_wdt iTCO_vendor_support e1000e uinput firewire_ohci firewire_core crc_itu_t i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: nf_defrag_ipv4] [ 2127.808223] [ 2127.811261] Pid: 7085, comm: team_manual_con Tainted: G O 3.2.0-rc1+ #1 Intel Corporation 2012 Client Platform/LosLunas CRB [ 2127.814421] RIP: 0010:[<ffffffffa0196edd>] [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.817597] RSP: 0018:ffff88012ec3d968 EFLAGS: 00010286 [ 2127.820758] RAX: 0000000000000000 RBX: ffff8801397bb600 RCX: ffffffffffffffff [ 2127.823947] RDX: ffff88013f4ba048 RSI: 0000000000000000 RDI: 0000000000000000 [ 2127.827154] RBP: ffff88012ec3d9c8 R08: ffff88013f4ba048 R09: 0000000000000004 [ 2127.830365] R10: 0000000000001bad R11: 0000000000000000 R12: ffff880143a8b740 [ 2127.833599] R13: ffff880143aca7e8 R14: ffff88013f4ba014 R15: ffff88013f4ba048 [ 2127.836838] FS: 00007fd65cdc8700(0000) GS:ffff88014e2e0000(0000) knlGS:0000000000000000 [ 2127.840102] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2127.843386] CR2: 0000000000000000 CR3: 0000000128531000 CR4: 00000000001406e0 [ 2127.846688] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2127.849987] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2127.853278] Process team_manual_con (pid: 7085, threadinfo ffff88012ec3c000, task ffff88013e842e40) [ 2127.856605] Stack: [ 2127.859898] 0000000000000000 ffff880143a8b7e8 0000000000000000 ffff88013f4ba01c [ 2127.863261] ffffffffa0019140 0000000500000000 0000000000000000 ffff8801397bb600 [ 2127.866623] ffff88012ec3da58 ffffffffa0197058 ffff880143a8b740 00000000fffffff4 [ 2127.869993] Call Trace: [ 2127.873344] [<ffffffffa0197058>] ? team_nl_fill_options_get_changed+0x240/0x240 [team] [ 2127.876750] [<ffffffffa0197078>] team_nl_fill_options_get+0x20/0x22 [team] [ 2127.880152] [<ffffffffa019763c>] team_nl_send_generic+0x41/0x85 [team] [ 2127.880156] [<ffffffffa01976f5>] team_nl_cmd_options_get+0x36/0x3f [team] [ 2127.880162] [<ffffffff813fbdce>] genl_rcv_msg+0x1d8/0x203 [ 2127.880165] [<ffffffff813fbbf6>] ? genl_rcv+0x2d/0x2d [ 2127.880169] [<ffffffff813fb7b2>] netlink_rcv_skb+0x42/0x8d [ 2127.880172] [<ffffffff813fbbef>] genl_rcv+0x26/0x2d [ 2127.880174] [<ffffffff813fb341>] netlink_unicast+0xec/0x156 [ 2127.880178] [<ffffffff813fb5a6>] netlink_sendmsg+0x1fb/0x233 [ 2127.880182] [<ffffffff813ca577>] sock_sendmsg+0xe6/0x109 [ 2127.880188] [<ffffffff81120c76>] ? __mem_cgroup_commit_charge+0x9d/0xa9 [ 2127.880192] [<ffffffff8112333b>] ? mem_cgroup_charge_common+0xb1/0xc3 [ 2127.880197] [<ffffffff81043ff5>] ? should_resched+0xe/0x2d [ 2127.880203] [<ffffffff814b6208>] ? _cond_resched+0xe/0x22 [ 2127.880206] [<ffffffff81043ff5>] ? should_resched+0xe/0x2d [ 2127.880209] [<ffffffff813d4433>] ? copy_from_user+0x2f/0x31 [ 2127.880212] [<ffffffff813d481e>] ? verify_iovec+0x52/0xa4 [ 2127.880215] [<ffffffff813ca85c>] __sys_sendmsg+0x213/0x2ba [ 2127.880220] [<ffffffff810fb1eb>] ? handle_mm_fault+0x1c8/0x1db [ 2127.880224] [<ffffffff814bab67>] ? do_page_fault+0x30c/0x37e [ 2127.880228] [<ffffffff814b7914>] ? _raw_spin_unlock_irqrestore+0x17/0x19 [ 2127.880232] [<ffffffff81045079>] ? __wake_up+0x44/0x4d [ 2127.880235] [<ffffffff813cc459>] sys_sendmsg+0x42/0x60 [ 2127.880239] [<ffffffff814be042>] system_call_fastpath+0x16/0x1b [ 2127.880241] Code: e9 24 01 00 00 be 01 00 00 00 48 89 df e8 aa f3 ff ff 48 85 c0 49 89 c7 0f 84 4b 01 00 00 49 8b 75 10 31 c0 48 83 c9 ff 48 89 f7 <f2> ae 48 89 df 89 ca 48 89 f1 be 01 00 00 00 f7 d2 e8 2f 4c 0a [ 2127.880263] RIP [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.880268] RSP <ffff88012ec3d968> [ 2127.880269] CR2: 0000000000000000 [ 2127.880287] ---[ end trace 3e104c6acd231d26 ]---
Quoted 3 lines
Can you provide a detailed report of the testing you have done on the team device? It seems proper testing would have found something like this.
I just encountered the same bug now. Goind to investigate this. Did not happen during my previous testing :( Sorry Andy.
Jirka
Quoted 1 line
Quoted 131 lines · Mon, Nov 14, 2011 at 10:35:12PM CET, [email protected] wrote:
Quoted 130 lines · Mon, Nov 14, 2011 at 06:18:40PM CET, [email protected] wrote:
Quoted 55 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
Userspace library called libteam with couple of demo apps is available here:
https://github.com/jpirko/libteam
Note it's still in its dipers atm.team<->libteam use generic netlink for communication. That and rtnl suppose to be the only way to configure team device, no sysfs etc.
Python binding of libteam was recently introduced. Daemon providing arpmon/miimon active-backup functionality will be introduced shortly. All what's necessary is already implemented in kernel team driver.
Signed-off-by Jiri Pirko <[email protected]>
v7->v8:
- check ndo_ndo_vlan_rx_[add/kill]_vid functions before calling them.
- usedev_kfree_skb_any()instead ofdev_kfree_skb()
v6->v7:
- transmit and receive functions are not checked in hot paths. That also resolves memory leak on transmit when no port is present
v5->v6:
- changed couple of_rcucalls to non_rcuones in non-readers
v4->v5:
-team_change_mtu()usesteam->lockwhile travesing though port list
- mac address changes are moved completely to jurisdiction of userspace daemon. This way the daemon can do FOM1, FOM2 and possibly other weird things with mac addresses. Only round-robin mode sets up all ports to bond's address then enslaved.
- ExtendedKconfigtext
v3->v4:
- remove redundantsynchronize_rcufrom__team_change_mode()
- revert "set and clear ofmode_opshappens per pointer, not per byte"
- extend comment of function__team_change_mode()
v2->v3:
-team_change_mtu()uses rcu version of list traversal to unwind
- set and clear ofmode_opshappens per pointer, not per byte
- port hashlist changed to be embedded into team structure
- error branch inteam_port_enter()does cleanup now
- fixedrtln->rtnlQuoted 8 lines
v1->v2:
- modes are made as modules. Makes team more modular and extendable.
- several commenters' nitpicks found on v1 were fixed
- several other bugs were fixed.
- note I ignored Eric's comment about roundrobin port selector as Eric's way may be easily implemented as another mode (mode "random") in future.You better get ready for v9.
Running the command:
# team_manual_control team0 set mode roundrobinon a system with team0 running in roundrobin mode produces this:
[ 2127.785321] BUG: unable to handle kernel NULL pointer dereference at (null) [ 2127.788079] IP: [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.790847] PGD 13eecf067 PUD 13f758067 PMD 0 [ 2127.793603] Oops: 0000 [#1] SMP [ 2127.796352] CPU 7 [ 2127.796370] Modules linked in: team_mode_roundrobin(O) team(O) fcoe libfcoe libfc scsi_transport_fc scsi_tgt 8021q garp stp llc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables xt_state nf_conntrack snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device i2c_i801 joydev microcode shpchp snd_pcm snd_timer snd soundcore snd_page_alloc bnx2 iTCO_wdt iTCO_vendor_support e1000e uinput firewire_ohci firewire_core crc_itu_t i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: nf_defrag_ipv4] [ 2127.808223] [ 2127.811261] Pid: 7085, comm: team_manual_con Tainted: G O 3.2.0-rc1+ #1 Intel Corporation 2012 Client Platform/LosLunas CRB [ 2127.814421] RIP: 0010:[<ffffffffa0196edd>] [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.817597] RSP: 0018:ffff88012ec3d968 EFLAGS: 00010286 [ 2127.820758] RAX: 0000000000000000 RBX: ffff8801397bb600 RCX: ffffffffffffffff [ 2127.823947] RDX: ffff88013f4ba048 RSI: 0000000000000000 RDI: 0000000000000000 [ 2127.827154] RBP: ffff88012ec3d9c8 R08: ffff88013f4ba048 R09: 0000000000000004 [ 2127.830365] R10: 0000000000001bad R11: 0000000000000000 R12: ffff880143a8b740 [ 2127.833599] R13: ffff880143aca7e8 R14: ffff88013f4ba014 R15: ffff88013f4ba048 [ 2127.836838] FS: 00007fd65cdc8700(0000) GS:ffff88014e2e0000(0000) knlGS:0000000000000000 [ 2127.840102] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2127.843386] CR2: 0000000000000000 CR3: 0000000128531000 CR4: 00000000001406e0 [ 2127.846688] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2127.849987] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 2127.853278] Process team_manual_con (pid: 7085, threadinfo ffff88012ec3c000, task ffff88013e842e40) [ 2127.856605] Stack: [ 2127.859898] 0000000000000000 ffff880143a8b7e8 0000000000000000 ffff88013f4ba01c [ 2127.863261] ffffffffa0019140 0000000500000000 0000000000000000 ffff8801397bb600 [ 2127.866623] ffff88012ec3da58 ffffffffa0197058 ffff880143a8b740 00000000fffffff4 [ 2127.869993] Call Trace: [ 2127.873344] [<ffffffffa0197058>] ? team_nl_fill_options_get_changed+0x240/0x240 [team] [ 2127.876750] [<ffffffffa0197078>] team_nl_fill_options_get+0x20/0x22 [team] [ 2127.880152] [<ffffffffa019763c>] team_nl_send_generic+0x41/0x85 [team] [ 2127.880156] [<ffffffffa01976f5>] team_nl_cmd_options_get+0x36/0x3f [team] [ 2127.880162] [<ffffffff813fbdce>] genl_rcv_msg+0x1d8/0x203 [ 2127.880165] [<ffffffff813fbbf6>] ? genl_rcv+0x2d/0x2d [ 2127.880169] [<ffffffff813fb7b2>] netlink_rcv_skb+0x42/0x8d [ 2127.880172] [<ffffffff813fbbef>] genl_rcv+0x26/0x2d [ 2127.880174] [<ffffffff813fb341>] netlink_unicast+0xec/0x156 [ 2127.880178] [<ffffffff813fb5a6>] netlink_sendmsg+0x1fb/0x233 [ 2127.880182] [<ffffffff813ca577>] sock_sendmsg+0xe6/0x109 [ 2127.880188] [<ffffffff81120c76>] ? __mem_cgroup_commit_charge+0x9d/0xa9 [ 2127.880192] [<ffffffff8112333b>] ? mem_cgroup_charge_common+0xb1/0xc3 [ 2127.880197] [<ffffffff81043ff5>] ? should_resched+0xe/0x2d [ 2127.880203] [<ffffffff814b6208>] ? _cond_resched+0xe/0x22 [ 2127.880206] [<ffffffff81043ff5>] ? should_resched+0xe/0x2d [ 2127.880209] [<ffffffff813d4433>] ? copy_from_user+0x2f/0x31 [ 2127.880212] [<ffffffff813d481e>] ? verify_iovec+0x52/0xa4 [ 2127.880215] [<ffffffff813ca85c>] __sys_sendmsg+0x213/0x2ba [ 2127.880220] [<ffffffff810fb1eb>] ? handle_mm_fault+0x1c8/0x1db [ 2127.880224] [<ffffffff814bab67>] ? do_page_fault+0x30c/0x37e [ 2127.880228] [<ffffffff814b7914>] ? _raw_spin_unlock_irqrestore+0x17/0x19 [ 2127.880232] [<ffffffff81045079>] ? __wake_up+0x44/0x4d [ 2127.880235] [<ffffffff813cc459>] sys_sendmsg+0x42/0x60 [ 2127.880239] [<ffffffff814be042>] system_call_fastpath+0x16/0x1b [ 2127.880241] Code: e9 24 01 00 00 be 01 00 00 00 48 89 df e8 aa f3 ff ff 48 85 c0 49 89 c7 0f 84 4b 01 00 00 49 8b 75 10 31 c0 48 83 c9 ff 48 89 f7 <f2> ae 48 89 df 89 ca 48 89 f1 be 01 00 00 00 f7 d2 e8 2f 4c 0a [ 2127.880263] RIP [<ffffffffa0196edd>] team_nl_fill_options_get_changed+0xc5/0x240 [team] [ 2127.880268] RSP <ffff88012ec3d968> [ 2127.880269] CR2: 0000000000000000 [ 2127.880287] ---[ end trace 3e104c6acd231d26 ]---
Quoted 6 lines
Quoted 3 lines
Can you provide a detailed report of the testing you have done on the team device? It seems proper testing would have found something like this.
I just encountered the same bug now. Goind to investigate this. Did not happen during my previous testing :( Sorry Andy.
I believe I found the problem. I'm going to do some more testing, then I'll post the patch.
Quoted 4 lines
Jirka
Quoted 1 line
Quoted 3 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
What is the definition of "very" here - relative to bonding I presume? Are there actual performance figures available at this point? Something along the lines of test through both on the same hardware. I don't have HW on which to run myself but would be quite happy to help with say netperf command selection to demonstrate the difference between the two.
happy benchmrking,
rick jones
Quoted 11 lines · Mon, Nov 14, 2011 at 07:40:52PM CET, [email protected] wrote:
Quoted 3 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
What is the definition of "very" here - relative to bonding I presume? Are there actual performance figures available at this point? Something along the lines of test through both on the same hardware. I don't have HW on which to run myself but would be quite happy to help with say netperf command selection to demonstrate the difference between the two.
Rick, I will provide this.
But the simple fact how bond and team path differ suggests the results.
Stay tuned.
Jirka
Quoted 4 lines
happy benchmrking,
rick jones
Quoted 5 lines · Rick Jones
Quoted 3 lines · Jiri Pirko
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
Quoted 8 lines
What is the definition of "very" here - relative to bonding I presume? Are there actual performance figures available at this point? Something along the lines of test through both on the same hardware. I don't have HW on which to run myself but would be quite happy to help with say netperf command selection to demonstrate the difference between the two.
happy benchmrking,
On most modern systems I suspect there will be little to no difference between bonding RX peformance and team performance.
If there is any now, I suspect team and bond performance to be similar by the time team has to account for the corner-cases bonding has already resolved. :-)
Benchmarks may prove otherwise, but I've yet to see Jiri produce anything. My initial testing doesn't demonstrate any measureable differences with 1Gbps interfaces on a multi-core, multi-socket system.
Quoted 10 lines
On most modern systems I suspect there will be little to no difference between bonding RX peformance and team performance.
If there is any now, I suspect team and bond performance to be similar by the time team has to account for the corner-cases bonding has already resolved. :-)
Benchmarks may prove otherwise, but I've yet to see Jiri produce anything. My initial testing doesn't demonstrate any measureable differences with 1Gbps interfaces on a multi-core, multi-socket system.
I wouldn't expect much difference in terms of bandwidth, I was thinking the demonstration would be made in the area of service demand (CPU consumed per unit work) and perhaps aggregate packets per second.
happy benchmarking,
rick jones
Quoted 7 lines · Rick Jones
Quoted 7 lines
On most modern systems I suspect there will be little to no difference between bonding RX peformance and team performance.
If there is any now, I suspect team and bond performance to be similar by the time team has to account for the corner-cases bonding has already resolved. :-)
Quoted 7 lines
Quoted 3 lines
Benchmarks may prove otherwise, but I've yet to see Jiri produce anything. My initial testing doesn't demonstrate any measureable differences with 1Gbps interfaces on a multi-core, multi-socket system.
I wouldn't expect much difference in terms of bandwidth, I was thinking the demonstration would be made in the area of service demand (CPU consumed per unit work) and perhaps aggregate packets per second.
Well,
bonding is a NETIF_F_LLTX driver, but uses following rwlock in xmit path :
read_lock(&bond->curr_slave_lock);
...read_unlock(&bond->curr_slave_lock);
Two atomic operations on a contended cache line.
On a 16 cpu machine, here is some "perf stat" data of such workload :
(each thread doing 10.000.000 atomic_inc(&somesharedvar) )
# perf stat ./atomic 16
Performance counter stats for './atomic 16':
48016,104204 task-clock # 15,566 CPUs utilized
555 context-switches # 0,000 M/sec
15 CPU-migrations # 0,000 M/sec
175 page-faults # 0,000 M/sec
121 669 943 013 cycles # 2,534 GHz
121 321 455 748 stalled-cycles-frontend # 99,71% frontend cycles idle
103 375 494 290 stalled-cycles-backend # 84,96% backend cycles idle
611 624 619 instructions # 0,01 insns per cycle # 198,36 stalled cycles per insn
184 530 032 branches # 3,843 M/sec
581 513 branch-misses # 0,32% of all branches
3,084672937 seconds time elapsed
Cost per 'read_lock/read_unlock pair' : at least 616 ns
While on one cpu only :
# perf stat ./atomic 1
Performance counter stats for './atomic 1':
83,475050 task-clock # 0,998 CPUs utilized
3 context-switches # 0,000 M/sec
1 CPU-migrations # 0,000 M/sec
144 page-faults # 0,002 M/sec
211 508 600 cycles # 2,534 GHz
193 502 947 stalled-cycles-frontend # 91,49% frontend cycles idle
124 428 400 stalled-cycles-backend # 58,83% backend cycles idle
30 870 434 instructions # 0,15 insns per cycle # 6,27 stalled cycles per insn
10 163 364 branches # 121,753 M/sec
9 633 branch-misses # 0,09% of all branches
0,083679928 seconds time elapsed
Cost per 'read_lock/read_unlock pair' : 16 ns
Of course, bonding could be changed to use RCU as well, if someone feels the need.
But teaming was designed to be RCU ready from the beginning.
exi
2011/11/12 Jiri Pirko <[email protected]>:
Quoted 3 lines
This patch introduces new network device called team. It supposes to be very fast, simple, userspace-driven alternative to existing bonding driver.
[...]
Quoted 21 lines
drivers/net/team/team.c new file +21
-0+#define TEAM_VLAN_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | \ + NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \ + NETIF_F_HIGHDMA | NETIF_F_LRO) + +static void __team_compute_features (struct team *team) +{ + struct team_port *port; + u32 vlan_features = TEAM_VLAN_FEATURES; + unsigned short max_hard_header_len = ETH_HLEN; + + list_for_each_entry(port, &team->port_list, list) { + vlan_features = netdev_increment_features(vlan_features, + port->dev->vlan_features, + TEAM_VLAN_FEATURES); + + if (port->dev->hard_header_len > max_hard_header_len) + max_hard_header_len = port->dev->hard_header_len; + } + + team->dev->vlan_features = vlan_features; + team->dev->hard_header_len = max_hard_header_len;
drivers/net/team/team.c line 449
Quoted 10 lines
drivers/net/team/team.c new file +10
-0+ + netdev_change_features(team->dev); +} + +static void team_compute_features (struct team *team) +{ + spin_lock(&team->lock); + __team_compute_features(team); + spin_unlock(&team->lock); +}
[...]
I just noticed that you missed ndo_fix_features in the driver. If you look at bonding driver it should be easy to see how it should work.
Best Regards,
Michał Mirosław