Netdev List
 help / color / mirror / Atom feed
* [PATCH 3/5] inet: Add family scope inetpeer flushes.
From: David Miller @ 2012-06-11  9:29 UTC (permalink / raw)
  To: netdev


This implementation can deal with having many inetpeer roots, which is
a necessary prerequisite for per-FIB table rooted peer tables.

Each family (AF_INET, AF_INET6) has a sequence number which we bump
when we get a family invalidation request.

Each peer lookup cheaply checks whether the flush sequence of the
root we are using is out of date, and if so flushes it and updates
the sequence number.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/inetpeer.h |    2 ++
 net/ipv4/inetpeer.c    |   28 ++++++++++++++++++++++++++++
 net/ipv4/route.c       |    2 +-
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index d432489..e15c086 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -68,6 +68,7 @@ struct inet_peer {
 struct inet_peer_base {
 	struct inet_peer __rcu	*root;
 	seqlock_t		lock;
+	u32			flush_seq;
 	int			total;
 };
 
@@ -168,6 +169,7 @@ extern void inet_putpeer(struct inet_peer *p);
 extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
 
 extern void inetpeer_invalidate_tree(struct inet_peer_base *);
+extern void inetpeer_invalidate_family(int family);
 
 /*
  * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index e4cba56..cac02ad 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -86,10 +86,36 @@ void inet_peer_base_init(struct inet_peer_base *bp)
 {
 	bp->root = peer_avl_empty_rcu;
 	seqlock_init(&bp->lock);
+	bp->flush_seq = ~0U;
 	bp->total = 0;
 }
 EXPORT_SYMBOL_GPL(inet_peer_base_init);
 
+static atomic_t v4_seq = ATOMIC_INIT(0);
+static atomic_t v6_seq = ATOMIC_INIT(0);
+
+static atomic_t *inetpeer_seq_ptr(int family)
+{
+	return (family == AF_INET ? &v4_seq : &v6_seq);
+}
+
+static inline void flush_check(struct inet_peer_base *base, int family)
+{
+	atomic_t *fp = inetpeer_seq_ptr(family);
+
+	if (unlikely(base->flush_seq != atomic_read(fp))) {
+		inetpeer_invalidate_tree(base);
+		base->flush_seq = atomic_read(fp);
+	}
+}
+
+void inetpeer_invalidate_family(int family)
+{
+	atomic_t *fp = inetpeer_seq_ptr(family);
+
+	atomic_inc(fp);
+}
+
 #define PEER_MAXDEPTH 40 /* sufficient for about 2^27 nodes */
 
 /* Exported for sysctl_net_ipv4.  */
@@ -437,6 +463,8 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
 	unsigned int sequence;
 	int invalidated, gccnt = 0;
 
+	flush_check(base, daddr->family);
+
 	/* Attempt a lockless lookup first.
 	 * Because of a concurrent writer, we might not find an existing entry.
 	 */
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4f5834c..456a947 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -935,7 +935,7 @@ static void rt_cache_invalidate(struct net *net)
 
 	get_random_bytes(&shuffle, sizeof(shuffle));
 	atomic_add(shuffle + 1U, &net->ipv4.rt_genid);
-	inetpeer_invalidate_tree(net->ipv4.peers);
+	inetpeer_invalidate_family(AF_INET);
 }
 
 /*
-- 
1.7.10

^ permalink raw reply related

* [PATCH 4/5] inet: Add inetpeer tree roots to the FIB tables.
From: David Miller @ 2012-06-11  9:29 UTC (permalink / raw)
  To: netdev


Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/ip6_fib.h |    1 +
 include/net/ip_fib.h  |   12 +++++++-----
 net/ipv4/fib_trie.c   |    3 +++
 net/ipv6/ip6_fib.c    |    5 +++++
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 3ac5f15..a192f78 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -237,6 +237,7 @@ struct fib6_table {
 	u32			tb6_id;
 	rwlock_t		tb6_lock;
 	struct fib6_node	tb6_root;
+	struct inet_peer_base	tb6_peers;
 };
 
 #define RT6_TABLE_UNSPEC	RT_TABLE_UNSPEC
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 78df0866..4b347c0 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -19,6 +19,7 @@
 #include <net/flow.h>
 #include <linux/seq_file.h>
 #include <net/fib_rules.h>
+#include <net/inetpeer.h>
 
 struct fib_config {
 	u8			fc_dst_len;
@@ -157,11 +158,12 @@ extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
 					 FIB_RES_SADDR(net, res))
 
 struct fib_table {
-	struct hlist_node tb_hlist;
-	u32		tb_id;
-	int		tb_default;
-	int		tb_num_default;
-	unsigned long	tb_data[0];
+	struct hlist_node	tb_hlist;
+	u32			tb_id;
+	int			tb_default;
+	int			tb_num_default;
+	struct inet_peer_base	tb_peers;
+	unsigned long		tb_data[0];
 };
 
 extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 18cbc15..9b0f259 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1843,6 +1843,8 @@ int fib_table_flush(struct fib_table *tb)
 	if (ll && hlist_empty(&ll->list))
 		trie_leaf_remove(t, ll);
 
+	inetpeer_invalidate_tree(&tb->tb_peers);
+
 	pr_debug("trie_flush found=%d\n", found);
 	return found;
 }
@@ -1991,6 +1993,7 @@ struct fib_table *fib_trie_table(u32 id)
 	tb->tb_id = id;
 	tb->tb_default = -1;
 	tb->tb_num_default = 0;
+	inet_peer_base_init(&tb->tb_peers);
 
 	t = (struct trie *) tb->tb_data;
 	memset(t, 0, sizeof(*t));
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 0c220a4..7ef0743 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -197,6 +197,7 @@ static struct fib6_table *fib6_alloc_table(struct net *net, u32 id)
 		table->tb6_id = id;
 		table->tb6_root.leaf = net->ipv6.ip6_null_entry;
 		table->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+		inet_peer_base_init(&table->tb6_peers);
 	}
 
 	return table;
@@ -1633,6 +1634,7 @@ static int __net_init fib6_net_init(struct net *net)
 	net->ipv6.fib6_main_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry;
 	net->ipv6.fib6_main_tbl->tb6_root.fn_flags =
 		RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+	inet_peer_base_init(&net->ipv6.fib6_main_tbl->tb6_peers);
 
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
 	net->ipv6.fib6_local_tbl = kzalloc(sizeof(*net->ipv6.fib6_local_tbl),
@@ -1643,6 +1645,7 @@ static int __net_init fib6_net_init(struct net *net)
 	net->ipv6.fib6_local_tbl->tb6_root.leaf = net->ipv6.ip6_null_entry;
 	net->ipv6.fib6_local_tbl->tb6_root.fn_flags =
 		RTN_ROOT | RTN_TL_ROOT | RTN_RTINFO;
+	inet_peer_base_init(&net->ipv6.fib6_local_tbl->tb6_peers);
 #endif
 	fib6_tables_init(net);
 
@@ -1666,8 +1669,10 @@ static void fib6_net_exit(struct net *net)
 	del_timer_sync(&net->ipv6.ip6_fib_timer);
 
 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
+	inetpeer_invalidate_tree(&net->ipv6.fib6_local_tbl->tb6_peers);
 	kfree(net->ipv6.fib6_local_tbl);
 #endif
+	inetpeer_invalidate_tree(&net->ipv6.fib6_main_tbl->tb6_peers);
 	kfree(net->ipv6.fib6_main_tbl);
 	kfree(net->ipv6.fib_table_hash);
 	kfree(net->ipv6.rt6_stats);
-- 
1.7.10

^ permalink raw reply related

* [PATCH 5/5] inet: Use FIB table peer roots in routes.
From: David Miller @ 2012-06-11  9:29 UTC (permalink / raw)
  To: netdev


Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/route.c |    8 ++++++--
 net/ipv6/route.c |   14 ++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 456a947..4c33ce3 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2125,7 +2125,7 @@ static int __mkroute_input(struct sk_buff *skb,
 	rth->rt_gateway	= daddr;
 	rth->rt_spec_dst= spec_dst;
 	rth->rt_peer_genid = 0;
-	rt_init_peer(rth, dev_net(rth->dst.dev)->ipv4.peers);
+	rt_init_peer(rth, &res->table->tb_peers);
 	rth->fi = NULL;
 
 	rth->dst.input = ip_forward;
@@ -2512,7 +2512,9 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
 	rth->rt_gateway = fl4->daddr;
 	rth->rt_spec_dst= fl4->saddr;
 	rth->rt_peer_genid = 0;
-	rt_init_peer(rth, dev_net(dev_out)->ipv4.peers);
+	rt_init_peer(rth, (res->table ?
+			   &res->table->tb_peers :
+			   dev_net(dev_out)->ipv4.peers));
 	rth->fi = NULL;
 
 	RT_CACHE_STAT_INC(out_slow_tot);
@@ -2561,6 +2563,7 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
 	int orig_oif;
 
 	res.fi		= NULL;
+	res.table	= NULL;
 #ifdef CONFIG_IP_MULTIPLE_TABLES
 	res.r		= NULL;
 #endif
@@ -2666,6 +2669,7 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4)
 
 	if (fib_lookup(net, fl4, &res)) {
 		res.fi = NULL;
+		res.table = NULL;
 		if (fl4->flowi4_oif) {
 			/* Apparently, routing tables are wrong. Assume,
 			   that the destination is on link.
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 17a9b86..d9ba480 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -260,7 +260,8 @@ static struct rt6_info ip6_blk_hole_entry_template = {
 /* allocate dst with ip6_dst_ops */
 static inline struct rt6_info *ip6_dst_alloc(struct net *net,
 					     struct net_device *dev,
-					     int flags)
+					     int flags,
+					     struct fib6_table *table)
 {
 	struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev,
 					0, 0, flags);
@@ -268,7 +269,7 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
 	if (rt) {
 		memset(&rt->rt6i_table, 0,
 		       sizeof(*rt) - sizeof(struct dst_entry));
-		rt6_init_peer(rt, net->ipv6.peers);
+		rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
 	}
 	return rt;
 }
@@ -1114,7 +1115,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
 	if (unlikely(!idev))
 		return ERR_PTR(-ENODEV);
 
-	rt = ip6_dst_alloc(net, dev, 0);
+	rt = ip6_dst_alloc(net, dev, 0, NULL);
 	if (unlikely(!rt)) {
 		in6_dev_put(idev);
 		dst = ERR_PTR(-ENOMEM);
@@ -1296,7 +1297,7 @@ int ip6_route_add(struct fib6_config *cfg)
 	if (!table)
 		goto out;
 
-	rt = ip6_dst_alloc(net, NULL, DST_NOCOUNT);
+	rt = ip6_dst_alloc(net, NULL, DST_NOCOUNT, table);
 
 	if (!rt) {
 		err = -ENOMEM;
@@ -1818,7 +1819,8 @@ static struct rt6_info *ip6_rt_copy(struct rt6_info *ort,
 				    const struct in6_addr *dest)
 {
 	struct net *net = dev_net(ort->dst.dev);
-	struct rt6_info *rt = ip6_dst_alloc(net, ort->dst.dev, 0);
+	struct rt6_info *rt = ip6_dst_alloc(net, ort->dst.dev, 0,
+					    ort->rt6i_table);
 
 	if (rt) {
 		rt->dst.input = ort->dst.input;
@@ -2102,7 +2104,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
 				    bool anycast)
 {
 	struct net *net = dev_net(idev->dev);
-	struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, 0);
+	struct rt6_info *rt = ip6_dst_alloc(net, net->loopback_dev, 0, NULL);
 	int err;
 
 	if (!rt) {
-- 
1.7.10

^ permalink raw reply related

* Re: [PATCH] lpc_eth: add missing ndo_change_mtu()
From: Roland Stigge @ 2012-06-11  9:36 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, netdev, kevin.wells, aletes.xgr, srinivas.bakki
In-Reply-To: <1339406640.6001.1896.camel@edumazet-glaptop>

On 06/11/2012 11:24 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> lpc_eth does a copy of transmitted skbs to DMA area, without checking
> skb lengths, so can trigger buffer overflows :
> 
> memcpy(pldat->tx_buff_v + txidx * ENET_MAXF_SIZE, skb->data, len);
> 
> One way to get bigger skbs is to allow MTU changes above the 1500 limit.
> 
> Calling eth_change_mtu() in ndo_change_mtu() makes sure this cannot
> happen.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Acked-by: Roland Stigge <stigge@antcom.de>

> Cc: Roland Stigge <stigge@antcom.de>
> Cc: Kevin Wells <kevin.wells@nxp.com>
> ---
> diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
> index 8d2666f..10febdc 100644
> --- a/drivers/net/ethernet/nxp/lpc_eth.c
> +++ b/drivers/net/ethernet/nxp/lpc_eth.c
> @@ -1320,6 +1320,7 @@ static const struct net_device_ops lpc_netdev_ops = {
>  	.ndo_set_rx_mode	= lpc_eth_set_multicast_list,
>  	.ndo_do_ioctl		= lpc_eth_ioctl,
>  	.ndo_set_mac_address	= lpc_set_mac_address,
> +	.ndo_change_mtu		= eth_change_mtu,
>  };
>  
>  static int lpc_eth_drv_probe(struct platform_device *pdev)
> 
> 

^ permalink raw reply

* Re: [PATCH rfc net] Allow the autoconfigured network interface to be renamed.
From: scott @ 2012-06-11  9:58 UTC (permalink / raw)
  To: David Miller; +Cc: scott, netdev, scott.parlane
In-Reply-To: <20120610.202515.138701034400919651.davem@davemloft.net>

> From: Scott Parlane <scott@scottnz.com>
> Date: Sat,  9 Jun 2012 19:48:07 +1200
>
>> From: Scott Parlane <scott.parlane@alliedtelesis.co.nz>
>>
>> if IP_PNP_RENAME_DEV is set, the first interface to be configured
>> automatically by the kernel during boot will be renamed.
>>
>> IP_PNP_DEV_NEWNAME is the name to give the autoconfigured device.
>>
>> No changes will be made to any interface that is not autoconfigured.
>>
>> This allows the assurance of the boot device name, without the need
>> for an initramfs.
>>
>> Signed-off-by: Scott Parlane <scott.parlane@alliedtelesis.co.nz>
>
> Making this a compile time option makes absolutely no sense at all.
>
> Assuming this feature is desirable at all (which is a big IF), it
> should be a kernel command line option.

My comment re how many devices was a reference to the level of testing,
not the usage, however I see it was probably moot given any person with
sufficient
knowledge of the area would see it works as described.
(unless I did something i haven't seen yet)

[background of this solution]
In our configuration we load the same kernel on to a number of testboxes,
each of which has several ethernet interfaces and serial ports
(for communicating with our devices under test)
They use nfsroot which prevents udev rules from working correctly
(because you cant take down the interface to rename it)
Previously we were using an initramfs that would rename the interface,
just before mounting the real root.
However a recent change to glibc prevents busybox's nfs utils from working,
so I made this patch to get the kernel to do it, and remove the need for
the initramfs
(which just slows our boot process anyways)

In our case, we run a custom kernel, and have this option turned on, with a
suitable name so that we can identify the boot interface.

While I agree that being able to configure it from the command line would
be useful,
I would rather that I could (if I wanted) configure it at compile time to
default,
purely because it means there is one less thing my admins need to deal
worry about
or can change in the pxelinux config. (every testbox has a unique cmdline,
because of
how our nfsroot mount points work)

Please let me know if you want me to extend it to support command line
configuration,
and what configuration you would like to trigger it.

Kind Regards,
Scott

^ permalink raw reply

* R: Re: BUG (?) multicast loopback (IP6SKB_FORWARDED)
From: maxd @ 2012-06-11 10:09 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

Hi Eric,
thanks for the quick reply. It seems that reverting the patch fixes the issue, 
and I have not observed any unintended behaviour so far.
Do you know what was the motivation for the patch?

Regards,
Massimiliano

>----Messaggio originale----
>Da: eric.dumazet@gmail.com
>Data: 08/06/2012 19.23
>A: "maxd@inwind.it"<maxd@inwind.it>
>Cc: <netdev@vger.kernel.org>
>Ogg: Re: BUG (?) multicast loopback (IP6SKB_FORWARDED)
>
>On Fri, 2012-06-08 at 18:48 +0200, maxd@inwind.it wrote:
>> Hi guys,
>> I found a probably wrong behaviour while doing some tests with multicast 
>> routing on IPv6 with kernel 2.6.29. I will try to describe what's wrong in 
the 
>> code in the following. I will use the latest kernel sources (3.5-rc1)
>> as reference source code (line numbers are taken there).
>> Let's assume a scenario with a node with two network interfaces acting as 
a 
>> multicast router. The router receives the message on one interface and 
needs to 
>> forward it on the other interface. Looking at the packet flow inside the 
>> kernel, we notice that
>> 
>> in ip6mr.c, line 2282, a flag is set:
>> IP6CB(skb)->flags |= IP6SKB_FORWARDED;
>> 
>> After this, a multicast packet can be looped back (see line 124 in 
ip6_output.
>> c where function ip6_dev_loopback_xmit is called). 
>> The packet is hence reinjected in the stack.
>> 
>> The packet is processed by function ipv6_rcv (ip6_input.c), and then by 
>> ipv6_mc_input (ip6_input.c).
>> 
>> In ipv6_rcv, line 82, the previously set flag is cleared
>> memset(IP6CB(skb), 0, sizeof(struct inet6_skb_parm));
>> 
>> In ipv6_mc_input, , line 268, the flag is checked to determine if the 
packet 
>> has been already forwarded. Since the flag has been cleared, the kernel 
cannot 
>> determine that the packet has been looped back, and will hence try to 
forward 
>> it again.
>> 
>> Trying to forward a looped back packet determines a wrong behaviour of the 
>> multicast routing protocol (PIM): the kernel believes that a multicast 
message 
>> has been received from a wrong interface (line 1993 in ip6mr.c), discard 
the 
>> message (this explains why the packet does not loop forever) and triggers 
the 
>> transmission of an ASSERT message. Basically, the node ends up sending an 
>> ASSERT message because of a looped back packet. 
>> 
>> WDYT? Is my analysis correct? Which is the best way to fix this issue?
>
>I guess your analysis is correct, try to revert commit
>6b7fdc3ae18a0598a999156b62d55ea55220e00f ([IPV6]: Clean skb cb on IPv6
>input) ?
>
>
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" 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: [PATCH rfc net] Allow the autoconfigured network interface to be renamed.
From: David Miller @ 2012-06-11 10:10 UTC (permalink / raw)
  To: scott; +Cc: netdev, scott.parlane
In-Reply-To: <f8f3fa05ddbe3a2e1613588754f151ac.squirrel@scottnz.com>

From: scott@scottnz.com
Date: Mon, 11 Jun 2012 21:58:45 +1200

> They use nfsroot which prevents udev rules from working correctly
> (because you cant take down the interface to rename it)

This is why I hate nfsroot as implemented in the kernel.

Do this right and use an initial ramdisk, then you won't have
this huge disconnect between different device names due to
lack of udev.

Thanks, you've confirmed that this patch is totally inappropriate.

^ permalink raw reply

* IPv6 tc filters
From: Dragos Ilie @ 2012-06-11 10:31 UTC (permalink / raw)
  To: netdev

Hi!

Do IPv6 tc filters work? According to Linux Advanced Routing & Traffic
Control HOWTO, IPv6 does not hook into the Routing Policy Database
(RPDB), thus causing the filters to fail. I would appreciate it if
someone on this list can confirm or refute this claim. If filters have
been fixed, since which kernel/iproute2 version do they work?

Regards,
Dragos

^ permalink raw reply

* Re: IPv6 tc filters
From: Thomas Graf @ 2012-06-11 10:39 UTC (permalink / raw)
  To: Dragos Ilie; +Cc: netdev
In-Reply-To: <CAOLNa-fyvic2xzrUwz2WsEap_CgGmU6OwAf=jMPCUVyXbrimVg@mail.gmail.com>

On Mon, Jun 11, 2012 at 12:31:27PM +0200, Dragos Ilie wrote:
> Do IPv6 tc filters work? According to Linux Advanced Routing & Traffic
> Control HOWTO, IPv6 does not hook into the Routing Policy Database
> (RPDB), thus causing the filters to fail. I would appreciate it if
> someone on this list can confirm or refute this claim. If filters have
> been fixed, since which kernel/iproute2 version do they work?

They do work, tc rules apply to any kind of traffic.

Some specific selectors only work with IPv4 so you need to craft
IPv6 variations yourself.

^ permalink raw reply

* Re: [PATCH rfc net] Allow the autoconfigured network interface to be renamed.
From: scott @ 2012-06-11 10:44 UTC (permalink / raw)
  To: David Miller; +Cc: scott, netdev, scott.parlane
In-Reply-To: <20120611.031053.1433253186495303724.davem@davemloft.net>

> From: scott@scottnz.com
> Date: Mon, 11 Jun 2012 21:58:45 +1200
>
>> They use nfsroot which prevents udev rules from working correctly
>> (because you cant take down the interface to rename it)
>
> This is why I hate nfsroot as implemented in the kernel.
>
The same is true for root over nfs as configured by the initramfs,
conviently there is a small window where you can interfere with it
(at the initramfs stage), or I should say there-was,
its not available anymore, specifically because glibc dropped the sunrpc
code. (This is probably an artifact of gentoo's initramfs more than anything,
but it was the last distro that I could find to network boot without fully
RYO)

> Do this right and use an initial ramdisk, then you won't have
> this huge disconnect between different device names due to
> lack of udev.
>
> Thanks, you've confirmed that this patch is totally inappropriate.
So be it, we will continue to run it, because its the simpliest way to
get what we want done (and most of our software developers can deal
with kernel code, more so than libc)

Regards,
Scott

^ permalink raw reply

* Re: [PATCH 1/5] inet: Hide route peer accesses behind helpers.
From: Eric Dumazet @ 2012-06-11 10:51 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20120611.022908.953732817435232845.davem@davemloft.net>

From: Eric Dumazet <edumazet@google.com>

On Mon, 2012-06-11 at 02:29 -0700, David Miller wrote:
> We encode the pointer(s) into an unsigned long with one state bit.
> 
> The state bit is used so we can store the inetpeer tree root to use
> when resolving the peer later.
> 
> Later the peer roots will be per-FIB table, and this change works to
> facilitate that.

...

> +static inline bool inetpeer_ptr_set_peer(unsigned long *ptr, struct inet_peer *peer)
> +{
> +	unsigned long val = (unsigned long) peer;
> +	unsigned long orig = *ptr;
> +
> +	if (!(orig & INETPEER_BASE_BIT) || !val ||
> +	    cmpxchg(ptr, orig, val) != orig)
> +		return false;
> +	return true;
> +}

If peer is NULL here, we return false;



So we might have a NULL deref later :

>  
>  void rt_bind_peer(struct rtable *rt, __be32 daddr, int create)
>  {
> -	struct net *net = dev_net(rt->dst.dev);
> +	struct inet_peer_base *base;
>  	struct inet_peer *peer;
>  
> -	peer = inet_getpeer_v4(net->ipv4.peers, daddr, create);
> +	base = inetpeer_base_ptr(rt->_peer);
> +	if (!base)
> +		return;
> +
> +	peer = inet_getpeer_v4(base, daddr, create);
>  

Here, peer can be NULL

> -	if (peer && cmpxchg(&rt->peer, NULL, peer) != NULL)
> +	if (!rt_set_peer(rt, peer))
>  		inet_putpeer(peer); << CRASH >>
>  	else
>  		rt->rt_peer_genid = rt_peer_genid();



and in :

>  void rt6_bind_peer(struct rt6_info *rt, int create)
>  {
> -	struct net *net = dev_net(rt->dst.dev);
> +	struct inet_peer_base *base;
>  	struct inet_peer *peer;
>  
> -	peer = inet_getpeer_v6(net->ipv6.peers, &rt->rt6i_dst.addr, create);
> -	if (peer && cmpxchg(&rt->rt6i_peer, NULL, peer) != NULL)
> +	base = inetpeer_base_ptr(rt->_rt6i_peer);
> +	if (!base)
> +		return;
> +
> +	peer = inet_getpeer_v6(base, &rt->rt6i_dst.addr, create);

peer can be NULL

> +	if (!rt6_set_peer(rt, peer))
>  		inet_putpeer(peer);


[PATCH net-next] net: allow NULL param in inet_putpeer()

inet_putpeer() can be called with NULL peer, we must take care of it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/inetpeer.c      |    2 ++
 net/ipv4/ip_fragment.c   |    3 +--
 net/ipv4/tcp_minisocks.c |    3 +--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index cac02ad..cf1e7aa 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -527,6 +527,8 @@ EXPORT_SYMBOL_GPL(inet_getpeer);
 
 void inet_putpeer(struct inet_peer *p)
 {
+	if (!p)
+		return;
 	p->dtime = (__u32)jiffies;
 	smp_mb__before_atomic_dec();
 	atomic_dec(&p->refcnt);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 8d07c97..3bd3ed5 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -192,8 +192,7 @@ static __inline__ void ip4_frag_free(struct inet_frag_queue *q)
 	struct ipq *qp;
 
 	qp = container_of(q, struct ipq, q);
-	if (qp->peer)
-		inet_putpeer(qp->peer);
+	inet_putpeer(qp->peer);
 }
 
 
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index cb01531..b2d89b0 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -410,8 +410,7 @@ void tcp_twsk_destructor(struct sock *sk)
 {
 	struct tcp_timewait_sock *twsk = tcp_twsk(sk);
 
-	if (twsk->tw_peer)
-		inet_putpeer(twsk->tw_peer);
+	inet_putpeer(twsk->tw_peer);
 #ifdef CONFIG_TCP_MD5SIG
 	if (twsk->tw_md5_key) {
 		tcp_free_md5sig_pool();

^ permalink raw reply related

* Re: [PATCH 2/5] ipv4: Kill ip_rt_frag_needed().
From: Steffen Klassert @ 2012-06-11 11:16 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20120611.022911.885347106959530782.davem@davemloft.net>

On Mon, Jun 11, 2012 at 02:29:11AM -0700, David Miller wrote:
> 
> -unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph,
> -				 unsigned short new_mtu,
> -				 struct net_device *dev)
> -{
> -	unsigned short old_mtu = ntohs(iph->tot_len);
> -	unsigned short est_mtu = 0;
> -	struct inet_peer *peer;
> -
> -	peer = inet_getpeer_v4(net->ipv4.peers, iph->daddr, 1);
> -	if (peer) {
> -		unsigned short mtu = new_mtu;
> -
> -		if (new_mtu < 68 || new_mtu >= old_mtu) {
> -			/* BSD 4.2 derived systems incorrectly adjust
> -			 * tot_len by the IP header length, and report
> -			 * a zero MTU in the ICMP message.
> -			 */
> -			if (mtu == 0 &&
> -			    old_mtu >= 68 + (iph->ihl << 2))
> -				old_mtu -= iph->ihl << 2;
> -			mtu = guess_mtu(old_mtu);
> -		}
> -
> -		if (mtu < ip_rt_min_pmtu)
> -			mtu = ip_rt_min_pmtu;
> -		if (!peer->pmtu_expires || mtu < peer->pmtu_learned) {
> -			unsigned long pmtu_expires;
> -
> -			pmtu_expires = jiffies + ip_rt_mtu_expires;
> -			if (!pmtu_expires)
> -				pmtu_expires = 1UL;
> -
> -			est_mtu = mtu;
> -			peer->pmtu_learned = mtu;
> -			peer->pmtu_expires = pmtu_expires;
> -			atomic_inc(&__rt_peer_genid);
> -		}
> -
> -		inet_putpeer(peer);
> -	}
> -	return est_mtu ? : new_mtu;
> -}
> -

It seems that we don't cache the learned pmtu informations
in some cases with ip_rt_frag_needed() removed. 

At least when doing a simple ping test on a network that has
a router with mtu 1300 along the path, the following happens:

bash-3.00# ping -c 4 -s 1400 192.168.40.2                                       
PING 192.168.40.2 (192.168.40.2) 1400(1428) bytes of data.                      
>From 10.2.2.2 icmp_seq=1 Frag needed and DF set (mtu = 1300)                    
>From 10.2.2.2 icmp_seq=2 Frag needed and DF set (mtu = 1300)                    
>From 10.2.2.2 icmp_seq=3 Frag needed and DF set (mtu = 1300)                    
>From 10.2.2.2 icmp_seq=4 Frag needed and DF set (mtu = 1300)                    
                                                                                
--- 192.168.40.2 ping statistics ---                                            
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3005ms     

We should learn the pmtu information with the first packet,
all further packets should get fragmented according to
the learned informations. Unfortunately we don't cache
these informations: 
                                                        
bash-3.00# ip r g 192.168.40.2                                                  
192.168.40.2 via 192.168.20.1 dev eth0  src 192.168.20.2                        
    cache

^ permalink raw reply

* Re: [PATCH 1/5] inet: Hide route peer accesses behind helpers.
From: David Miller @ 2012-06-11 11:19 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev
In-Reply-To: <1339411862.6001.2015.camel@edumazet-glaptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 11 Jun 2012 12:51:02 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> On Mon, 2012-06-11 at 02:29 -0700, David Miller wrote:
>> +static inline bool inetpeer_ptr_set_peer(unsigned long *ptr, struct inet_peer *peer)
>> +{
>> +	unsigned long val = (unsigned long) peer;
>> +	unsigned long orig = *ptr;
>> +
>> +	if (!(orig & INETPEER_BASE_BIT) || !val ||
>> +	    cmpxchg(ptr, orig, val) != orig)
>> +		return false;
>> +	return true;
>> +}
> 
> If peer is NULL here, we return false;

Good catch.

--------------------
inet: Avoid potential NULL peer dereference.

We handle NULL in rt{,6}_set_peer but then our caller will try to pass
that NULL pointer into inet_putpeer() which isn't ready for it.

Fix this by moving the NULL check one level up, and then remove the
now unnecessary NULL check from inetpeer_ptr_set_peer().

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/net/inetpeer.h |    2 +-
 net/ipv4/route.c       |   11 ++++++-----
 net/ipv6/route.c       |   10 ++++++----
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index e15c086..c27c8f1 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -104,7 +104,7 @@ static inline bool inetpeer_ptr_set_peer(unsigned long *ptr, struct inet_peer *p
 	unsigned long val = (unsigned long) peer;
 	unsigned long orig = *ptr;
 
-	if (!(orig & INETPEER_BASE_BIT) || !val ||
+	if (!(orig & INETPEER_BASE_BIT) ||
 	    cmpxchg(ptr, orig, val) != orig)
 		return false;
 	return true;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 4c33ce3..842510d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1333,11 +1333,12 @@ void rt_bind_peer(struct rtable *rt, __be32 daddr, int create)
 		return;
 
 	peer = inet_getpeer_v4(base, daddr, create);
-
-	if (!rt_set_peer(rt, peer))
-		inet_putpeer(peer);
-	else
-		rt->rt_peer_genid = rt_peer_genid();
+	if (peer) {
+		if (!rt_set_peer(rt, peer))
+			inet_putpeer(peer);
+		else
+			rt->rt_peer_genid = rt_peer_genid();
+	}
 }
 
 /*
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d9ba480..58a3ec2 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -313,10 +313,12 @@ void rt6_bind_peer(struct rt6_info *rt, int create)
 		return;
 
 	peer = inet_getpeer_v6(base, &rt->rt6i_dst.addr, create);
-	if (!rt6_set_peer(rt, peer))
-		inet_putpeer(peer);
-	else
-		rt->rt6i_peer_genid = rt6_peer_genid();
+	if (peer) {
+		if (!rt6_set_peer(rt, peer))
+			inet_putpeer(peer);
+		else
+			rt->rt6i_peer_genid = rt6_peer_genid();
+	}
 }
 
 static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
-- 
1.7.10

^ permalink raw reply related

* Re: [PATCH 2/5] ipv4: Kill ip_rt_frag_needed().
From: David Miller @ 2012-06-11 11:20 UTC (permalink / raw)
  To: steffen.klassert; +Cc: netdev
In-Reply-To: <20120611111659.GK27795@secunet.com>

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Mon, 11 Jun 2012 13:16:59 +0200

> It seems that we don't cache the learned pmtu informations
> in some cases with ip_rt_frag_needed() removed. 

We need to find a way to implement this then, in such a way
that we have the route context used to send the ping packet
out.

Otherwise, it's impossible to record the information properly.

^ permalink raw reply

* Re: [PATCH 2/5] ipv4: Kill ip_rt_frag_needed().
From: David Miller @ 2012-06-11 11:28 UTC (permalink / raw)
  To: steffen.klassert; +Cc: netdev
In-Reply-To: <20120611.042024.1022194952800114410.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Mon, 11 Jun 2012 04:20:24 -0700 (PDT)

> We need to find a way to implement this then, in such a way
> that we have the route context used to send the ping packet
> out.

The problem is RAW sockets right?  If so, then this is where the
fix belongs.

There is nothing preventing the RAW socket code from remembering the
last route used, as well as the flow4 key used to look it up, and
processing the PMTU message appropriately in raw_err() using that
remembered information if the flow4 key matches.

^ permalink raw reply

* Re: [PATCH 2/5] ipv4: Kill ip_rt_frag_needed().
From: Steffen Klassert @ 2012-06-11 11:42 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <20120611.042813.401909584318598192.davem@davemloft.net>

On Mon, Jun 11, 2012 at 04:28:13AM -0700, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Mon, 11 Jun 2012 04:20:24 -0700 (PDT)
> 
> > We need to find a way to implement this then, in such a way
> > that we have the route context used to send the ping packet
> > out.
> 
> The problem is RAW sockets right?  If so, then this is where the
> fix belongs.
> 

Hm, I've just tried with tracepath (udp) and I also don't see the
pmtu informations cached.

I still had no time to look deeper into the new inetpeer code,
I've just gave it a quick try. I'll try to find out what's going on.

^ permalink raw reply

* Server Rental & datacenter rack rental service in Hong Kong
From: borislamsv2 @ 2012-06-11 11:51 UTC (permalink / raw)


Dear All,

We have our own datacenter in Hong Kong & provide email/application/web rental service to clients.We are APNIC member & provide clean IP to clients.

Dell? PowerEdge? EnterpriseRack Mount Server
-Intel(R) Xeon(R) E3-1240 Processor (3.3GHz, 8M Cache, Turbo, 4C/8T, 80W)
-8GB RAM, 2x4GB, 1333MHz, DDR-3, Dual Ranked UDIMMs
-500GB, 3.5", 6Gbps SAS x 2
-Raid 1 Mirroring Protection
-Remote KVM (iDRAC6 Enterprise)

Every Dedicated Server Hosting Solution Also Includes:

Software Specification
- CentOS / Fedora / Debian / FreeBSD / Ubuntu / Redhat Linux
- Full root-level access
- Data Center Facilities
- Shared Local & International Bandwidth
- 2 IP Addresses Allocation
- Un-interruptible Power Supply (UPS) backed up by private diesel generator
- FM200¡§based fire suppression system
- 24x7 CRAC Air Conditioning and Humidity Control
- 24x7 Security Control
- 24x7 Remote Hand Service

Pls send us email for further information.Thanks,

Boris
boris@dedicatedserver.com.hk

(852)94088762

If you do not wish to further receive this event message, email "borislamsv2@gmail.com" to unsubscribe this message or remove your email from the list.

^ permalink raw reply

* [PATCH 0/4] Introduce generic set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:27 UTC (permalink / raw)
  To: bhutchings, grundler, arnd, avi, mtosatti
  Cc: linux-net-drivers, netdev, linux-kernel, linux-arch, kvm,
	takuya.yoshikawa

KVM is using test_and_set_bit_le() for this missing function; this patch
series corrects this usage.

As some drivers have their own definitions of set_bit_le(), which seem
to be incompatible with the generic one, renaming is also needed.

Note: the whole series is against linux-next.

Takuya Yoshikawa (4):
  drivers/net/ethernet/sfc: Add efx_ prefix to set_bit_le()
  drivers/net/ethernet/dec/tulip: Add tulip_ prefix to set_bit_le()
  bitops: Introduce generic set_bit_le()
  KVM: Replace test_and_set_bit_le() in mark_page_dirty_in_slot() with set_bit_le()

 drivers/net/ethernet/dec/tulip/de2104x.c    |    7 +++----
 drivers/net/ethernet/dec/tulip/tulip_core.c |    7 +++----
 drivers/net/ethernet/sfc/efx.c              |    4 ++--
 drivers/net/ethernet/sfc/net_driver.h       |    4 ++--
 drivers/net/ethernet/sfc/nic.c              |    4 ++--
 include/asm-generic/bitops/le.h             |    5 +++++
 virt/kvm/kvm_main.c                         |    3 +--
 7 files changed, 18 insertions(+), 16 deletions(-)

-- 
1.7.5.4

^ permalink raw reply

* [PATCH 1/4] drivers/net/ethernet/sfc: Add efx_ prefix to set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:29 UTC (permalink / raw)
  To: bhutchings
  Cc: grundler, arnd, avi, mtosatti, linux-net-drivers, netdev,
	linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212735.f92ea521.yoshikawa.takuya@oss.ntt.co.jp>

From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>

Needed to introduce generic set_bit_le().

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: Ben Hutchings <bhutchings@solarflare.com>
---
 drivers/net/ethernet/sfc/efx.c        |    4 ++--
 drivers/net/ethernet/sfc/net_driver.h |    4 ++--
 drivers/net/ethernet/sfc/nic.c        |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index b95f2e1..de11449 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1976,14 +1976,14 @@ static void efx_set_rx_mode(struct net_device *net_dev)
 		netdev_for_each_mc_addr(ha, net_dev) {
 			crc = ether_crc_le(ETH_ALEN, ha->addr);
 			bit = crc & (EFX_MCAST_HASH_ENTRIES - 1);
-			set_bit_le(bit, mc_hash->byte);
+			efx_set_bit_le(bit, mc_hash->byte);
 		}
 
 		/* Broadcast packets go through the multicast hash filter.
 		 * ether_crc_le() of the broadcast address is 0xbe2612ff
 		 * so we always add bit 0xff to the mask.
 		 */
-		set_bit_le(0xff, mc_hash->byte);
+		efx_set_bit_le(0xff, mc_hash->byte);
 	}
 
 	if (efx->port_enabled)
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 0e57535..5e084bf 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -1081,13 +1081,13 @@ static inline struct efx_rx_buffer *efx_rx_buffer(struct efx_rx_queue *rx_queue,
 }
 
 /* Set bit in a little-endian bitfield */
-static inline void set_bit_le(unsigned nr, unsigned char *addr)
+static inline void efx_set_bit_le(unsigned nr, unsigned char *addr)
 {
 	addr[nr / 8] |= (1 << (nr % 8));
 }
 
 /* Clear bit in a little-endian bitfield */
-static inline void clear_bit_le(unsigned nr, unsigned char *addr)
+static inline void efx_clear_bit_le(unsigned nr, unsigned char *addr)
 {
 	addr[nr / 8] &= ~(1 << (nr % 8));
 }
diff --git a/drivers/net/ethernet/sfc/nic.c b/drivers/net/ethernet/sfc/nic.c
index 4a9a5be..3abde7b 100644
--- a/drivers/net/ethernet/sfc/nic.c
+++ b/drivers/net/ethernet/sfc/nic.c
@@ -473,9 +473,9 @@ void efx_nic_init_tx(struct efx_tx_queue *tx_queue)
 
 		efx_reado(efx, &reg, FR_AA_TX_CHKSM_CFG);
 		if (tx_queue->queue & EFX_TXQ_TYPE_OFFLOAD)
-			clear_bit_le(tx_queue->queue, (void *)&reg);
+			efx_clear_bit_le(tx_queue->queue, (void *)&reg);
 		else
-			set_bit_le(tx_queue->queue, (void *)&reg);
+			efx_set_bit_le(tx_queue->queue, (void *)&reg);
 		efx_writeo(efx, &reg, FR_AA_TX_CHKSM_CFG);
 	}
 
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH 2/4] drivers/net/ethernet/dec/tulip: Add tulip_ prefix to set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:30 UTC (permalink / raw)
  To: grundler
  Cc: bhutchings, arnd, avi, mtosatti, linux-net-drivers, netdev,
	linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212735.f92ea521.yoshikawa.takuya@oss.ntt.co.jp>

From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>

Needed to introduce generic set_bit_le().

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: Grant Grundler <grundler@parisc-linux.org>
---
 drivers/net/ethernet/dec/tulip/de2104x.c    |    7 +++----
 drivers/net/ethernet/dec/tulip/tulip_core.c |    7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
index 61cc093..e635f1a 100644
--- a/drivers/net/ethernet/dec/tulip/de2104x.c
+++ b/drivers/net/ethernet/dec/tulip/de2104x.c
@@ -661,8 +661,7 @@ static netdev_tx_t de_start_xmit (struct sk_buff *skb,
    new frame, not around filling de->setup_frame.  This is non-deterministic
    when re-entered but still correct. */
 
-#undef set_bit_le
-#define set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
+#define tulip_set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
 
 static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
 {
@@ -673,12 +672,12 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
 	u16 *eaddrs;
 
 	memset(hash_table, 0, sizeof(hash_table));
-	set_bit_le(255, hash_table); 			/* Broadcast entry */
+	tulip_set_bit_le(255, hash_table);		/* Broadcast entry */
 	/* This should work on big-endian machines as well. */
 	netdev_for_each_mc_addr(ha, dev) {
 		int index = ether_crc_le(ETH_ALEN, ha->addr) & 0x1ff;
 
-		set_bit_le(index, hash_table);
+		tulip_set_bit_le(index, hash_table);
 	}
 
 	for (i = 0; i < 32; i++) {
diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c
index c4f37ac..3a1ebd02 100644
--- a/drivers/net/ethernet/dec/tulip/tulip_core.c
+++ b/drivers/net/ethernet/dec/tulip/tulip_core.c
@@ -1010,8 +1010,7 @@ static int private_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
    new frame, not around filling tp->setup_frame.  This is non-deterministic
    when re-entered but still correct. */
 
-#undef set_bit_le
-#define set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
+#define tulip_set_bit_le(i,p) do { ((char *)(p))[(i)/8] |= (1<<((i)%8)); } while(0)
 
 static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
 {
@@ -1022,12 +1021,12 @@ static void build_setup_frame_hash(u16 *setup_frm, struct net_device *dev)
 	u16 *eaddrs;
 
 	memset(hash_table, 0, sizeof(hash_table));
-	set_bit_le(255, hash_table); 			/* Broadcast entry */
+	tulip_set_bit_le(255, hash_table);		/* Broadcast entry */
 	/* This should work on big-endian machines as well. */
 	netdev_for_each_mc_addr(ha, dev) {
 		int index = ether_crc_le(ETH_ALEN, ha->addr) & 0x1ff;
 
-		set_bit_le(index, hash_table);
+		tulip_set_bit_le(index, hash_table);
 	}
 	for (i = 0; i < 32; i++) {
 		*setup_frm++ = hash_table[i];
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH 3/4] bitops: Introduce generic set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:31 UTC (permalink / raw)
  To: arnd
  Cc: bhutchings, grundler, avi, mtosatti, linux-net-drivers, netdev,
	linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212735.f92ea521.yoshikawa.takuya@oss.ntt.co.jp>

From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>

Needed to replace test_and_set_bit_le() in virt/kvm/kvm_main.c which is
being used for this missing function.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 include/asm-generic/bitops/le.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index f95c663..3e72143 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -54,6 +54,11 @@ static inline int test_bit_le(int nr, const void *addr)
 	return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
 }
 
+static inline void set_bit_le(int nr, void *addr)
+{
+	set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
+}
+
 static inline void __set_bit_le(int nr, void *addr)
 {
 	__set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
-- 
1.7.5.4

^ permalink raw reply related

* [PATCH 4/4] KVM: Replace test_and_set_bit_le() in mark_page_dirty_in_slot() with set_bit_le()
From: Takuya Yoshikawa @ 2012-06-11 12:32 UTC (permalink / raw)
  To: avi, mtosatti
  Cc: bhutchings, grundler, arnd, linux-net-drivers, netdev,
	linux-kernel, linux-arch, kvm, takuya.yoshikawa
In-Reply-To: <20120611212735.f92ea521.yoshikawa.takuya@oss.ntt.co.jp>

From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>

Now that we have defined generic set_bit_le() we do not need to use
test_and_set_bit_le() for atomically setting a bit.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
---
 virt/kvm/kvm_main.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 02cb440..560c502 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1485,8 +1485,7 @@ void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot,
 	if (memslot && memslot->dirty_bitmap) {
 		unsigned long rel_gfn = gfn - memslot->base_gfn;
 
-		/* TODO: introduce set_bit_le() and use it */
-		test_and_set_bit_le(rel_gfn, memslot->dirty_bitmap);
+		set_bit_le(rel_gfn, memslot->dirty_bitmap);
 	}
 }
 
-- 
1.7.5.4

^ permalink raw reply related

* kernel ipsec error
From: Marco Berizzi @ 2012-06-11 12:45 UTC (permalink / raw)
  To: netdev


Hello everybody.

After 12 days uptime I got this message.
Linux is 3.3.5 32bit, running openswan
(this is an ipsec gateway/netfilter
firewall) and squid.

Jun 11 12:53:02 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
Jun 11 12:53:02 Pleiadi kernel:   cache: kmalloc-2048, object size: 2048, buffer size: 2048, default order: 2, min order: 0
Jun 11 12:53:02 Pleiadi kernel:   node 0: slabs: 61, objs: 476, free: 0
Jun 11 12:53:02 Pleiadi kernel: kworker/0:2: page allocation failure: order:0, mode:0x4020
Jun 11 12:53:02 Pleiadi kernel: Pid: 18004, comm: kworker/0:2 Not tainted 3.3.5 #1
Jun 11 12:53:02 Pleiadi kernel: Call Trace:
Jun 11 12:53:02 Pleiadi kernel:  [<c104eada>] ? warn_alloc_failed+0xb7/0xc8
Jun 11 12:53:02 Pleiadi kernel:  [<c104efbb>] ? __alloc_pages_nodemask+0x4d0/0x4dd
Jun 11 12:53:02 Pleiadi kernel:  [<c1067754>] ? allocate_slab+0x57/0xbf
Jun 11 12:53:02 Pleiadi kernel:  [<c10677f4>] ? new_slab+0x1f/0x11a
Jun 11 12:53:02 Pleiadi kernel:  [<c10682dc>] ? __slab_alloc+0x13e/0x20e
Jun 11 12:53:02 Pleiadi kernel:  [<c104ccc3>] ? mempool_free+0x47/0x4a
Jun 11 12:53:02 Pleiadi kernel:  [<c106967f>] ? __kmalloc_track_caller+0x66/0xc2
Jun 11 12:53:02 Pleiadi kernel:  [<c1184261>] ? __netdev_alloc_skb+0x14/0x2d
Jun 11 12:53:02 Pleiadi kernel:  [<c1184261>] ? __netdev_alloc_skb+0x14/0x2d
Jun 11 12:53:02 Pleiadi kernel:  [<c1184109>] ? __alloc_skb+0x4f/0xfc
Jun 11 12:53:02 Pleiadi kernel:  [<c1184118>] ? __alloc_skb+0x5e/0xfc
Jun 11 12:53:02 Pleiadi kernel:  [<c1184261>] ? __netdev_alloc_skb+0x14/0x2d
Jun 11 12:53:02 Pleiadi kernel:  [<cac211ab>] ? boomerang_rx+0x305/0x41c [3c59x]
Jun 11 12:53:02 Pleiadi kernel:  [<cac209dc>] ? boomerang_interrupt+0x96/0x2c3 [3c59x]
Jun 11 12:53:02 Pleiadi kernel:  [<c104082d>] ? handle_irq_event_percpu+0x26/0xe5
Jun 11 12:53:02 Pleiadi kernel:  [<c1041f50>] ? cond_unmask_irq+0x1f/0x1f
Jun 11 12:53:02 Pleiadi kernel:  [<c1040905>] ? handle_irq_event+0x19/0x24
Jun 11 12:53:02 Pleiadi kernel:  [<c1041fad>] ? handle_level_irq+0x5d/0x67
Jun 11 12:53:02 Pleiadi kernel:  <IRQ>  [<c10033da>] ? do_IRQ+0x2b/0x7b
Jun 11 12:53:02 Pleiadi kernel:  [<c11fc989>] ? common_interrupt+0x29/0x30
Jun 11 12:53:02 Pleiadi kernel:  [<c11e007b>] ? bictcp_cong_avoid+0x21c/0x337
Jun 11 12:53:02 Pleiadi kernel:  [<c11e20a1>] ? xfrm_policy_lookup_bytype+0x12a/0x144
Jun 11 12:53:02 Pleiadi kernel:  [<c11e20d1>] ? __xfrm_policy_lookup+0x16/0x1a
Jun 11 12:53:02 Pleiadi kernel:  [<c11e2e8b>] ? xfrm_bundle_lookup+0xe2/0x2e6
Jun 11 12:53:02 Pleiadi kernel:  [<c11e2110>] ? xfrm_policy_lookup+0x3b/0x56
Jun 11 12:53:02 Pleiadi kernel:  [<c1199b15>] ? flow_cache_lookup+0x102/0x203
Jun 11 12:53:02 Pleiadi kernel:  [<c1199bd3>] ? flow_cache_lookup+0x1c0/0x203
Jun 11 12:53:02 Pleiadi kernel:  [<c11e3219>] ? xfrm_lookup+0x151/0x356
Jun 11 12:53:02 Pleiadi kernel:  [<c11e2da9>] ? xfrm_resolve_and_create_bundle+0x87/0x87
Jun 11 12:53:02 Pleiadi kernel:  [<c11de161>] ? alloc_null_binding+0x22/0x27
Jun 11 12:53:02 Pleiadi kernel:  [<c11de187>] ? nf_nat_rule_find+0x21/0x63
Jun 11 12:53:02 Pleiadi kernel:  [<c11de1c0>] ? nf_nat_rule_find+0x5a/0x63
Jun 11 12:53:02 Pleiadi kernel:  [<c11e39a4>] ? __xfrm_route_forward+0x60/0x7b
Jun 11 12:53:02 Pleiadi kernel:  [<c11a9882>] ? ipv4_validate_peer+0x9/0x5c
Jun 11 12:53:02 Pleiadi kernel:  [<c11ad72c>] ? ip_forward+0xe9/0x2c9
Jun 11 12:53:02 Pleiadi kernel:  [<c11ac67a>] ? ip_rcv_finish+0x272/0x285
Jun 11 12:53:02 Pleiadi kernel:  [<c11ac8a8>] ? ip_rcv+0x21b/0x23f
Jun 11 12:53:02 Pleiadi kernel:  [<c118cd74>] ? __netif_receive_skb+0x22e/0x254
Jun 11 12:53:02 Pleiadi kernel:  [<c118d57f>] ? process_backlog+0x48/0xfe
Jun 11 12:53:02 Pleiadi kernel:  [<c118d7bf>] ? net_rx_action+0x5f/0xfb
Jun 11 12:53:02 Pleiadi kernel:  [<c101f339>] ? __do_softirq+0x59/0xc2
Jun 11 12:53:02 Pleiadi kernel:  [<c101f2e0>] ? local_bh_enable_ip+0x77/0x77
Jun 11 12:53:02 Pleiadi kernel:  <IRQ>  [<c101f25d>] ? local_bh_enable+0x6b/0x77
Jun 11 12:53:02 Pleiadi kernel:  [<c11934e3>] ? neigh_periodic_work+0xbc/0xfa
Jun 11 12:53:02 Pleiadi kernel:  [<c102919c>] ? process_one_work+0x13b/0x22f
Jun 11 12:53:02 Pleiadi kernel:  [<c1193427>] ? neigh_connect+0x10/0x10
Jun 11 12:53:02 Pleiadi kernel:  [<c1029377>] ? worker_thread+0xcc/0x183
Jun 11 12:53:02 Pleiadi kernel:  [<c10292ab>] ? process_scheduled_works+0x1b/0x1b
Jun 11 12:53:02 Pleiadi kernel:  [<c102c2f7>] ? kthread+0x6a/0x6f
Jun 11 12:53:02 Pleiadi kernel:  [<c102c28d>] ? kthread_data+0xd/0xd
Jun 11 12:53:02 Pleiadi kernel:  [<c11fc996>] ? kernel_thread_helper+0x6/0xd
Jun 11 12:53:02 Pleiadi kernel: Mem-Info:
Jun 11 12:53:02 Pleiadi kernel: DMA per-cpu:
Jun 11 12:53:02 Pleiadi kernel: CPU    0: hi:    0, btch:   1 usd:   0
Jun 11 12:53:02 Pleiadi kernel: Normal per-cpu:
Jun 11 12:53:02 Pleiadi kernel: CPU    0: hi:   42, btch:   7 usd:  43
Jun 11 12:53:02 Pleiadi kernel: active_anon:9112 inactive_anon:11797 isolated_anon:2
Jun 11 12:53:02 Pleiadi kernel:  active_file:4294 inactive_file:5228 isolated_file:14
Jun 11 12:53:02 Pleiadi kernel:  unevictable:0 dirty:152 writeback:15 unstable:0
Jun 11 12:53:02 Pleiadi kernel:  free:290 slab_reclaimable:1335 slab_unreclaimable:3626
Jun 11 12:53:02 Pleiadi kernel:  mapped:694 shmem:0 pagetables:323 bounce:0
Jun 11 12:53:02 Pleiadi kernel: DMA free:628kB min:156kB low:192kB high:232kB active_anon:804kB inactive_anon:7148kB active_file:1724kB inactive_file:2692kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15804kB mlocked:0kB dirty:4kB writeback:0kB mapped:212kB shmem:0kB slab_reclaimable:792kB slab_unreclaimable:1060kB kernel_stack:168kB pagetables:36kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Jun 11 12:53:02 Pleiadi kernel: lowmem_reserve[]: 0 142 142
Jun 11 12:53:02 Pleiadi kernel: Normal free:532kB min:1448kB low:1808kB high:2172kB active_anon:35644kB inactive_anon:40040kB active_file:15452kB inactive_file:18220kB unevictable:0kB isolated(anon):8kB isolated(file):56kB present:146304kB mlocked:0kB dirty:604kB writeback:60kB mapped:2564kB shmem:0kB slab_reclaimable:4548kB slab_unreclaimable:13444kB kernel_stack:688kB pagetables:1256kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
Jun 11 12:53:02 Pleiadi kernel: lowmem_reserve[]: 0 0 0
Jun 11 12:53:02 Pleiadi kernel: DMA: 1*4kB 0*8kB 1*16kB 3*32kB 2*64kB 1*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 628kB
Jun 11 12:53:02 Pleiadi kernel: Normal: 77*4kB 28*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 532kB
Jun 11 12:53:02 Pleiadi kernel: 12854 total pagecache pages
Jun 11 12:53:02 Pleiadi kernel: 3325 pages in swap cache
Jun 11 12:53:02 Pleiadi kernel: Swap cache stats: add 418409, delete 415084, find 240218/313268
Jun 11 12:53:02 Pleiadi kernel: Free swap  = 130908kB
Jun 11 12:53:02 Pleiadi kernel: Total swap = 151164kB
Jun 11 12:53:02 Pleiadi kernel: 40944 pages RAM
Jun 11 12:53:02 Pleiadi kernel: 1225 pages reserved
Jun 11 12:53:02 Pleiadi kernel: 12195 pages shared
Jun 11 12:53:02 Pleiadi kernel: 31896 pages non-shared
Jun 11 12:53:02 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
Jun 11 12:53:02 Pleiadi kernel:   cache: kmalloc-2048, object size: 2048, buffer size: 2048, default order: 2, min order: 0
Jun 11 12:53:02 Pleiadi kernel:   node 0: slabs: 61, objs: 476, free: 0
Jun 11 12:53:02 Pleiadi kernel: Switching to clocksource pit

I also got this error (unplug power cord necessary):

May 30 09:57:51 Pleiadi kernel:  [<c11fc996>] ? kernel_thread_helper+0x6/0xd
May 30 09:57:51 Pleiadi kernel: Mem-Info:
May 30 09:57:51 Pleiadi kernel: DMA per-cpu:
May 30 09:57:51 Pleiadi kernel: CPU    0: hi:    0, btch:   1 usd:   0
May 30 09:57:51 Pleiadi kernel: Normal per-cpu:
May 30 09:57:51 Pleiadi kernel: CPU    0: hi:   42, btch:   7 usd:  41
May 30 09:57:51 Pleiadi kernel: active_anon:10335 inactive_anon:11540 isolated_anon:0
May 30 09:57:51 Pleiadi kernel:  active_file:3924 inactive_file:4094 isolated_file:0
May 30 09:57:51 Pleiadi kernel:  unevictable:0 dirty:153 writeback:0 unstable:0
May 30 09:57:51 Pleiadi kernel:  free:290 slab_reclaimable:1445 slab_unreclaimable:3882
May 30 09:57:51 Pleiadi kernel:  mapped:957 shmem:1 pagetables:321 bounce:0
May 30 09:57:51 Pleiadi kernel: DMA free:628kB min:156kB low:192kB high:232kB active_anon:2160kB inactive_anon:6808kB active_file:1792kB inactive_file:2324kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15804kB mlocked:0kB dirty:28kB writeback:0kB mapped:212kB shmem:0kB slab_reclaimable:444kB slab_unreclaimable:832kB kernel_stack:0kB pagetables:16kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
May 30 09:57:51 Pleiadi kernel: lowmem_reserve[]: 0 142 142
May 30 09:57:51 Pleiadi kernel: Normal free:532kB min:1448kB low:1808kB high:2172kB active_anon:39180kB inactive_anon:39352kB active_file:13904kB inactive_file:14052kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:146304kB mlocked:0kB dirty:584kB writeback:0kB mapped:3616kB shmem:4kB slab_reclaimable:5336kB slab_unreclaimable:14696kB kernel_stack:864kB pagetables:1268kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
May 30 09:57:51 Pleiadi kernel: lowmem_reserve[]: 0 0 0
May 30 09:57:51 Pleiadi kernel: DMA: 1*4kB 0*8kB 1*16kB 1*32kB 5*64kB 0*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 628kB
May 30 09:57:51 Pleiadi kernel: Normal: 1*4kB 0*8kB 1*16kB 0*32kB 2*64kB 1*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 532kB
May 30 09:57:51 Pleiadi kernel: 10792 total pagecache pages
May 30 09:57:51 Pleiadi kernel: 2773 pages in swap cache
May 30 09:57:51 Pleiadi kernel: Swap cache stats: add 284144, delete 281371, find 209552/259249
May 30 09:57:51 Pleiadi kernel: Free swap  = 132416kB
May 30 09:57:51 Pleiadi kernel: Total swap = 151164kB
May 30 09:57:51 Pleiadi kernel: 40944 pages RAM
May 30 09:57:51 Pleiadi kernel: 1225 pages reserved
May 30 09:57:51 Pleiadi kernel: 11892 pages shared
May 30 09:57:51 Pleiadi kernel: 33496 pages non-shared
May 30 09:57:51 Pleiadi kernel: kworker/0:1: page allocation failure: order:0, mode:0x20
May 30 09:57:51 Pleiadi kernel: Pid: 16451, comm: kworker/0:1 Not tainted 3.3.5 #1
May 30 09:57:51 Pleiadi kernel: Call Trace:
May 30 09:57:51 Pleiadi kernel:  [<c104eada>] ? warn_alloc_failed+0xb7/0xc8
May 30 09:57:51 Pleiadi kernel:  [<c104efbb>] ? __alloc_pages_nodemask+0x4d0/0x4dd
May 30 09:57:51 Pleiadi kernel:  [<c10f88ff>] ? sha1_final+0x62/0x8c
May 30 09:57:51 Pleiadi kernel:  [<c104efd4>] ? __get_free_pages+0xc/0x28
May 30 09:57:51 Pleiadi kernel:  [<c10f58ef>] ? blkcipher_walk_next+0x69/0x298
May 30 09:57:51 Pleiadi kernel:  [<c10f5c99>] ? blkcipher_walk_first+0x159/0x17c
May 30 09:57:51 Pleiadi kernel:  [<c10fc4c8>] ? crypto_cbc_decrypt+0x26/0x61
May 30 09:57:51 Pleiadi kernel:  [<c10f7732>] ? shash_ahash_finup+0x4c/0x58
May 30 09:57:51 Pleiadi kernel:  [<c10f5e29>] ? async_decrypt+0x40/0x46
May 30 09:57:51 Pleiadi kernel:  [<c11013eb>] ? crypto_authenc_decrypt+0x6f/0x75
May 30 09:57:51 Pleiadi kernel:  [<c11d99c8>] ? esp_input+0x280/0x29e
May 30 09:57:51 Pleiadi kernel:  [<c11e7150>] ? xfrm_input+0x1b1/0x33e
May 30 09:57:51 Pleiadi kernel:  [<c11e0a82>] ? xfrm4_rcv_encap+0x17/0x19
May 30 09:57:51 Pleiadi kernel:  [<c11e0c9c>] ? xfrm4_rcv+0x13/0x17
May 30 09:57:51 Pleiadi kernel:  [<c11ac313>] ? ip_local_deliver_finish+0x116/0x1a4
May 30 09:57:51 Pleiadi kernel:  [<c11ac402>] ? ip_local_deliver+0x61/0x67
May 30 09:57:51 Pleiadi kernel:  [<c11ac67a>] ? ip_rcv_finish+0x272/0x285
May 30 09:57:51 Pleiadi kernel:  [<c11ac8a8>] ? ip_rcv+0x21b/0x23f
May 30 09:57:51 Pleiadi kernel:  [<c118cd74>] ? __netif_receive_skb+0x22e/0x254
May 30 09:57:51 Pleiadi kernel:  [<c118d57f>] ? process_backlog+0x48/0xfe
May 30 09:57:51 Pleiadi kernel:  [<c118d7bf>] ? net_rx_action+0x5f/0xfb
May 30 09:57:51 Pleiadi kernel:  [<c101f339>] ? __do_softirq+0x59/0xc2
May 30 09:57:51 Pleiadi kernel:  [<c101f2e0>] ? local_bh_enable_ip+0x77/0x77
May 30 09:57:51 Pleiadi kernel:  <IRQ>  [<c101f25d>] ? local_bh_enable+0x6b/0x77
May 30 09:57:51 Pleiadi kernel:  [<c1192663>] ? dst_destroy+0x42/0x97
May 30 09:57:51 Pleiadi kernel:  [<c11e27d6>] ? xfrm_bundle_flo_delete+0x1e/0x2c
May 30 09:57:51 Pleiadi kernel:  [<c119975c>] ? flow_entry_kill+0xf/0x1c
May 30 09:57:51 Pleiadi kernel:  [<c11997c5>] ? flow_cache_gc_task+0x5c/0x65
May 30 09:57:51 Pleiadi kernel:  [<c102919c>] ? process_one_work+0x13b/0x22f
May 30 09:57:51 Pleiadi kernel:  [<c1199769>] ? flow_entry_kill+0x1c/0x1c
May 30 09:57:51 Pleiadi kernel:  [<c1029377>] ? worker_thread+0xcc/0x183
May 30 09:57:51 Pleiadi kernel:  [<c10292ab>] ? process_scheduled_works+0x1b/0x1b
May 30 09:57:51 Pleiadi kernel:  [<c102c2f7>] ? kthread+0x6a/0x6f
May 30 09:57:51 Pleiadi kernel:  [<c102c28d>] ? kthread_data+0xd/0xd
May 30 09:57:51 Pleiadi kernel:  [<c11fc996>] ? kernel_thread_helper+0x6/0xd
May 30 09:57:51 Pleiadi kernel: Mem-Info:
May 30 09:57:51 Pleiadi kernel: DMA per-cpu:
May 30 09:57:51 Pleiadi kernel: CPU    0: hi:    0, btch:   1 usd:   0
May 30 09:57:51 Pleiadi kernel: Normal per-cpu:
May 30 09:57:51 Pleiadi kernel: CPU    0: hi:   42, btch:   7 usd:  41
May 30 09:57:51 Pleiadi kernel: active_anon:10335 inactive_anon:11540 isolated_anon:0
May 30 09:57:51 Pleiadi kernel:  active_file:3924 inactive_file:4094 isolated_file:0
May 30 09:57:51 Pleiadi kernel:  unevictable:0 dirty:153 writeback:0 unstable:0
May 30 09:57:51 Pleiadi kernel:  free:290 slab_reclaimable:1445 slab_unreclaimable:3882
May 30 09:57:51 Pleiadi kernel:  mapped:957 shmem:1 pagetables:321 bounce:0
May 30 09:57:51 Pleiadi kernel: DMA free:628kB min:156kB low:192kB high:232kB active_anon:2160kB inactive_anon:6808kB active_file:1792kB inactive_file:2324kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15804kB mlocked:0kB dirty:28kB writeback:0kB mapped:212kB shmem:0kB slab_reclaimable:444kB slab_unreclaimable:832kB kernel_stack:0kB pagetables:16kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
May 30 09:57:51 Pleiadi kernel: lowmem_reserve[]: 0 142 142
May 30 09:57:51 Pleiadi kernel: Normal free:532kB min:1448kB low:1808kB high:2172kB active_anon:39180kB inactive_anon:39352kB active_file:13904kB inactive_file:14052kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:146304kB mlocked:0kB dirty:584kB writeback:0kB mapped:3616kB shmem:4kB slab_reclaimable:5336kB slab_unreclaimable:14696kB kernel_stack:864kB pagetables:1268kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
May 30 09:57:51 Pleiadi kernel: lowmem_reserve[]: 0 0 0
May 30 09:57:51 Pleiadi kernel: DMA: 1*4kB 0*8kB 1*16kB 1*32kB 5*64kB 0*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 628kB
May 30 09:57:51 Pleiadi kernel: Normal: 1*4kB 0*8kB 1*16kB 0*32kB 2*64kB 1*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 532kB
May 30 09:57:51 Pleiadi kernel: 10792 total pagecache pages
May 30 09:57:51 Pleiadi kernel: 2773 pages in swap cache
May 30 09:57:51 Pleiadi kernel: Swap cache stats: add 284144, delete 281371, find 209552/259249
May 30 09:57:51 Pleiadi kernel: Free swap  = 132416kB
May 30 09:57:51 Pleiadi kernel: Total swap = 151164kB
May 30 09:57:51 Pleiadi kernel: 40944 pages RAM
May 30 09:57:51 Pleiadi kernel: 1225 pages reserved
May 30 09:57:51 Pleiadi kernel: 11892 pages shared
May 30 09:57:51 Pleiadi kernel: 33496 pages non-shared
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel:   cache: vm_area_struct, object size: 84, buffer size: 88, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel:   node 0: slabs: 306, objs: 14076, free: 0
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel:   cache: vm_area_struct, object size: 84, buffer size: 88, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel:   node 0: slabs: 306, objs: 14076, free: 0
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel:   cache: kmalloc-256, object size: 256, buffer size: 256, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel:   node 0: slabs: 444, objs: 7104, free: 0
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel:   cache: vm_area_struct, object size: 84, buffer size: 88, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel:   node 0: slabs: 306, objs: 14076, free: 0
May 30 09:57:51 Pleiadi kernel: SLUB: Unable to allocate memory on node -1 (gfp=0x20)
May 30 09:57:51 Pleiadi kernel:   cache: vm_area_struct, object size: 84, buffer size: 88, default order: 0, min order: 0
May 30 09:57:51 Pleiadi kernel:   node 0: slabs: 306, objs: 14076, free: 0
May 30 10:02:22 Pleiadi kernel: klogd 1.4.1, log source = /proc/kmsg started.


 		 	   		  

^ permalink raw reply

* [PATCH] net: socket: fixed coding style issues.
From: Matthew Shaw @ 2012-06-11 13:17 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, Matthew Shaw

Fixed an instance where brances are used but not needed, and some lines
in the comments and code that exceed the 80 character limit.

Signed-off-by: Matthew Shaw <shaw500@gmail.com>
---
 net/socket.c |  137 ++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 75 insertions(+), 62 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 6e0ccc0..2133040 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -8,48 +8,48 @@
  *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  *
  * Fixes:
- *		Anonymous	:	NOTSOCK/BADF cleanup. Error fix in
- *					shutdown()
- *		Alan Cox	:	verify_area() fixes
- *		Alan Cox	:	Removed DDI
- *		Jonathan Kamens	:	SOCK_DGRAM reconnect bug
- *		Alan Cox	:	Moved a load of checks to the very
- *					top level.
- *		Alan Cox	:	Move address structures to/from user
- *					mode above the protocol layers.
- *		Rob Janssen	:	Allow 0 length sends.
- *		Alan Cox	:	Asynchronous I/O support (cribbed from the
- *					tty drivers).
- *		Niibe Yutaka	:	Asynchronous I/O for writes (4.4BSD style)
- *		Jeff Uphoff	:	Made max number of sockets command-line
- *					configurable.
- *		Matti Aarnio	:	Made the number of sockets dynamic,
- *					to be allocated when needed, and mr.
- *					Uphoff's max is used as max to be
- *					allowed to allocate.
- *		Linus		:	Argh. removed all the socket allocation
- *					altogether: it's in the inode now.
- *		Alan Cox	:	Made sock_alloc()/sock_release() public
- *					for NetROM and future kernel nfsd type
- *					stuff.
- *		Alan Cox	:	sendmsg/recvmsg basics.
- *		Tom Dyas	:	Export net symbols.
- *		Marcin Dalecki	:	Fixed problems with CONFIG_NET="n".
- *		Alan Cox	:	Added thread locking to sys_* calls
- *					for sockets. May have errors at the
- *					moment.
- *		Kevin Buhr	:	Fixed the dumb errors in the above.
- *		Andi Kleen	:	Some small cleanups, optimizations,
- *					and fixed a copy_from_user() bug.
- *		Tigran Aivazian	:	sys_send(args) calls sys_sendto(args, NULL, 0)
- *		Tigran Aivazian	:	Made listen(2) backlog sanity checks
- *					protocol-independent
+ *	Anonymous	:	NOTSOCK/BADF cleanup. Error fix in
+ *				shutdown()
+ *	Alan Cox	:	verify_area() fixes
+ *	Alan Cox	:	Removed DDI
+ *	Jonathan Kamens	:	SOCK_DGRAM reconnect bug
+ *	Alan Cox	:	Moved a load of checks to the very
+ *				top level.
+ *	Alan Cox	:	Move address structures to/from user
+ *				mode above the protocol layers.
+ *	Rob Janssen	:	Allow 0 length sends.
+ *	Alan Cox	:	Asynchronous I/O support (cribbed from the
+ *				tty drivers).
+ *	Niibe Yutaka	:	Asynchronous I/O for writes (4.4BSD style)
+ *	Jeff Uphoff	:	Made max number of sockets command-line
+ *				configurable.
+ *	Matti Aarnio	:	Made the number of sockets dynamic,
+ *				to be allocated when needed, and mr.
+ *				Uphoff's max is used as max to be
+ *				allowed to allocate.
+ *	Linus		:	Argh. removed all the socket allocation
+ *				altogether: it's in the inode now.
+ *	Alan Cox	:	Made sock_alloc()/sock_release() public
+ *				for NetROM and future kernel nfsd type
+ *				stuff.
+ *	Alan Cox	:	sendmsg/recvmsg basics.
+ *	Tom Dyas	:	Export net symbols.
+ *	Marcin Dalecki	:	Fixed problems with CONFIG_NET="n".
+ *	Alan Cox	:	Added thread locking to sys_* calls
+ *				for sockets. May have errors at the
+ *				moment.
+ *	Kevin Buhr	:	Fixed the dumb errors in the above.
+ *	Andi Kleen	:	Some small cleanups, optimizations,
+ *				and fixed a copy_from_user() bug.
+ *	Tigran Aivazian	:	sys_send(args) calls sys_sendto(args, NULL, 0)
+ *	Tigran Aivazian	:	Made listen(2) backlog sanity checks
+ *				protocol-independent
  *
  *
- *		This program is free software; you can redistribute it and/or
- *		modify it under the terms of the GNU General Public License
- *		as published by the Free Software Foundation; either version
- *		2 of the License, or (at your option) any later version.
+ *	This program is free software; you can redistribute it and/or
+ *	modify it under the terms of the GNU General Public License
+ *	as published by the Free Software Foundation; either version
+ *	2 of the License, or (at your option) any later version.
  *
  *
  *	This module is effectively the top level interface to the BSD socket
@@ -128,8 +128,9 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
 				unsigned int flags);
 
 /*
- *	Socket files have a set of 'special' operations as well as the generic file ones. These don't appear
- *	in the operation structures but are done directly via the socketcall() multiplexor.
+ *	Socket files have a set of 'special' operations as well as the generic
+ *      file ones. These don't appear in the operation structures but are done
+ *      directly via the socketcall() multiplexor.
  */
 
 static const struct file_operations socket_file_ops = {
@@ -181,7 +182,8 @@ static DEFINE_PER_CPU(int, sockets_in_use);
  *	invalid addresses -EFAULT is returned. On a success 0 is returned.
  */
 
-int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr)
+int move_addr_to_kernel(void __user *uaddr, int ulen,
+			struct sockaddr_storage *kaddr)
 {
 	if (ulen < 0 || ulen > sizeof(struct sockaddr_storage))
 		return -EINVAL;
@@ -584,7 +586,8 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 }
 EXPORT_SYMBOL(sock_sendmsg);
 
-static int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg, size_t size)
+static int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg,
+			      size_t size)
 {
 	struct kiocb iocb;
 	struct sock_iocb siocb;
@@ -711,7 +714,8 @@ void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
 EXPORT_SYMBOL_GPL(__sock_recv_ts_and_drops);
 
 static inline int __sock_recvmsg_nosec(struct kiocb *iocb, struct socket *sock,
-				       struct msghdr *msg, size_t size, int flags)
+				       struct msghdr *msg, size_t size,
+				       int flags)
 {
 	struct sock_iocb *si = kiocb_to_siocb(iocb);
 
@@ -1158,7 +1162,9 @@ static int sock_fasync(int fd, struct file *filp, int on)
 	return 0;
 }
 
-/* This function may be called only under socket lock or callback_lock or rcu_lock */
+/* This function may be called only under socket lock or callback_lock
+ * or rcu_lock.
+ */
 
 int sock_wake_async(struct socket *sock, int how, int band)
 {
@@ -1229,8 +1235,8 @@ int __sock_create(struct net *net, int family, int type, int protocol,
 
 	/*
 	 *	Allocate the socket and allow the family to set things up. if
-	 *	the protocol is 0, the family is instructed to select an appropriate
-	 *	default.
+	 *	the protocol is 0, the family is instructed to select an
+	 *	appropriate default.
 	 */
 	sock = sock_alloc();
 	if (!sock) {
@@ -1308,7 +1314,8 @@ EXPORT_SYMBOL(__sock_create);
 
 int sock_create(int family, int type, int protocol, struct socket **res)
 {
-	return __sock_create(current->nsproxy->net_ns, family, type, protocol, res, 0);
+	return __sock_create(current->nsproxy->net_ns, family, type, protocol,
+			     res, 0);
 }
 EXPORT_SYMBOL(sock_create);
 
@@ -1928,9 +1935,9 @@ static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg,
 	}
 
 	/* This will also move the address data into kernel space */
-	if (MSG_CMSG_COMPAT & flags) {
+	if (MSG_CMSG_COMPAT & flags)
 		err = verify_compat_iovec(msg_sys, iov, &address, VERIFY_READ);
-	} else
+	else
 		err = verify_iovec(msg_sys, iov, &address, VERIFY_READ);
 	if (err < 0)
 		goto out_freeiov;
@@ -1957,9 +1964,9 @@ static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg,
 		}
 		err = -EFAULT;
 		/*
-		 * Careful! Before this, msg_sys->msg_control contains a user pointer.
-		 * Afterwards, it will be a kernel pointer. Thus the compiler-assisted
-		 * checking falls down on this.
+		 * Careful! Before this, msg_sys->msg_control contains a user
+		 * pointer. Afterwards, it will be a kernel pointer. Thus the
+		 * compiler-assisted checking falls down on this.
 		 */
 		if (copy_from_user(ctl_buf,
 				   (void __user __force *)msg_sys->msg_control,
@@ -2010,7 +2017,8 @@ out:
  *	BSD sendmsg interface
  */
 
-SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int, flags)
+SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int,
+		flags)
 {
 	int fput_needed, err;
 	struct msghdr msg_sys;
@@ -2056,7 +2064,8 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
 
 	while (datagrams < vlen) {
 		if (MSG_CMSG_COMPAT & flags) {
-			err = __sys_sendmsg(sock, (struct msghdr __user *)compat_entry,
+			err = __sys_sendmsg(sock,
+					   (struct msghdr __user *)compat_entry,
 					    &msg_sys, flags, &used_address);
 			if (err < 0)
 				break;
@@ -2132,9 +2141,9 @@ static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg,
 
 	uaddr = (__force void __user *)msg_sys->msg_name;
 	uaddr_len = COMPAT_NAMELEN(msg);
-	if (MSG_CMSG_COMPAT & flags) {
+	if (MSG_CMSG_COMPAT & flags)
 		err = verify_compat_iovec(msg_sys, iov, &addr, VERIFY_WRITE);
-	} else
+	else
 		err = verify_iovec(msg_sys, iov, &addr, VERIFY_WRITE);
 	if (err < 0)
 		goto out_freeiov;
@@ -2661,13 +2670,15 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32)
 		ifc.ifc_req = NULL;
 		uifc = compat_alloc_user_space(sizeof(struct ifconf));
 	} else {
-		size_t len = ((ifc32.ifc_len / sizeof(struct compat_ifreq)) + 1) *
+		size_t len = ((ifc32.ifc_len /
+			sizeof(struct compat_ifreq)) + 1) *
 			sizeof(struct ifreq);
 		uifc = compat_alloc_user_space(sizeof(struct ifconf) + len);
 		ifc.ifc_len = len;
 		ifr = ifc.ifc_req = (void __user *)(uifc + 1);
 		ifr32 = compat_ptr(ifc32.ifcbuf);
-		for (i = 0; i < ifc32.ifc_len; i += sizeof(struct compat_ifreq)) {
+		for (i = 0; i < ifc32.ifc_len;
+		     i += sizeof(struct compat_ifreq)) {
 			if (copy_in_user(ifr, ifr32, sizeof(struct compat_ifreq)))
 				return -EFAULT;
 			ifr++;
@@ -2832,7 +2843,8 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
 	return 0;
 }
 
-static int compat_siocwandev(struct net *net, struct compat_ifreq __user *uifr32)
+static int compat_siocwandev(struct net *net,
+			     struct compat_ifreq __user *uifr32)
 {
 	void __user *uptr;
 	compat_uptr_t uptr32;
@@ -3000,7 +3012,8 @@ static int compat_sioc_ifmap(struct net *net, unsigned int cmd,
 	return err;
 }
 
-static int compat_siocshwtstamp(struct net *net, struct compat_ifreq __user *uifr32)
+static int compat_siocshwtstamp(struct net *net,
+				struct compat_ifreq __user *uifr32)
 {
 	void __user *uptr;
 	compat_uptr_t uptr32;
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH RFC] c_can_pci: generic module for c_can on PCI
From: Federico Vaga @ 2012-06-11 13:18 UTC (permalink / raw)
  To: Bhupesh SHARMA
  Cc: rubini@gnudd.com, anilkumar@ti.com, mkl@pengutronix.de,
	alan@lxorguk.ukuu.org.uk, wg@grandegger.com, Giancarlo ASNAGHI,
	alan@linux.intel.com, linux-can@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <D5ECB3C7A6F99444980976A8C6D896384FA5EC4E62@EAPEX1MAIL1.st.com>

How we proceed?
I submit my c_can_pci.c as a separated module, we create a
c_can_platform_common.c,
or we are thinking about a generic c_can.c as plaftorm driver?

-- 
Federico Vaga

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox