* Re: net-next-2.6 [PATCH 0/6]: dccp ccid-2: Ack Vector patch set second/concluding part II
From: Gerrit Renker @ 2010-11-18 6:42 UTC (permalink / raw)
To: David Miller; +Cc: dccp, netdev
In-Reply-To: <20101115.110459.68121782.davem@davemloft.net>
> Some of the new functions you added had some coding style quirks,
> for example the openning brace for dccp_ackvec_clear_state()
> has an unnecessary space before it on that line.
>
> Please fix those sorts of things up, thanks.
I am sorry, this glitch must have occurred since I last ran checkpatch.pl.
Please find a fix attached. I have checked all patches again, line-by-line
and using checkpatch.pl. I found only this one occurrence, checking twice.
It is also on top today's copy of net-next-2.6, on
git://eden-feed.erg.abdn.ac.uk/net-next-2.6 [subtree 'dccp']
(I tried to put up the patches on top of this, but this did not work cleanly,
due to inter-dependencies. I apologize for this.)
>>>>>>>>>>>>>>>>>>>>>>>>>> Patch <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
dccp ccid-2: whitespace fix-up
This fixes whitespace noise introduced in commit "dccp ccid-2: Algorithm to
update buffer state", 5753fdfe8bd8e9a2ff9e5af19b0ffc78bfcd502a, 14 Nov 2010.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
ackvec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -282,7 +282,7 @@ void dccp_ackvec_input(struct dccp_ackvec *av, struct sk_buff *skb)
* packet of group (2) in 11.4.2.
*/
void dccp_ackvec_clear_state(struct dccp_ackvec *av, const u64 ackno)
- {
+{
struct dccp_ackvec_record *avr, *next;
u8 runlen_now, eff_runlen;
s64 delta;
^ permalink raw reply
* Re: [PATCH 06/10] drivers/net/usb: Remove unnecessary casts of netdev_priv
From: Petko Manolov @ 2010-11-18 7:24 UTC (permalink / raw)
To: David Miller
Cc: joe, trivial, petkan, gregkh, linux-usb, netdev, linux-kernel
In-Reply-To: <20101117.104555.246530412.davem@davemloft.net>
On Wed, 17 Nov 2010, David Miller wrote:
> From: Petko Manolov <petkan@nucleusys.com>
> Date: Tue, 16 Nov 2010 19:59:29 +0200 (EET)
>
>> ACK! :-)
>
> Please do not top post.
Sorry about that.
> Also, please use a properly formed "Acked-by: " tag if you want
> your ACK to actually show up in the commit log message.
My "ack" was only a notification that i've checked the patch. It was not
meant to go into the logs.
cheers,
Petko
^ permalink raw reply
* sound playback became chopping on nfs rootfs
From: Kuninori Morimoto @ 2010-11-18 8:24 UTC (permalink / raw)
To: Linux-Net, Linux-ALSA
Dear all
I noticed that sound playback became chopping on latest Linux kernel.
I checked it by "git bisect".
This chopping seems happen from below patch.
How to modify this chopping ?
I'm using SuperH ap4evb board.
CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 earlyprintk=sh-sci.0,115200 root=/dev/nfs ip=dhcp"
----------------------------------------------
commit 56463e50d1fc3f070492434cea6303b35ea000de
Author: Chuck Lever <chuck.lever@oracle.com>
Date: Fri Sep 17 10:54:37 2010 -0400
NFS: Use super.c for NFSROOT mount option parsing
Replace duplicate code in NFSROOT for mounting an NFS server on '/'
with logic that uses the existing mainline text-based logic in the NFS
client.
Add documenting comments where appropriate.
Note that this means NFSROOT mounts now use the same default settings
as v2/v3 mounts done via mount(2) from user space.
vers=3,tcp,rsize=<negotiated default>,wsize=<negotiated default>
As before, however, no version/protocol negotiation with the server is
done.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
----------------------------------------------
Best regards
--
Kuninori Morimoto
^ permalink raw reply
* MDaemon Notification -- Attachment Removed
From: Postmaster @ 2010-11-18 8:26 UTC (permalink / raw)
To: netdev
-------------------------------------------------------------------
MDaemon has detected restricted attachments within an email message
-------------------------------------------------------------------
>From : netdev@vger.kernel.org
To : ngocht.ktkd.cv@hpport.com.vn
Subject : Message could not be delivered
Message-ID:
---------------------
Attachment(s) removed
---------------------
ngocht.ktkd.cv@hpport.com.vn.zip (ngocht.ktkd.cv@hpport.com.vn.doc .com)
^ permalink raw reply
* Re: [alsa-devel] sound playback became chopping on nfs rootfs
From: Clemens Ladisch @ 2010-11-18 9:03 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Chuck Lever, Linux-Net, Linux-ALSA
In-Reply-To: <w3ptyjfrqde.wl%kuninori.morimoto.gx@renesas.com>
Kuninori Morimoto wrote:
> I noticed that sound playback became chopping on latest Linux kernel.
> ...
> This chopping seems happen from below patch.
>
> commit 56463e50d1fc3f070492434cea6303b35ea000de
> Author: Chuck Lever <chuck.lever@oracle.com>
>
> NFS: Use super.c for NFSROOT mount option parsing
> ...
> Note that this means NFSROOT mounts now use the same default settings
> as v2/v3 mounts done via mount(2) from user space.
Apparently, the latest kernel uses different mount options.
Try to find out what mount options your root FS had in the old kernel,
and manually set them in some startup script.
Regards,
Clemens
^ permalink raw reply
* Re: 2.6.37-rc2 after KVM shutdown - unregister_netdevice: waiting for vmtst01eth0 to become free. Usage count = 1
From: Eric Dumazet @ 2010-11-18 9:16 UTC (permalink / raw)
To: Nikola Ciprich; +Cc: KVM list, netdev list, nikola.ciprich, Linux kernel list
In-Reply-To: <20101118062822.GB3781@pcnci.linuxbox.cz>
Le jeudi 18 novembre 2010 à 07:28 +0100, Nikola Ciprich a écrit :
> > Yep, this is a known problem, thanks !
> >
> > fix is there :
> >
> > http://patchwork.ozlabs.org/patch/71354/
> Thanks Eric, this indeed fixes the problem..
> I noticed the fix didn't make it to 2.6.37-rc2-git3 though,
> maybe it just got omited?
> anyways, thanks for help!
> n.
Its in David Miller net-2.6 tree (all pending network patches for
current linux-2.6 version), so it'll be included next time David push
its tree to Linus, dont worry ;)
^ permalink raw reply
* [Patch -next] Adapt s390 qeth & lcs driver code to use RCU
From: Sachin Sant @ 2010-11-18 9:18 UTC (permalink / raw)
To: netdev, davem
Cc: Sachin Sant, linux-s390, linux-next, ursula.braun, eric.dumazet
Commit 1d7138de878d1d4210727c1200193e69596f93b3
igmp: RCU conversion of in_dev->mc_list
converted rwlock to RCU.
Update the s390 network drivers(qeth & lcs) code to adapt to this change.
Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
---
Only compile tested.
diff -Narup linux-2.6-next/drivers/s390/net/lcs.c linux-2.6-next-new/drivers/s390/net/lcs.c
--- linux-2.6-next/drivers/s390/net/lcs.c 2010-11-17 11:38:25.000000000 +0530
+++ linux-2.6-next-new/drivers/s390/net/lcs.c 2010-11-18 11:59:46.000000000 +0530
@@ -1269,10 +1269,10 @@ lcs_register_mc_addresses(void *data)
in4_dev = in_dev_get(card->dev);
if (in4_dev == NULL)
goto out;
- read_lock(&in4_dev->mc_list_lock);
+ rcu_read_lock();
lcs_remove_mc_addresses(card,in4_dev);
lcs_set_mc_addresses(card, in4_dev);
- read_unlock(&in4_dev->mc_list_lock);
+ rcu_read_unlock();
in_dev_put(in4_dev);
netif_carrier_off(card->dev);
diff -Narup linux-2.6-next/drivers/s390/net/qeth_l3_main.c linux-2.6-next-new/drivers/s390/net/qeth_l3_main.c
--- linux-2.6-next/drivers/s390/net/qeth_l3_main.c 2010-10-30 12:54:22.000000000 +0530
+++ linux-2.6-next-new/drivers/s390/net/qeth_l3_main.c 2010-11-18 11:59:13.000000000 +0530
@@ -1828,9 +1828,9 @@ static void qeth_l3_add_vlan_mc(struct q
in_dev = in_dev_get(netdev);
if (!in_dev)
continue;
- read_lock(&in_dev->mc_list_lock);
+ rcu_read_lock();
qeth_l3_add_mc(card, in_dev);
- read_unlock(&in_dev->mc_list_lock);
+ rcu_read_unlock();
in_dev_put(in_dev);
}
}
@@ -1843,10 +1843,10 @@ static void qeth_l3_add_multicast_ipv4(s
in4_dev = in_dev_get(card->dev);
if (in4_dev == NULL)
return;
- read_lock(&in4_dev->mc_list_lock);
+ rcu_read_lock();
qeth_l3_add_mc(card, in4_dev);
qeth_l3_add_vlan_mc(card);
- read_unlock(&in4_dev->mc_list_lock);
+ rcu_read_unlock();
in_dev_put(in4_dev);
}
^ permalink raw reply
* [net-next] MAINTAINERS: Add stmmac maintainer
From: Giuseppe CAVALLARO @ 2010-11-18 9:19 UTC (permalink / raw)
To: netdev; +Cc: Giuseppe Cavallaro
Add STMMAC to the list of supported Ethernet drivers
and myself as maintainer.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
MAINTAINERS | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 88b74a7..8b6ca96 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1829,6 +1829,13 @@ W: http://www.chelsio.com
S: Supported
F: drivers/net/cxgb4vf/
+STMMAC ETHERNET DRIVER
+M: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+L: netdev@vger.kernel.org
+W: http://www.stlinux.com
+S: Supported
+F: drivers/net/stmmac/
+
CYBERPRO FB DRIVER
M: Russell King <linux@arm.linux.org.uk>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
--
1.5.5.6
^ permalink raw reply related
* Re: [Patch -next] Adapt s390 qeth & lcs driver code to use RCU
From: Eric Dumazet @ 2010-11-18 9:33 UTC (permalink / raw)
To: Sachin Sant; +Cc: netdev, davem, linux-s390, linux-next, ursula.braun
In-Reply-To: <20101118091846.26534.38865.sendpatchset@localhost.localdomain>
Le jeudi 18 novembre 2010 à 14:48 +0530, Sachin Sant a écrit :
> Commit 1d7138de878d1d4210727c1200193e69596f93b3
> igmp: RCU conversion of in_dev->mc_list
>
> converted rwlock to RCU.
>
> Update the s390 network drivers(qeth & lcs) code to adapt to this change.
>
> Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
> ---
>
> Only compile tested.
>
Hmm, sorry but this wont work.
> diff -Narup linux-2.6-next/drivers/s390/net/lcs.c linux-2.6-next-new/drivers/s390/net/lcs.c
> --- linux-2.6-next/drivers/s390/net/lcs.c 2010-11-17 11:38:25.000000000 +0530
> +++ linux-2.6-next-new/drivers/s390/net/lcs.c 2010-11-18 11:59:46.000000000 +0530
> @@ -1269,10 +1269,10 @@ lcs_register_mc_addresses(void *data)
> in4_dev = in_dev_get(card->dev);
> if (in4_dev == NULL)
> goto out;
> - read_lock(&in4_dev->mc_list_lock);
> + rcu_read_lock();
If you use rcu_read_lock(), then you also need to
use the rcu list iterators in lcs_remove_mc_addresses() and
lcs_set_mc_addresses()
Then, its strange this driver is not protected by RTNL at this stage.
Ah yes, it uses a kthread from its ndo_set_multicast_list() handler.
This seems not safe at all.
> lcs_remove_mc_addresses(card,in4_dev);
> lcs_set_mc_addresses(card, in4_dev);
> - read_unlock(&in4_dev->mc_list_lock);
> + rcu_read_unlock();
> in_dev_put(in4_dev);
>
> netif_carrier_off(card->dev);
> diff -Narup linux-2.6-next/drivers/s390/net/qeth_l3_main.c linux-2.6-next-new/drivers/s390/net/qeth_l3_main.c
> --- linux-2.6-next/drivers/s390/net/qeth_l3_main.c 2010-10-30 12:54:22.000000000 +0530
> +++ linux-2.6-next-new/drivers/s390/net/qeth_l3_main.c 2010-11-18 11:59:13.000000000 +0530
> @@ -1828,9 +1828,9 @@ static void qeth_l3_add_vlan_mc(struct q
> in_dev = in_dev_get(netdev);
> if (!in_dev)
> continue;
> - read_lock(&in_dev->mc_list_lock);
> + rcu_read_lock();
> qeth_l3_add_mc(card, in_dev);
> - read_unlock(&in_dev->mc_list_lock);
> + rcu_read_unlock();
> in_dev_put(in_dev);
> }
> }
> @@ -1843,10 +1843,10 @@ static void qeth_l3_add_multicast_ipv4(s
> in4_dev = in_dev_get(card->dev);
> if (in4_dev == NULL)
> return;
> - read_lock(&in4_dev->mc_list_lock);
> + rcu_read_lock();
> qeth_l3_add_mc(card, in4_dev);
> qeth_l3_add_vlan_mc(card);
> - read_unlock(&in4_dev->mc_list_lock);
> + rcu_read_unlock();
> in_dev_put(in4_dev);
> }
>
^ permalink raw reply
* Re: [Patch -next] Adapt s390 qeth & lcs driver code to use RCU
From: Eric Dumazet @ 2010-11-18 9:43 UTC (permalink / raw)
To: Sachin Sant; +Cc: netdev, davem, linux-s390, linux-next, ursula.braun
In-Reply-To: <1290072794.2781.10.camel@edumazet-laptop>
Le jeudi 18 novembre 2010 à 10:33 +0100, Eric Dumazet a écrit :
> Le jeudi 18 novembre 2010 à 14:48 +0530, Sachin Sant a écrit :
> > Commit 1d7138de878d1d4210727c1200193e69596f93b3
> > igmp: RCU conversion of in_dev->mc_list
> >
> > converted rwlock to RCU.
> >
> > Update the s390 network drivers(qeth & lcs) code to adapt to this change.
> >
> > Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
> > ---
> >
> > Only compile tested.
> >
>
> Hmm, sorry but this wont work.
>
> > diff -Narup linux-2.6-next/drivers/s390/net/lcs.c linux-2.6-next-new/drivers/s390/net/lcs.c
> > --- linux-2.6-next/drivers/s390/net/lcs.c 2010-11-17 11:38:25.000000000 +0530
> > +++ linux-2.6-next-new/drivers/s390/net/lcs.c 2010-11-18 11:59:46.000000000 +0530
> > @@ -1269,10 +1269,10 @@ lcs_register_mc_addresses(void *data)
> > in4_dev = in_dev_get(card->dev);
> > if (in4_dev == NULL)
> > goto out;
> > - read_lock(&in4_dev->mc_list_lock);
> > + rcu_read_lock();
>
> If you use rcu_read_lock(), then you also need to
> use the rcu list iterators in lcs_remove_mc_addresses() and
> lcs_set_mc_addresses()
>
> Then, its strange this driver is not protected by RTNL at this stage.
>
> Ah yes, it uses a kthread from its ndo_set_multicast_list() handler.
>
> This seems not safe at all.
Please check following patch to give you the idea of what is needed :
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 0f19d54..05755b7 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -1188,7 +1188,9 @@ lcs_remove_mc_addresses(struct lcs_card *card, struct in_device *in4_dev)
spin_lock_irqsave(&card->ipm_lock, flags);
list_for_each(l, &card->ipm_list) {
ipm = list_entry(l, struct lcs_ipm_list, list);
- for (im4 = in4_dev->mc_list; im4 != NULL; im4 = im4->next) {
+ for (im4 = rcu_dereference(in4_dev->mc_list);
+ im4 != NULL;
+ im4 = rcu_dereference(im4->next_rcu)) {
lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev);
if ( (ipm->ipm.ip_addr == im4->multiaddr) &&
(memcmp(buf, &ipm->ipm.mac_addr,
@@ -1233,7 +1235,9 @@ lcs_set_mc_addresses(struct lcs_card *card, struct in_device *in4_dev)
unsigned long flags;
LCS_DBF_TEXT(4, trace, "setmclst");
- for (im4 = in4_dev->mc_list; im4; im4 = im4->next) {
+ for (im4 = rcu_dereference(in4_dev->mc_list);
+ im4 != NULL;
+ im4 = rcu_dereference(im4->next_rcu)) {
lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev);
ipm = lcs_check_addr_entry(card, im4, buf);
if (ipm != NULL)
@@ -1269,10 +1273,10 @@ lcs_register_mc_addresses(void *data)
in4_dev = in_dev_get(card->dev);
if (in4_dev == NULL)
goto out;
- read_lock(&in4_dev->mc_list_lock);
+ rcu_read_lock();
lcs_remove_mc_addresses(card,in4_dev);
lcs_set_mc_addresses(card, in4_dev);
- read_unlock(&in4_dev->mc_list_lock);
+ rcu_read_unlock();
in_dev_put(in4_dev);
netif_carrier_off(card->dev);
^ permalink raw reply related
* Re: [net-next pull-request] Intel Wired LAN Driver Updates
From: Jeff Kirsher @ 2010-11-18 9:49 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20101117.100119.71117424.davem@davemloft.net>
On Wed, Nov 17, 2010 at 10:01, David Miller <davem@davemloft.net> wrote:
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Tue, 16 Nov 2010 20:59:49 -0800
>
>> Here is a batch of fixes/cleanups intended for 2.6.38. In the mix is added
>> support for x540 10GbE MAC. A large part of the changes are ixgbe cleanup
>> patches by Alex.
>>
>> Please let me know if there are problems.
>
> Pulled, thanks Jeff.
>
> But in the future you'll need to still post the patches you're asking
> me to merge to the list. Usually folks do this by posting something
> like a "Subject: [PATCH 0/N] Intel Wired Lan Driver Updates"
> thread-leading posting which contains an overall description of the
> changes, as well as the pull request. This is followed-up with the
> actual patches.
>
> This way people can review the changes and reply to any issues they
> have on-list with a simple reply to the patch in question.
>
> Thanks.
> --
Ok, will do. Thanks.
--
Cheers,
Jeff
^ permalink raw reply
* [PATCH net-2.6] bonding: fix a race in IGMP handling
From: Eric Dumazet @ 2010-11-18 10:26 UTC (permalink / raw)
To: Sachin Sant, David Miller
Cc: netdev, davem, linux-s390, linux-next, ursula.braun, Jay Vosburgh
In-Reply-To: <1290073388.2781.12.camel@edumazet-laptop>
Le jeudi 18 novembre 2010 à 10:43 +0100, Eric Dumazet a écrit :
> Le jeudi 18 novembre 2010 à 10:33 +0100, Eric Dumazet a écrit :
> >
> >
> >
> > Hmm, sorry but this wont work.
> >
> > > diff -Narup linux-2.6-next/drivers/s390/net/lcs.c linux-2.6-next-new/drivers/s390/net/lcs.c
> > > --- linux-2.6-next/drivers/s390/net/lcs.c 2010-11-17 11:38:25.000000000 +0530
> > > +++ linux-2.6-next-new/drivers/s390/net/lcs.c 2010-11-18 11:59:46.000000000 +0530
> > > @@ -1269,10 +1269,10 @@ lcs_register_mc_addresses(void *data)
> > > in4_dev = in_dev_get(card->dev);
> > > if (in4_dev == NULL)
> > > goto out;
> > > - read_lock(&in4_dev->mc_list_lock);
> > > + rcu_read_lock();
> >
> > If you use rcu_read_lock(), then you also need to
> > use the rcu list iterators in lcs_remove_mc_addresses() and
> > lcs_set_mc_addresses()
> >
> > Then, its strange this driver is not protected by RTNL at this stage.
> >
> > Ah yes, it uses a kthread from its ndo_set_multicast_list() handler.
> >
> > This seems not safe at all.
Actually this raises an interesting case for bonding as well.
Before my RCU conversion __bond_resend_igmp_join_requests() was unsafe.
For net-next-2.6, it is now safe (RCU is held), but needs a cleanup
patch to avoid sparse errors.
Thanks
[PATCH net-2.6] bonding: fix a race in IGMP handling
RCU conversion in IGMP code done in net-next-2.6 raised a race in
__bond_resend_igmp_join_requests().
It iterates in_dev->mc_list without appropriate protection (RTNL, or
read_lock on in_dev->mc_list_lock).
Another cpu might delete an entry while we use it and trigger a fault.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>
---
drivers/net/bonding/bond_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index bdb68a6..71a1697 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -878,8 +878,10 @@ static void __bond_resend_igmp_join_requests(struct net_device *dev)
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
if (in_dev) {
+ read_lock(&in_dev->mc_list_lock);
for (im = in_dev->mc_list; im; im = im->next)
ip_mc_rejoin_group(im);
+ read_unlock(&in_dev->mc_list_lock);
}
rcu_read_unlock();
^ permalink raw reply related
* [PATCH net-2.6] CAIF: Fix U5500 compile error for shared memory driver
From: Sjur Braendeland @ 2010-11-18 10:42 UTC (permalink / raw)
To: David Miller, netdev; +Cc: Kim Lilliestierna XX
From: Kim Lilliestierna XX <kim.xx.lilliestierna@stericsson.com>
Rearrange pr_fmt as __func__ is a variable and not a constant
---
drivers/net/caif/caif_shm_u5500.c | 2 +-
drivers/net/caif/caif_shmcore.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/caif/caif_shm_u5500.c b/drivers/net/caif/caif_shm_u5500.c
index 1cd90da..7c1f7b9 100644
--- a/drivers/net/caif/caif_shm_u5500.c
+++ b/drivers/net/caif/caif_shm_u5500.c
@@ -5,7 +5,7 @@
* License terms: GNU General Public License (GPL) version 2
*/
-#define pr_fmt(fmt) KBUILD_MODNAME ":" __func__ "():" fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/version.h>
#include <linux/init.h>
diff --git a/drivers/net/caif/caif_shmcore.c b/drivers/net/caif/caif_shmcore.c
index 19f9c06..e4ee8c2 100644
--- a/drivers/net/caif/caif_shmcore.c
+++ b/drivers/net/caif/caif_shmcore.c
@@ -6,7 +6,7 @@
* License terms: GNU General Public License (GPL) version 2
*/
-#define pr_fmt(fmt) KBUILD_MODNAME ":" __func__ "():" fmt
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
#include <linux/spinlock.h>
#include <linux/sched.h>
--
1.7.0.4
^ permalink raw reply related
* [PATCH net-next-2.6] bonding: IGMP handling cleanup
From: Eric Dumazet @ 2010-11-18 10:49 UTC (permalink / raw)
To: Sachin Sant, David Miller
Cc: netdev, linux-s390, linux-next, ursula.braun, Jay Vosburgh
In-Reply-To: <1290075978.2781.36.camel@edumazet-laptop>
Le jeudi 18 novembre 2010 à 11:26 +0100, Eric Dumazet a écrit :
> Actually this raises an interesting case for bonding as well.
>
> Before my RCU conversion __bond_resend_igmp_join_requests() was unsafe.
>
> For net-next-2.6, it is now safe (RCU is held), but needs a cleanup
> patch to avoid sparse errors.
[PATCH net-next-2.6] bonding: IGMP handling cleanup
Instead of iterating in_dev->mc_list from bonding driver, its better
to call a helper function provided by igmp.c
Details of implementation (locking) are private to igmp code.
ip_mc_rejoin_group(struct ip_mc_list *im) becomes
ip_mc_rejoin_groups(struct in_device *in_dev);
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Sachin Sant <sachinp@in.ibm.com>
---
drivers/net/bonding/bond_main.c | 8 +------
include/linux/igmp.h | 2 -
net/ipv4/igmp.c | 34 +++++++++++++++++-------------
3 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 5188448..e588b2e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -873,15 +873,11 @@ static void bond_mc_del(struct bonding *bond, void *addr)
static void __bond_resend_igmp_join_requests(struct net_device *dev)
{
struct in_device *in_dev;
- struct ip_mc_list *im;
rcu_read_lock();
in_dev = __in_dev_get_rcu(dev);
- if (in_dev) {
- for (im = in_dev->mc_list; im; im = im->next)
- ip_mc_rejoin_group(im);
- }
-
+ if (in_dev)
+ ip_mc_rejoin_groups(in_dev);
rcu_read_unlock();
}
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 7d16467..c4987f2 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -238,7 +238,7 @@ extern void ip_mc_unmap(struct in_device *);
extern void ip_mc_remap(struct in_device *);
extern void ip_mc_dec_group(struct in_device *in_dev, __be32 addr);
extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
-extern void ip_mc_rejoin_group(struct ip_mc_list *im);
+extern void ip_mc_rejoin_groups(struct in_device *in_dev);
#endif
#endif
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index afb1e82..35f0231 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1267,26 +1267,32 @@ EXPORT_SYMBOL(ip_mc_inc_group);
/*
* Resend IGMP JOIN report; used for bonding.
+ * Called with rcu_read_lock()
*/
-void ip_mc_rejoin_group(struct ip_mc_list *im)
+void ip_mc_rejoin_groups(struct in_device *in_dev)
{
#ifdef CONFIG_IP_MULTICAST
- struct in_device *in_dev = im->interface;
-
- if (im->multiaddr == IGMP_ALL_HOSTS)
- return;
+ struct ip_mc_list *im;
+ int type;
+
+ for_each_pmc_rcu(in_dev, im) {
+ if (im->multiaddr == IGMP_ALL_HOSTS)
+ continue;
- /* a failover is happening and switches
- * must be notified immediately */
- if (IGMP_V1_SEEN(in_dev))
- igmp_send_report(in_dev, im, IGMP_HOST_MEMBERSHIP_REPORT);
- else if (IGMP_V2_SEEN(in_dev))
- igmp_send_report(in_dev, im, IGMPV2_HOST_MEMBERSHIP_REPORT);
- else
- igmp_send_report(in_dev, im, IGMPV3_HOST_MEMBERSHIP_REPORT);
+ /* a failover is happening and switches
+ * must be notified immediately
+ */
+ if (IGMP_V1_SEEN(in_dev))
+ type = IGMP_HOST_MEMBERSHIP_REPORT;
+ else if (IGMP_V2_SEEN(in_dev))
+ type = IGMPV2_HOST_MEMBERSHIP_REPORT;
+ else
+ type = IGMPV3_HOST_MEMBERSHIP_REPORT;
+ igmp_send_report(in_dev, im, type);
+ }
#endif
}
-EXPORT_SYMBOL(ip_mc_rejoin_group);
+EXPORT_SYMBOL(ip_mc_rejoin_groups);
/*
* A socket has left a multicast group on device dev
^ permalink raw reply related
* Devices with colon in name (iproute2 bug)
From: Štefan Sakalík @ 2010-11-18 12:14 UTC (permalink / raw)
To: netdev
Hi,
When I add a device with colon via ip (from git 3f5c1a01):
ip link add dev 'a:b' type dummy
then ip link show dev 'a:b' returns
12: a:b: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN
ioctl(SIOCGIFXQLEN) failed: No such device
link/ether 9e:44:b4:ec:77:f1 brd ff:ff:ff:ff:ff:ff
Also ifconfig from net-tools returns
a: error fetching interface information: Device not found
but I guess it's obsolete.
Regards,
-Stefan
^ permalink raw reply
* Re: Devices with colon in name (iproute2 bug)
From: Ben Hutchings @ 2010-11-18 13:25 UTC (permalink / raw)
To: Štefan Sakalík; +Cc: netdev
In-Reply-To: <AANLkTimw7=zS8YNptNNP9YR0v93EwctBvsG58a4z+Y-M@mail.gmail.com>
On Thu, 2010-11-18 at 13:14 +0100, Štefan Sakalík wrote:
> Hi,
> When I add a device with colon via ip (from git 3f5c1a01):
> ip link add dev 'a:b' type dummy
> then ip link show dev 'a:b' returns
> 12: a:b: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN
> ioctl(SIOCGIFXQLEN) failed: No such device
>
> link/ether 9e:44:b4:ec:77:f1 brd ff:ff:ff:ff:ff:ff
>
> Also ifconfig from net-tools returns
> a: error fetching interface information: Device not found
> but I guess it's obsolete.
Linux originally only supported one address per address-family per
interface. Additional addresses had to be assigned to 'alias
interfaces' which were named <base-interface>:<index>. For backward
compatibility, colons in interface names are reserved for this purpose.
If you can create regular interfaces with colons in their names, this
seems to be a kernel bug.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: Loopback performance from kernel 2.6.12 to 2.6.37
From: Eric Dumazet @ 2010-11-18 13:52 UTC (permalink / raw)
To: Jesper Dangaard Brouer; +Cc: netdev, David Miller
In-Reply-To: <1289312742.18992.21.camel@edumazet-laptop>
Le mardi 09 novembre 2010 à 15:25 +0100, Eric Dumazet a écrit :
> So far, so good. These are the expected numbers. Now we have to
> understand why corei7 gets 38 seconds instead of 8 :)
>
>
My tests show a problem with backlog processing, and too big TCP
windows. (at least on loopback and wild senders)
Basically, with huge tcp windows we have now (default 4 Mbytes),
the reader process can have to process up to 4Mbytes of backlogged data
in __release_sock() before returning from its 'small' read(fd, buffer,
1024) done by netcat.
While it processes this backlog, it sends tcp ACKS, allowing sender to
send new frames that might be dropped because of sk_rcvqueues_full(), or
continue to fill receive queue up to the receiver window, feeding the
task in __release_sock() [loop]
This blows cpu caches completely [data is queued, and the dequeue is
done long after], and latency of a single read() can be very high. This
blocks the pipeline of user processing eventually.
<disgress>
I also understand why UDP latencies are so impacted. If we receive a
burst of frames on same socket, the user process reading first frame
might be forced to process the backlog before returning to userland.
Really we must zap lock_sock() from UDP input path.
commit 95766fff6b9a78d1 ([UDP]: Add memory accounting) was a big error.
</disgress>
On my server machine with 6Mbytes of L2 cache, you dont see the problem,
while on my laptop with 3Mbytes of L2 cache, you can see the problem.
I caught this because of new SNMP counter added in 2.6.34
(TCPBacklogDrop), that could easily take 1000 increments during the
test.
I built a test program, maybe easier to use than various netcat flavors
It also use two tasks only, thats better if you have a core 2 Duo like
me on my laptop ;)
To reproduce the problem, run it with option -l 4M
$ netstat -s|grep TCPBacklogDrop
TCPBacklogDrop: 788
$ time ./loopback_transfert -l 1k;netstat -s|grep TCPBacklogDrop
real 0m14.013s
user 0m0.630s
sys 0m13.250s
TCPBacklogDrop: 788
$ time ./loopback_transfert -l 128k;netstat -s|grep TCPBacklogDrop
real 0m7.447s
user 0m0.030s
sys 0m5.490s
TCPBacklogDrop: 789
$ time ./loopback_transfert -l 1M;netstat -s|grep TCPBacklogDrop
real 0m11.206s
user 0m0.020s
sys 0m7.150s
TCPBacklogDrop: 793
$ time ./loopback_transfert -l 4M;netstat -s|grep TCPBacklogDrop
real 0m10.347s
user 0m0.000s
sys 0m6.120s
TCPBacklogDrop: 1510
$ time ./loopback_transfert -l 16k;netstat -s|grep TCPBacklogDrop
real 0m6.810s
user 0m0.040s
sys 0m6.670s
TCPBacklogDrop: 1511
/*
* Very simple program to test TCP loopback speed
* This came from the phoronix benchmark using following :
*
* netcat -d -l 9999 >/dev/null &
* time dd if=/dev/zero bs=1M count=10000 | netcat 127.0.0.1 9999
*
* Problem is the benchmark also use pipe subsystem, and three tasks,
* while the following program uses only TCP subsystem and two tasks.
* I still use small blocksize (netcat apparently use 1Kbyte blocks)
*
* Options :
* -l blocksize (in bytes, default : 1024)
* -s socket SNDBUF/RCVBUF (default : system defaults (too big))
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
long long amount_to_transfert = 10*1024*1024*1024LL; /* 10 Go */
unsigned int blocksize = 1024; /* to mimic netcat very pessimistic behavior */
unsigned int socket_bufsize = 0;
static void Server(int fdlisten)
{
int newfd;
struct sockaddr_in sockaddr;
socklen_t len = sizeof(sockaddr);
char *buffer;
long total = 0;
int ret;
buffer = malloc(blocksize);
newfd = accept(fdlisten, (struct sockaddr *)&sockaddr, &len);
if (newfd == -1) {
perror("accept");
exit(1);
}
close(fdlisten);
if (socket_bufsize)
setsockopt(newfd, SOL_SOCKET, SO_RCVBUF, &socket_bufsize, 4);
while (1) {
ret = read(newfd, buffer, blocksize);
if (ret <= 0) break;
total += ret;
}
close(newfd);
_exit(0);
}
static void usage(int code)
{
exit(code);
}
static long scansize(char *str)
{
char *end;
long res = strtol(str, &end, 0);
if (end) {
if (*end == 'k') res <<= 10;
if (*end == 'M') res <<= 20;
}
return res;
}
int main(int argc, char *argv[])
{
int i;
struct sockaddr_in sockaddr;
socklen_t slen = sizeof(sockaddr);
int fdlisten, fd;
int port;
char *buffer;
long long total = 0;
int ret = 0;
while ((i = getopt(argc, argv, "l:s:")) != EOF) {
if (i == 'l')
blocksize = scansize(optarg);
else if (i == 's')
socket_bufsize = scansize(optarg);
else usage(1);
}
buffer = calloc(blocksize, 1);
fdlisten = socket(AF_INET, SOCK_STREAM, 0);
if (fdlisten == -1) {
perror("socket");
return 1;
}
memset(&sockaddr, 0, sizeof(sockaddr));
sockaddr.sin_family = AF_INET;
sockaddr.sin_port = 0;
sockaddr.sin_addr.s_addr = htonl(0x7f000001);
if (bind(fdlisten, (struct sockaddr *)&sockaddr, sizeof(sockaddr))== -1) {
perror("bind()");
return 1;
}
if (listen(fdlisten, 10)== -1) {
perror("listen");
return 1;
}
getsockname(fdlisten, (struct sockaddr *)&sockaddr, &slen);
port = ntohs(sockaddr.sin_port);
if (fork() == 0)
Server(fdlisten);
close(fdlisten);
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd == -1) {
perror("socket");
return -1;
}
memset(&sockaddr, 0, sizeof(sockaddr));
sockaddr.sin_family = AF_INET;
sockaddr.sin_port = htons(port);
sockaddr.sin_addr.s_addr = htonl(0x7f000001);
if (socket_bufsize)
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &socket_bufsize, 4);
connect(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr));
while (total < amount_to_transfert) {
ret = write(fd, buffer, blocksize);
if (ret <= 0) break;
total += ret;
}
close(fd);
return 0;
}
^ permalink raw reply
* Re: Devices with colon in name (iproute2 bug)
From: Eric Dumazet @ 2010-11-18 14:09 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Štefan Sakalík, netdev
In-Reply-To: <1290086705.3818.63.camel@localhost>
Le jeudi 18 novembre 2010 à 13:25 +0000, Ben Hutchings a écrit :
> Linux originally only supported one address per address-family per
> interface. Additional addresses had to be assigned to 'alias
> interfaces' which were named <base-interface>:<index>. For backward
> compatibility, colons in interface names are reserved for this purpose.
> If you can create regular interfaces with colons in their names, this
> seems to be a kernel bug.
Yes
Speaking of kernel bug, many devices dont set operstate, while they
really are UP
-> UNKNOWN
# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:21:70:b0:e4:89 brd ff:ff:ff:ff:ff:ff
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether 00:23:4e:1a:49:2d brd ff:ff:ff:ff:ff:ff
4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 3e:42:f7:21:de:e2 brd ff:ff:ff:ff:ff:ff
6: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
7: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 3
link/ppp
^ permalink raw reply
* [net-2.6 PATCH] be2net: Fix to avoid firmware update when interface is not open.
From: Sarveshwar Bandi @ 2010-11-18 14:07 UTC (permalink / raw)
To: netdev; +Cc: davem
Since interrupts are enabled only when open is called on the interface,
Attempting a firmware update operation when interface is down could lead to
partial success or failure of operation. This fix fails the request if
netif_running is false.
Signed-off-by: Sarveshwar Bandi <Sarveshwar.Bandi@emulex.com>
---
drivers/net/benet/be_main.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index c36cd2f..cc85cf2 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -2458,6 +2458,12 @@ int be_load_fw(struct be_adapter *adapte
int status, i = 0, num_imgs = 0;
const u8 *p;
+ if (!netif_running(adapter->netdev)) {
+ dev_err(&adapter->pdev->dev,
+ "Firmware load not allowed (interface is down)\n");
+ return -1;
+ }
+
strcpy(fw_file, func);
status = request_firmware(&fw, fw_file, &adapter->pdev->dev);
--
1.4.0
^ permalink raw reply related
* [RFC PATCH] netfilter: remove the duplicate tables
From: Changli Gao @ 2010-11-18 14:39 UTC (permalink / raw)
To: Patrick McHardy
Cc: David S. Miller, Eric Dumazet, netfilter-devel, netdev,
Changli Gao
As only xt_counters are private to each CPU, we don't need to maintain
a whole individual table for each CPU.
In the kernel space, we use the memory of ipt_entry.counters to save a
pointer to a percpu xt_counters. When iptables runs, it only update the
counters on its own CPU.
On non SMP platforms, no change is made.
Only the code of iptables is converted. Thanks for reviews.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
include/linux/netfilter/x_tables.h | 47 ++++++++++++++++--
net/ipv4/netfilter/ip_tables.c | 94 ++++++++++++++-----------------------
net/netfilter/x_tables.c | 33 ++++--------
3 files changed, 90 insertions(+), 84 deletions(-)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 742bec0..593fe04 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -103,7 +103,6 @@ struct _xt_align {
/* Error verdict. */
#define XT_ERROR_TARGET "ERROR"
-#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
struct xt_counters {
@@ -404,13 +403,9 @@ struct xt_table_info {
unsigned int stacksize;
unsigned int __percpu *stackptr;
void ***jumpstack;
- /* ipt_entry tables: one per CPU */
- /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
- void *entries[1];
+ void *entries;
};
-#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
- + nr_cpu_ids * sizeof(char *))
extern int xt_register_target(struct xt_target *target);
extern void xt_unregister_target(struct xt_target *target);
extern int xt_register_targets(struct xt_target *target, unsigned int n);
@@ -550,6 +545,46 @@ static inline unsigned long ifname_compare_aligned(const char *_a,
extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *);
extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
+#ifdef CONFIG_SMP
+#define xt_counters_kern(c) (*(struct xt_counters __percpu **)(c))
+#endif
+
+static inline int xt_counters_kern_init(struct xt_counters *c)
+{
+#ifdef CONFIG_SMP
+ xt_counters_kern(c) = alloc_percpu(struct xt_counters);
+ if (xt_counters_kern(c) == NULL)
+ return -ENOMEM;
+#endif
+ return 0;
+}
+
+static inline void xt_counters_kern_destroy(struct xt_counters *c)
+{
+#ifdef CONFIG_SMP
+ free_percpu(xt_counters_kern(c));
+#endif
+}
+
+static inline struct xt_counters *xt_counters_kern_cpu(struct xt_counters *c,
+ int cpu)
+{
+#ifdef CONFIG_SMP
+ return per_cpu_ptr(xt_counters_kern(c), cpu);
+#else
+ return c;
+#endif
+}
+
+static inline struct xt_counters *xt_counters_kern_this(struct xt_counters *c)
+{
+#ifdef CONFIG_SMP
+ return this_cpu_ptr(xt_counters_kern(c));
+#else
+ return c;
+#endif
+}
+
#ifdef CONFIG_COMPAT
#include <net/compat.h>
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index a846d63..6a94ce0 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -270,7 +270,7 @@ static void trace_packet(const struct sk_buff *skb,
const struct ipt_entry *iter;
unsigned int rulenum = 0;
- table_base = private->entries[smp_processor_id()];
+ table_base = private->entries;
root = get_entry(table_base, private->hook_entry[hook]);
hookname = chainname = hooknames[hook];
@@ -334,7 +334,7 @@ ipt_do_table(struct sk_buff *skb,
xt_info_rdlock_bh();
private = table->private;
cpu = smp_processor_id();
- table_base = private->entries[cpu];
+ table_base = private->entries;
jumpstack = (struct ipt_entry **)private->jumpstack[cpu];
stackptr = per_cpu_ptr(private->stackptr, cpu);
origptr = *stackptr;
@@ -364,7 +364,7 @@ ipt_do_table(struct sk_buff *skb,
goto no_match;
}
- ADD_COUNTER(e->counters, skb->len, 1);
+ ADD_COUNTER(*xt_counters_kern_this(&e->counters), skb->len, 1);
t = ipt_get_target(e);
IP_NF_ASSERT(t->u.kernel.target);
@@ -785,6 +785,7 @@ cleanup_entry(struct ipt_entry *e, struct net *net)
par.family = NFPROTO_IPV4;
if (par.target->destroy != NULL)
par.target->destroy(&par);
+ xt_counters_kern_destroy(&e->counters);
module_put(par.target->me);
}
@@ -868,12 +869,6 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,
return ret;
}
- /* And one copy for every other CPU */
- for_each_possible_cpu(i) {
- if (newinfo->entries[i] && newinfo->entries[i] != entry0)
- memcpy(newinfo->entries[i], entry0, newinfo->size);
- }
-
return ret;
}
@@ -884,42 +879,21 @@ get_counters(const struct xt_table_info *t,
struct ipt_entry *iter;
unsigned int cpu;
unsigned int i;
- unsigned int curcpu = get_cpu();
-
- /* Instead of clearing (by a previous call to memset())
- * the counters and using adds, we set the counters
- * with data used by 'current' CPU.
- *
- * Bottom half has to be disabled to prevent deadlock
- * if new softirq were to run and call ipt_do_table
- */
- local_bh_disable();
- i = 0;
- xt_entry_foreach(iter, t->entries[curcpu], t->size) {
- SET_COUNTER(counters[i], iter->counters.bcnt,
- iter->counters.pcnt);
- ++i;
- }
- local_bh_enable();
- /* Processing counters from other cpus, we can let bottom half enabled,
- * (preemption is disabled)
- */
+ struct xt_counters *counter;
+ memset(counters, 0, sizeof(struct xt_counters) * t->number);
for_each_possible_cpu(cpu) {
- if (cpu == curcpu)
- continue;
i = 0;
local_bh_disable();
xt_info_wrlock(cpu);
- xt_entry_foreach(iter, t->entries[cpu], t->size) {
- ADD_COUNTER(counters[i], iter->counters.bcnt,
- iter->counters.pcnt);
+ xt_entry_foreach(iter, t->entries, t->size) {
+ counter = xt_counters_kern_cpu(&iter->counters, cpu);
+ ADD_COUNTER(counters[i], counter->bcnt, counter->pcnt);
++i; /* macro does multi eval of i */
}
xt_info_wrunlock(cpu);
local_bh_enable();
}
- put_cpu();
}
static struct xt_counters *alloc_counters(const struct xt_table *table)
@@ -962,7 +936,7 @@ copy_entries_to_user(unsigned int total_size,
* This choice is lazy (because current thread is
* allowed to migrate to another cpu)
*/
- loc_cpu_entry = private->entries[raw_smp_processor_id()];
+ loc_cpu_entry = private->entries;
if (copy_to_user(userptr, loc_cpu_entry, total_size) != 0) {
ret = -EFAULT;
goto free_counters;
@@ -1076,10 +1050,10 @@ static int compat_table_info(const struct xt_table_info *info,
if (!newinfo || !info)
return -EINVAL;
- /* we dont care about newinfo->entries[] */
+ /* we dont care about newinfo->entries */
memcpy(newinfo, info, offsetof(struct xt_table_info, entries));
newinfo->initial_entries = 0;
- loc_cpu_entry = info->entries[raw_smp_processor_id()];
+ loc_cpu_entry = info->entries;
xt_entry_foreach(iter, loc_cpu_entry, info->size) {
ret = compat_calc_entry(iter, info, loc_cpu_entry, newinfo);
if (ret != 0)
@@ -1199,9 +1173,14 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
struct xt_table *t;
struct xt_table_info *oldinfo;
struct xt_counters *counters;
- void *loc_cpu_old_entry;
struct ipt_entry *iter;
+ xt_entry_foreach(iter, newinfo->entries, newinfo->size) {
+ ret = xt_counters_kern_init(&iter->counters);
+ if (ret < 0)
+ return ret;
+ }
+
ret = 0;
counters = vmalloc(num_counters * sizeof(struct xt_counters));
if (!counters) {
@@ -1242,8 +1221,7 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks,
get_counters(oldinfo, counters);
/* Decrease module usage counts and free resource */
- loc_cpu_old_entry = oldinfo->entries[raw_smp_processor_id()];
- xt_entry_foreach(iter, loc_cpu_old_entry, oldinfo->size)
+ xt_entry_foreach(iter, oldinfo->entries, oldinfo->size)
cleanup_entry(iter, net);
xt_free_table_info(oldinfo);
@@ -1283,8 +1261,7 @@ do_replace(struct net *net, const void __user *user, unsigned int len)
if (!newinfo)
return -ENOMEM;
- /* choose the copy that is on our node/cpu */
- loc_cpu_entry = newinfo->entries[raw_smp_processor_id()];
+ loc_cpu_entry = newinfo->entries;
if (copy_from_user(loc_cpu_entry, user + sizeof(tmp),
tmp.size) != 0) {
ret = -EFAULT;
@@ -1325,7 +1302,6 @@ do_add_counters(struct net *net, const void __user *user,
struct xt_table *t;
const struct xt_table_info *private;
int ret = 0;
- void *loc_cpu_entry;
struct ipt_entry *iter;
#ifdef CONFIG_COMPAT
struct compat_xt_counters_info compat_tmp;
@@ -1382,10 +1358,10 @@ do_add_counters(struct net *net, const void __user *user,
i = 0;
/* Choose the copy that is on our node */
curcpu = smp_processor_id();
- loc_cpu_entry = private->entries[curcpu];
xt_info_wrlock(curcpu);
- xt_entry_foreach(iter, loc_cpu_entry, private->size) {
- ADD_COUNTER(iter->counters, paddc[i].bcnt, paddc[i].pcnt);
+ xt_entry_foreach(iter, private->entries, private->size) {
+ ADD_COUNTER(*xt_counters_kern_this(&iter->counters),
+ paddc[i].bcnt, paddc[i].pcnt);
++i;
}
xt_info_wrunlock(curcpu);
@@ -1728,7 +1704,7 @@ translate_compat_table(struct net *net,
newinfo->hook_entry[i] = info->hook_entry[i];
newinfo->underflow[i] = info->underflow[i];
}
- entry1 = newinfo->entries[raw_smp_processor_id()];
+ entry1 = newinfo->entries;
pos = entry1;
size = total_size;
xt_entry_foreach(iter0, entry0, total_size) {
@@ -1780,11 +1756,6 @@ translate_compat_table(struct net *net,
return ret;
}
- /* And one copy for every other CPU */
- for_each_possible_cpu(i)
- if (newinfo->entries[i] && newinfo->entries[i] != entry1)
- memcpy(newinfo->entries[i], entry1, newinfo->size);
-
*pinfo = newinfo;
*pentry0 = entry1;
xt_free_table_info(info);
@@ -1828,7 +1799,7 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len)
return -ENOMEM;
/* choose the copy that is on our node/cpu */
- loc_cpu_entry = newinfo->entries[raw_smp_processor_id()];
+ loc_cpu_entry = newinfo->entries;
if (copy_from_user(loc_cpu_entry, user + sizeof(tmp),
tmp.size) != 0) {
ret = -EFAULT;
@@ -1911,7 +1882,7 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table,
* This choice is lazy (because current thread is
* allowed to migrate to another cpu)
*/
- loc_cpu_entry = private->entries[raw_smp_processor_id()];
+ loc_cpu_entry = private->entries;
pos = userptr;
size = total_size;
xt_entry_foreach(iter, loc_cpu_entry, total_size) {
@@ -2081,6 +2052,7 @@ struct xt_table *ipt_register_table(struct net *net,
struct xt_table_info bootstrap = {0};
void *loc_cpu_entry;
struct xt_table *new_table;
+ struct ipt_entry *iter;
newinfo = xt_alloc_table_info(repl->size);
if (!newinfo) {
@@ -2089,13 +2061,19 @@ struct xt_table *ipt_register_table(struct net *net,
}
/* choose the copy on our node/cpu, but dont care about preemption */
- loc_cpu_entry = newinfo->entries[raw_smp_processor_id()];
+ loc_cpu_entry = newinfo->entries;
memcpy(loc_cpu_entry, repl->entries, repl->size);
ret = translate_table(net, newinfo, loc_cpu_entry, repl);
if (ret != 0)
goto out_free;
+ xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) {
+ ret = xt_counters_kern_init(&iter->counters);
+ if (ret < 0)
+ goto out_free;
+ }
+
new_table = xt_register_table(net, table, &bootstrap, newinfo);
if (IS_ERR(new_table)) {
ret = PTR_ERR(new_table);
@@ -2105,6 +2083,8 @@ struct xt_table *ipt_register_table(struct net *net,
return new_table;
out_free:
+ xt_entry_foreach(iter, loc_cpu_entry, newinfo->size)
+ xt_counters_kern_destroy(&iter->counters);
xt_free_table_info(newinfo);
out:
return ERR_PTR(ret);
@@ -2120,7 +2100,7 @@ void ipt_unregister_table(struct net *net, struct xt_table *table)
private = xt_unregister_table(table);
/* Decrease module usage counts and free resources */
- loc_cpu_entry = private->entries[raw_smp_processor_id()];
+ loc_cpu_entry = private->entries;
xt_entry_foreach(iter, loc_cpu_entry, private->size)
cleanup_entry(iter, net);
if (private->number > private->initial_entries)
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 8046350..8053cbe 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -639,31 +639,24 @@ EXPORT_SYMBOL_GPL(xt_compat_target_to_user);
struct xt_table_info *xt_alloc_table_info(unsigned int size)
{
struct xt_table_info *newinfo;
- int cpu;
/* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */
if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages)
return NULL;
- newinfo = kzalloc(XT_TABLE_INFO_SZ, GFP_KERNEL);
+ newinfo = kzalloc(sizeof(*newinfo), GFP_KERNEL);
if (!newinfo)
return NULL;
newinfo->size = size;
- for_each_possible_cpu(cpu) {
- if (size <= PAGE_SIZE)
- newinfo->entries[cpu] = kmalloc_node(size,
- GFP_KERNEL,
- cpu_to_node(cpu));
- else
- newinfo->entries[cpu] = vmalloc_node(size,
- cpu_to_node(cpu));
-
- if (newinfo->entries[cpu] == NULL) {
- xt_free_table_info(newinfo);
- return NULL;
- }
+ if (size <= PAGE_SIZE)
+ newinfo->entries = kmalloc(size, GFP_KERNEL);
+ else
+ newinfo->entries = vmalloc(size);
+ if (newinfo->entries == NULL) {
+ xt_free_table_info(newinfo);
+ return NULL;
}
return newinfo;
@@ -674,12 +667,10 @@ void xt_free_table_info(struct xt_table_info *info)
{
int cpu;
- for_each_possible_cpu(cpu) {
- if (info->size <= PAGE_SIZE)
- kfree(info->entries[cpu]);
- else
- vfree(info->entries[cpu]);
- }
+ if (info->size <= PAGE_SIZE)
+ kfree(info->entries);
+ else
+ vfree(info->entries);
if (info->jumpstack != NULL) {
if (sizeof(void *) * info->stacksize > PAGE_SIZE) {
^ permalink raw reply related
* Regression 2.6.36 - driver rtl8169 crashes kernel, triggered by user app
From: Michael Monnerie @ 2010-11-18 14:49 UTC (permalink / raw)
To: linux-kernel; +Cc: romieu, netdev
[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]
I did not get any answer, so here again:
Dear list, I've hunted down a bug which does *NOT* occur in kernel
2.6.34.7-0.5-desktop from openSUSE 11.3, but crashes stock kernel 2.6.36
triggered by a user!
It's actually very simple. From my desktop (kernel 2.6.36) I "cd" to an
NFS4 share, where a xz compressed image of Win7-64.iso.xz is located.
# cd /q/iso-images
and then I try to uncompress it there (as user, not root!):
# xz -kv Win7-64.iso.xz
With kernel 2.6.34.7-0.5-desktop, this runs with ~41MiB/s without
problems.
With kernel 2.6.36, it runs at ~26MiB/s, and while doing so, dmesg shows
a lot of noise about r8169 complaining:
http://zmi.at/x/kernel2.6.36-crash86.jpg
Here are 2 pictures of different crashes:
http://zmi.at/x/kernel2.6.36-crash84.jpg
http://zmi.at/x/kernel2.6.36-crash85.jpg
Neither the dmesg-messages nor the crash happens with kernel
2.6.34.7-0.5-desktop as delivered by openSUSE 11.3, but it always fully
crashes 2.6.36. I've retried about 10 times, it *never* finished to
uncompress the ~3GB image. At around 500-1000MB the kernel was gone.
I'm sure someone knows how to fix it. :-)
--
mit freundlichen Grüssen,
Michael Monnerie, Ing. BSc
it-management Internet Services
http://proteger.at [gesprochen: Prot-e-schee]
Tel: 0660 / 415 65 31
****** Radiointerview zum Thema Spam ******
http://www.it-podcast.at/archiv.html#podcast-100716
// Wir haben im Moment zwei Häuser zu verkaufen:
// http://zmi.at/langegg/
// http://zmi.at/haus2009/
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* [PATH] dev: reusing unregistered ifindex values in net_device
From: Daniel Turull @ 2010-11-18 15:25 UTC (permalink / raw)
To: netdev; +Cc: Voravit T., Robert Olsson
When a new index is going to be assigned in register_netdevice,
the dev_new_index starts to search possible values from the last index
given to a device although there might be some free ifindex that has been
previously unregistered. This behaviour may create gap(s) in the ifindex list.
This patch checks for unused values from 1 and gives to the new device the
first available value. This limits the maximum ifindex to a smaller value.
The ifindex will still be unique since the old value is no longer in use.
Reported-by: Voravit Tanyingyong <voravit@kth.se>
Signed-off-by: Daniel Turull <daniel.turull@gmail.com>
---
diff --git a/net/core/dev.c b/net/core/dev.c
index 381b8e2..a7babab 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4871,7 +4871,7 @@ int dev_ioctl(struct net *net, unsigned int cmd,
void __user *arg)
*/
static int dev_new_index(struct net *net)
{
- static int ifindex;
+ int ifindex;
for (;;) {
if (++ifindex <= 0)
ifindex = 1;
^ permalink raw reply related
* Re: [PATH] dev: reusing unregistered ifindex values in net_device
From: Eric Dumazet @ 2010-11-18 15:37 UTC (permalink / raw)
To: Daniel Turull; +Cc: netdev, Voravit T., Robert Olsson
In-Reply-To: <AANLkTinx6Ww4ZwRUTyYD_STPSRsSFck8O=W5yeJSbBs_@mail.gmail.com>
Le jeudi 18 novembre 2010 à 16:25 +0100, Daniel Turull a écrit :
> When a new index is going to be assigned in register_netdevice,
> the dev_new_index starts to search possible values from the last index
> given to a device although there might be some free ifindex that has been
> previously unregistered. This behaviour may create gap(s) in the ifindex list.
>
> This patch checks for unused values from 1 and gives to the new device the
> first available value. This limits the maximum ifindex to a smaller value.
>
> The ifindex will still be unique since the old value is no longer in use.
>
> Reported-by: Voravit Tanyingyong <voravit@kth.se>
> Signed-off-by: Daniel Turull <daniel.turull@gmail.com>
>
> ---
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 381b8e2..a7babab 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4871,7 +4871,7 @@ int dev_ioctl(struct net *net, unsigned int cmd,
> void __user *arg)
> */
> static int dev_new_index(struct net *net)
> {
> - static int ifindex;
> + int ifindex;
> for (;;) {
> if (++ifindex <= 0)
> ifindex = 1;
> --
NACK
Two bugs
1) ifindex is not initialized : you'll be suprised of random values
2) ifindex should not be reused. You'll be surprised so applications can
break. SNMP comes to mind.
^ permalink raw reply
* Re: [RFC PATCH] netfilter: remove the duplicate tables
From: Eric Dumazet @ 2010-11-18 15:43 UTC (permalink / raw)
To: Changli Gao; +Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev
In-Reply-To: <1290091194-1590-1-git-send-email-xiaosuo@gmail.com>
Le jeudi 18 novembre 2010 à 22:39 +0800, Changli Gao a écrit :
> As only xt_counters are private to each CPU, we don't need to maintain
> a whole individual table for each CPU.
>
> In the kernel space, we use the memory of ipt_entry.counters to save a
> pointer to a percpu xt_counters. When iptables runs, it only update the
> counters on its own CPU.
>
> On non SMP platforms, no change is made.
>
> Only the code of iptables is converted. Thanks for reviews.
>
Changli
I answered you a (difficult) work was in progress, still you post a
patch that needs our review and time ? This is crazy.
I am tempted to stop here. Oh well...
Your way of allocating a percpu counter for each counter is a pure TLB
and cache line blower (up to two cache lines per counter), not counting
the time needed to load a new table with 10.000 entries. Some people
still use scripts with hundred of calls to iptables.
percpu_alloc() is not meant to be used thousand of times per second. It
is not scalable.
You consume 16 bytes per counter in the main table, while 4 bytes index
should be enough on SMP build. Most firewalls I know use two or four
cpus at most.
They care about speed, not really because iptables duplicates table on
each cpu. By the way, not using NUMA can definitly hurt firewalls with
many rules, unless you make sure the main table is vmalloced() with node
distribution, not a single node. Even with this, this can hurt
latencies.
Allocating one contiguous percpu var for all counters is a must.
Problem is : percpu alloc doesnt allow big allocations.
#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(32 << 10)
So max allocation is 32 Kbytes, thats 2048 'xt_counters' only.
-> cannot really use pcpu-alloc, but a kmalloc_node() or vmalloc_node()
per cpu
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATH] dev: reusing unregistered ifindex values in net_device
From: Daniel Turull @ 2010-11-18 15:43 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, Voravit T., Robert Olsson
In-Reply-To: <1290094628.2781.195.camel@edumazet-laptop>
Ok,
thanks you for you quick response.
//Daniel
On Thu, Nov 18, 2010 at 16:37, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le jeudi 18 novembre 2010 à 16:25 +0100, Daniel Turull a écrit :
>> When a new index is going to be assigned in register_netdevice,
>> the dev_new_index starts to search possible values from the last index
>> given to a device although there might be some free ifindex that has been
>> previously unregistered. This behaviour may create gap(s) in the ifindex list.
>>
>> This patch checks for unused values from 1 and gives to the new device the
>> first available value. This limits the maximum ifindex to a smaller value.
>>
>> The ifindex will still be unique since the old value is no longer in use.
>>
>> Reported-by: Voravit Tanyingyong <voravit@kth.se>
>> Signed-off-by: Daniel Turull <daniel.turull@gmail.com>
>>
>> ---
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 381b8e2..a7babab 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -4871,7 +4871,7 @@ int dev_ioctl(struct net *net, unsigned int cmd,
>> void __user *arg)
>> */
>> static int dev_new_index(struct net *net)
>> {
>> - static int ifindex;
>> + int ifindex;
>> for (;;) {
>> if (++ifindex <= 0)
>> ifindex = 1;
>> --
>
> NACK
>
> Two bugs
>
> 1) ifindex is not initialized : you'll be suprised of random values
>
> 2) ifindex should not be reused. You'll be surprised so applications can
> break. SNMP comes to mind.
>
>
>
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox