* Re: [RFC net-next 0/4] gianfar: Use separate NAPI for Tx confirmation processing
From: Paul Gortmaker @ 2012-08-16 15:36 UTC (permalink / raw)
To: Claudiu Manoil; +Cc: Tomas Hruby, Eric Dumazet, netdev, David S. Miller
In-Reply-To: <502A77EE.8040300@freescale.com>
[Re: [RFC net-next 0/4] gianfar: Use separate NAPI for Tx confirmation processing] On 14/08/2012 (Tue 19:08) Claudiu Manoil wrote:
> On 08/14/2012 04:15 AM, Paul Gortmaker wrote:
> >This is a lot lower variation than what you reported earlier (20
> >versus 200, I think). It was the variation that raised a red flag
> >for me...
> Hi Paul,
> The earlier variation, which is much bigger (indeed ~200), was
> observed on a p1020 (slow, 2 cores, MQ_MG_MODE).
> I did not collect however as detailed measurement results for that
> board, as I did for p1010 (previous email).
> The most important performance improvement I've noticed however was
> on the p1020 platform.
>
> >>By changing the coalescing settings from default* (rx coalescing off,
> >>tx-usecs: 10, tx-frames: 16) to:
> >>"ethtool -C eth1 rx-frames 22 tx-frames 22 rx-usecs 32 tx-usecs 32"
> >>we get a throughput of ~710 Mbps.
> >>
> >>For *Image 2)*, using the default tcp_limit_output_bytes value
> >>(131072) - I've noticed
> >>that "tweaking" tcp_limit_output_bytes does not improve the
> >>throughput -, we get the
> >>following performance numbers:
> >>* default coalescing settings: ~650 Mbps
> >>* rx-frames tx-frames 22 rx-usecs 32 tx-usecs 32: ~860-880 Mbps
> >>
> >>For *Image 3)*, by disabling BQL (CONFIG_BQL = n), there's *no*
> >>relevant performance
> >>improvement compared to Image 1).
> >>(note:
> >>For all the measurements, rx and tx BD ring sizes have been set to
> >>64, for best performance.)
> >>
> >>So, I really tend to believe that the performance degradation comes
> >>primarily from the driver,
> >>and the napi poll processing turns out to be an important source for
> >>that. The proposed patches
> >This would make sense, if the CPU was slammed at 100% load in dealing
> >with the tx processing, and the change made the driver considerably more
> >efficient. But is that really the case? Is the p1010 really going flat
> >out just to handle the Tx processing? Have you done any sort of
> >profiling to confirm/deny where the CPU is spending its time?
> The current gfar_poll implementation processes first the tx
> confirmation path exhaustively, without a budget/ work limit,
> and only then proceeds with the rx processing within the allotted
> budget. An this happens for both Rx and Tx confirmation
> interrupts. I find this unfair and out of balance. Maybe by letting
> rx processing to be triggered by rx interrupts only, and
> the tx conf path processing to be triggered by tx confirmation
> interrupts only, and, on top of that, by imposing a work limit
> on the tx confirmation path too, we get a more responsive driver
> that performs better. Indeed some profiling data to
> confirm this would be great, but I don't have it.
>
> There's another issues that seems to be solved by this patchset, and
> I've noticed it only on p1020rdb (this time).
> And that is excessive Rx busy interrupts occurrence. Solving this
> issue may be another factor for the performance
> improvement on p1020. But maybe this is another discussion.
>
> >
> >>show substantial improvement, especially for SMP systems where Tx
> >>and Rx processing may be
> >>done in parallel.
> >>What do you think?
> >>Is it ok to proceed by re-spinning the patches? Do you recommend
> >>additional measurements?
> >Unfortunately Eric is out this week, so we will be without his input for
> >a while. However, we are only at 3.6-rc1 -- meaning net-next will be
> >open for quite some time, hence no need to rush to try and jam stuff in.
> >
> >Also, I have two targets I'm interested in testing your patches on. The
> >1st is a 500MHz mpc8349 board -- which should replicate what you see on
> >your p1010 (slow, single core). The other is an 8641D, which is
> >interesting since it will give us the SMP tx/rx as separate threads, but
> >without the MQ_MG_MODE support (is that a correct assumption?)
> >
> >I don't have any fundamental problem with your patches (although 4/4
> >might be better as two patches) -- the above targets/tests are only
> >of interest, since I'm not convinced we yet understand _why_ your
> >changes give a performance boost, and there might be something
> >interesting hiding in there.
> >
> >So, while Eric is out, let me see if I can collect some more data on
> >those two targets sometime this week.
>
> Great, I don't mean to rush. The more data we get on this the better.
> It would be great if you could do some measurements on your platforms too.
> 8641D is indeed a dual core with etsec 1.x (so without the MQ_MG_MODE),
> but I did run some tests on a p2020, which has the same features. However
> I'm eager to see your results.
So, I've collected data on 8349 (520MHz single core) and 8641D (1GHz
dual core) and the results are kind of surprising (to me). The SMP
target, which in theory should have benefited from the change, actually
saw about an 8% reduction in throughput. And the slower single core saw
about a 5% increase.
I also retested the 8641D with just your 1st 3 patches (i.e. drop the
"Use separate NAPIs for Tx and Rx processing" patch) and it recovered
about 1/2 the lost throughput, but not all.
I've used your patches exactly as posted, and the same netperf cmdline.
I briefly experimented with disabling BQL on the 8349 but didn't see any
impact from doing that (consistent with what you'd reported). I didn't
see any real large variations either (target and server on same switch),
but I'm thinking the scatter could be reduced further if I isolated
the switch entirely to just the target and server. I'll do that if I
end up doing any more testing on this, since the averages seem to be
reproduceable to about +/- 2% at the moment...
Paul.
--------------
Command: netperf -l 20 -cC -H 192.168.146.65 -t TCP_STREAM -- -m 1500
next-next baseline: commit 1f07b62f3205f6ed41759df2892eaf433bc051a1
fsl RFC: http://patchwork.ozlabs.org/patch/175919/ applied to above.
Default queue sizes (256), BQL defaults.
8349 (528 MHz, single core):
net-next 10 runs
avg=123
max=124
min=121
send utilization > 99%
fsl RFC 13 runs:
avg=129 (+ ~5%)
max=131
min=127
send utilization > 99%
8641D: (1GHz, dual core)
net-next 10 runs
avg=826
max=839
min=807
send utilization ~ 70%
fsl RFC 12 runs
avg=762 (- ~8%)
max=783
min=698
send utilization ~ 70%
fsl RFC, _only_ 1st 3 of 4 patches, 13 runs
avg=794 (- ~4%)
max=816
min=758
send utilization ~ 70%
--------------
> Thanks for helping.
>
> Regards,
> Claudiu
>
>
^ permalink raw reply
* Re: Slow inbound traffic on macvtap interfaces
From: Michael S. Tsirkin @ 2012-08-16 15:36 UTC (permalink / raw)
To: Chris Webb; +Cc: netdev, Jason Wang, qemu-devel, Arnd Bergmann
In-Reply-To: <20120816142756.GA9806@arachsys.com>
On Thu, Aug 16, 2012 at 03:27:57PM +0100, Chris Webb wrote:
> "Michael S. Tsirkin" <mst@redhat.com> writes:
>
> > On Thu, Aug 16, 2012 at 10:20:05AM +0100, Chris Webb wrote:
> >
> > > For example, I can run
> > >
> > > ip addr add 192.168.1.2/24 dev eth0
> > > ip link set eth0 up
> > > ip link add link eth0 name tap0 address 02:02:02:02:02:02 type macvtap mode bridge
> > > ip link set tap0 up
> > > qemu-kvm -hda debian.img -cpu host -m 512 -vnc :0 \
> > > -net nic,model=virtio,macaddr=02:02:02:02:02:02 \
> > > -net tap,fd=3 3<>/dev/tap$(< /sys/class/net/tap0/ifindex)
> > >
> > > on one physical host which is otherwise completely idle. From a second
> > > physical host on the same network, I then scp a large (say 50MB) file onto
> > > the new guest. On a gigabit LAN, speeds consistently drop to less than
> > > 100kB/s as the transfer progresses, within a second of starting.
>
> > Thanks for the report.
> > I'll try to reproduce this early next week.
> > Meanwhile a question - do you still observe this behaviour if you enable
> > vhost-net?
>
> I haven't tried running with vhost-net before. Is it sufficient to compile
> the host kernel with CONFIG_VHOST_NET=y and boot the guest with
>
> qemu-kvm -hda debian.img -cpu host -m 512 -vnc :0 \
> -net nic,model=virtio,macaddr=02:02:02:02:02:02 \
> -net tap,fd=3,vhost=on,vhostfd=4 \
> 3<>/dev/tap$(< /sys/class/net/tap0/ifindex) 4<>/dev/vhost-net
>
> ? If so, then I'm afraid this doesn't make any difference: it still stalls
> and drops right down in speed.
>
> The reason I'm hesitant about whether the vhost-net is actually working is
> that with both vhost=off and vhost=on, I see an identical virtio feature set
> within the guest:
>
> # cat /sys/bus/virtio/devices/virtio0/features
> 0000011000000001111100000000100000000000000000000000000000000000
Yes that is expected.
> However, without the 4<>/dev/vhost-net or with 4<>/dev/null, it seems to
> fail to start altogether with vhost=on,vhostfd=4, so perhaps it's fine?
>
> Cheers,
>
> Chris.
^ permalink raw reply
* [PATCH 1/2] packet: Report rings cfg via diag engine
From: Pavel Emelyanov @ 2012-08-16 15:34 UTC (permalink / raw)
To: David Miller, Linux Netdev List
In-Reply-To: <502D125A.40701@parallels.com>
One extension bit may result in two nlattrs -- one per ring type.
If some ring type is not configured, then the respective nlatts
will be empty.
The structure reported contains the data, that is given to the
corresponding ring setup socket option.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
---
include/linux/packet_diag.h | 13 +++++++++++
net/packet/diag.c | 48 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 1 deletions(-)
diff --git a/include/linux/packet_diag.h b/include/linux/packet_diag.h
index ea2e8923..34ade82 100644
--- a/include/linux/packet_diag.h
+++ b/include/linux/packet_diag.h
@@ -14,6 +14,7 @@ struct packet_diag_req {
#define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */
#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */
+#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */
struct packet_diag_msg {
__u8 pdiag_family;
@@ -27,6 +28,8 @@ struct packet_diag_msg {
enum {
PACKET_DIAG_INFO,
PACKET_DIAG_MCLIST,
+ PACKET_DIAG_RX_RING,
+ PACKET_DIAG_TX_RING,
PACKET_DIAG_MAX,
};
@@ -54,4 +57,14 @@ struct packet_diag_mclist {
__u8 pdmc_addr[MAX_ADDR_LEN];
};
+struct packet_diag_ring {
+ __u32 pdr_block_size;
+ __u32 pdr_block_nr;
+ __u32 pdr_frame_size;
+ __u32 pdr_frame_nr;
+ __u32 pdr_retire_tmo;
+ __u32 pdr_sizeof_priv;
+ __u32 pdr_features;
+};
+
#endif
diff --git a/net/packet/diag.c b/net/packet/diag.c
index 3dda4ec..e3975e4 100644
--- a/net/packet/diag.c
+++ b/net/packet/diag.c
@@ -67,12 +67,54 @@ static int pdiag_put_mclist(const struct packet_sock *po, struct sk_buff *nlskb)
return 0;
}
+static int pdiag_put_ring(struct packet_ring_buffer *ring, int ver, int nl_type,
+ struct sk_buff *nlskb)
+{
+ struct packet_diag_ring pdr;
+
+ if (!ring->pg_vec || ((ver > TPACKET_V2) &&
+ (nl_type == PACKET_DIAG_TX_RING)))
+ return 0;
+
+ pdr.pdr_block_size = ring->pg_vec_pages << PAGE_SHIFT;
+ pdr.pdr_block_nr = ring->pg_vec_len;
+ pdr.pdr_frame_size = ring->frame_size;
+ pdr.pdr_frame_nr = ring->frame_max + 1;
+
+ if (ver > TPACKET_V2) {
+ pdr.pdr_retire_tmo = ring->prb_bdqc.retire_blk_tov;
+ pdr.pdr_sizeof_priv = ring->prb_bdqc.blk_sizeof_priv;
+ pdr.pdr_features = ring->prb_bdqc.feature_req_word;
+ } else {
+ pdr.pdr_retire_tmo = 0;
+ pdr.pdr_sizeof_priv = 0;
+ pdr.pdr_features = 0;
+ }
+
+ return nla_put(nlskb, nl_type, sizeof(pdr), &pdr);
+}
+
+static int pdiag_put_rings_cfg(struct packet_sock *po, struct sk_buff *skb)
+{
+ int ret;
+
+ mutex_lock(&po->pg_vec_lock);
+ ret = pdiag_put_ring(&po->rx_ring, po->tp_version,
+ PACKET_DIAG_RX_RING, skb);
+ if (!ret)
+ ret = pdiag_put_ring(&po->tx_ring, po->tp_version,
+ PACKET_DIAG_TX_RING, skb);
+ mutex_unlock(&po->pg_vec_lock);
+
+ return ret;
+}
+
static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag_req *req,
u32 pid, u32 seq, u32 flags, int sk_ino)
{
struct nlmsghdr *nlh;
struct packet_diag_msg *rp;
- const struct packet_sock *po = pkt_sk(sk);
+ struct packet_sock *po = pkt_sk(sk);
nlh = nlmsg_put(skb, pid, seq, SOCK_DIAG_BY_FAMILY, sizeof(*rp), flags);
if (!nlh)
@@ -93,6 +135,10 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct packet_diag
pdiag_put_mclist(po, skb))
goto out_nlmsg_trim;
+ if ((req->pdiag_show & PACKET_SHOW_RING_CFG) &&
+ pdiag_put_rings_cfg(po, skb))
+ goto out_nlmsg_trim;
+
return nlmsg_end(skb, nlh);
out_nlmsg_trim:
--
1.7.6.5
^ permalink raw reply related
* [PATCH 0/2] packet: Report fanout and rings via diag
From: Pavel Emelyanov @ 2012-08-16 15:31 UTC (permalink / raw)
To: David Miller, Linux Netdev List
Hi.
After this the packet diag module reports everything that can be
configured on a packet socket via AF_PACKET-specific API.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
^ permalink raw reply
* Re: suspicious RCU usage in xfrm_net_init()
From: Fengguang Wu @ 2012-08-16 15:19 UTC (permalink / raw)
To: Fan Du; +Cc: Priyanka Jain, netdev, LKML
In-Reply-To: <502CBF23.4070805@windriver.com>
Hi Fan,
On Thu, Aug 16, 2012 at 05:36:35PM +0800, Fan Du wrote:
>
> Hi, Fengguang
>
> Could you please try the below patch, see if spewing still there?
> thanks
Yes, it worked, thank you very much!
btw, your email client wraps long lines..
Thanks,
Fengguang
> From a3f86ecc3ee16ff81d49416bbf791780422988b3 Mon Sep 17 00:00:00 2001
> From: Fan Du <fan.du@windriver.com>
> Date: Thu, 16 Aug 2012 17:31:25 +0800
> Subject: [PATCH] Use rcu_dereference_bh to deference pointer
> protected by rcu_read_lock_bh
>
> Signed-off-by: Fan Du <fan.du@windriver.com>
> ---
> net/xfrm/xfrm_policy.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 5ad4d2c..75a9d6a 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -2501,7 +2501,7 @@ static void __net_init
> xfrm_dst_ops_init(struct net *net)
> struct xfrm_policy_afinfo *afinfo;
>
> rcu_read_lock_bh();
> - afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET]);
> + afinfo = rcu_dereference_bh(xfrm_policy_afinfo[AF_INET]);
> if (afinfo)
> net->xfrm.xfrm4_dst_ops = *afinfo->dst_ops;
> #if IS_ENABLED(CONFIG_IPV6)
> --
> 1.7.1
>
>
>
>
> On 2012年08月16日 15:37, Fengguang Wu wrote:
> >Hi Priyanka,
> >
> >The below warning shows up, probably related to this commit:
> >
> >418a99ac6ad487dc9c42e6b0e85f941af56330f2 Replace rwlock on xfrm_policy_afinfo with rcu
> >
> >[ 0.921216]
> >[ 0.921645] ===============================
> >[ 0.922766] [ INFO: suspicious RCU usage. ]
> >[ 0.923887] 3.5.0-01540-g1669891 #64 Not tainted
> >[ 0.925123] -------------------------------
> >[ 0.932860] /c/kernel-tests/src/tip/net/xfrm/xfrm_policy.c:2504 suspicious rcu_dereference_check() usage!
> >[ 0.935361]
> >[ 0.935361] other info that might help us debug this:
> >[ 0.935361]
> >[ 0.937472]
> >[ 0.937472] rcu_scheduler_active = 1, debug_locks = 0
> >[ 0.939182] 2 locks held by swapper/1:
> >[ 0.940171] #0: (net_mutex){+.+.+.}, at: [<ffffffff814e1ad0>] register_pernet_subsys+0x21/0x57
> >[ 0.942705] #1: (rcu_read_lock_bh){......}, at: [<ffffffff822c7329>] xfrm_net_init+0x1e4/0x437
> >[ 0.951507]
> >[ 0.951507] stack backtrace:
> >[ 0.952660] Pid: 1, comm: swapper Not tainted 3.5.0-01540-g1669891 #64
> >[ 0.954364] Call Trace:
> >[ 0.955074] [<ffffffff8108b375>] lockdep_rcu_suspicious+0x174/0x187
> >[ 0.956736] [<ffffffff822c7453>] xfrm_net_init+0x30e/0x437
> >[ 0.958205] [<ffffffff822c7329>] ? xfrm_net_init+0x1e4/0x437
> >[ 0.959712] [<ffffffff814e134a>] ops_init+0x1bb/0x1ff
> >[ 0.961067] [<ffffffff810861f9>] ? trace_hardirqs_on+0x1b/0x24
> >[ 0.962644] [<ffffffff814e17cd>] register_pernet_operations.isra.5+0x9d/0xfe
> >[ 0.971376] [<ffffffff814e1adf>] register_pernet_subsys+0x30/0x57
> >[ 0.972992] [<ffffffff822c7130>] xfrm_init+0x17/0x2c
> >[ 0.974316] [<ffffffff822c2f8c>] ip_rt_init+0x82/0xe7
> >[ 0.975668] [<ffffffff822c31dc>] ip_init+0x10/0x25
> >[ 0.976952] [<ffffffff822c3f77>] inet_init+0x235/0x360
> >[ 0.978352] [<ffffffff822c3d42>] ? devinet_init+0xf2/0xf2
> >[ 0.979808] [<ffffffff82283252>] do_one_initcall+0xb4/0x203
> >[ 0.981313] [<ffffffff8228354a>] kernel_init+0x1a9/0x29a
> >[ 0.982732] [<ffffffff822826d9>] ? loglevel+0x46/0x46
> >[ 0.990889] [<ffffffff816d3d84>] kernel_thread_helper+0x4/0x10
> >[ 0.992472] [<ffffffff816d262c>] ? retint_restore_args+0x13/0x13
> >[ 0.994076] [<ffffffff822833a1>] ? do_one_initcall+0x203/0x203
> >[ 0.995636] [<ffffffff816d3d80>] ? gs_change+0x13/0x13
> >[ 0.997197] TCP established hash table entries: 8192 (order: 5, 131072 bytes)
> >[ 1.000074] TCP bind hash table entries: 8192 (order: 7, 655360 bytes)
> >
> >Thanks,
> >Fengguang
>
> --
>
> Love each day!
> --fan
^ permalink raw reply
* Re: [PATCH 02/16] user_ns: use new hashtable implementation
From: Mathieu Desnoyers @ 2012-08-16 14:28 UTC (permalink / raw)
To: David Laight
Cc: snitzer-H+wXaHxf7aLQT0dZR+AlfA, neilb-l3A5Bk7waGM,
fweisbec-Re5JQEeQqe8AvxtiuMwx3w,
Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA,
bfields-uC3wQj2KruNg9hUCZPvPmw,
paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ,
dm-devel-H+wXaHxf7aLQT0dZR+AlfA, agk-H+wXaHxf7aLQT0dZR+AlfA,
aarcange-H+wXaHxf7aLQT0dZR+AlfA, rds-devel-N0ozoZBvEnrZJqsBc5GL+g,
eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
venkat.x.venkatsubra-QHcLZuEGTsvQT0dZR+AlfA,
ccaulfie-H+wXaHxf7aLQT0dZR+AlfA, mingo-X9Un+BFzKDI,
dev-yBygre7rU0TnMu66kgdUjQ, ericvh-Re5JQEeQqe8AvxtiuMwx3w,
josh-iaAMLnmF4UmaiuxdJuQwMA, rostedt-nx8X9YLhiw1AfugRpC6u6w,
lw-BthXqXjhjHXQFUHtdCDX3A, teigland-H+wXaHxf7aLQT0dZR+AlfA,
Sasha Levin, axboe-tSWWG44O7X1aa/9Udqfwiw,
linux-nfs-u79uwXL29TY76Z2rM5mHXA, edumazet-hpIqsD4AKlfQT0dZR+AlfA,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, ejt-H+wXaHxf7aLQT0dZR+AlfA,
Eric W. Biederman, tj-DgEjT+Ai2ygdnm+yROfE0A,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
davem-fT/PcQaiUtIeIZ0/mPfg9Q
In-Reply-To: <AE90C24D6B3A694183C094C60CF0A2F6026B6FB5-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
* David Laight (David.Laight-ZS65k/vG3HxXrIkS9f7CXA@public.gmane.org) wrote:
> > Yes hash_32 seems reasonable for the uid hash. With those long hash
> > chains I wouldn't like to be on a machine with 10,000 processes with
> > each with a different uid, and a processes calling setuid in the fast
> > path.
> >
> > The uid hash that we are playing with is one that I sort of wish that
> > the hash table could grow in size, so that we could scale up better.
>
> Since uids are likely to be allocated in dense blocks, maybe an
> unhashed multi-level lookup scheme might be appropriate.
>
> Index an array with the low 8 (say) bits of the uid.
> Each item can be either:
> 1) NULL => free entry.
> 2) a pointer to a uid structure (check uid value).
> 3) a pointer to an array to index with the next 8 bits.
> (2) and (3) can be differentiated by the low address bit.
I'm currently experimenting with "Judy arrays", which would likely be a
good fit for this kind of use-case.
It's basically a 256-ary trie, with fixed depth that depends on the key
size, that uses various encoding (compaction) schemes to compress
internal nodes depending on their density. The original implementation
made by HP has been criticised as somewhat too complex (20k lines of
code), but I'm currently working (in my spare time) on a more elegant
solution, that supports RCU lookups and distributed locking, and uses
much simpler node compaction schemes, and focus on having good cache
locality (and minimal number of cache line hits) for lookups.
I'll be presenting my ongoing work at Plumbers, if you are interested.
Best regards,
Mathieu
> I think that is updateable with cmpxchg.
>
> Clearly this is a bad algorithm if uids are all multiples of 2^24
> but that is true or any hash function.
>
> David
>
>
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* Re: Slow inbound traffic on macvtap interfaces
From: Chris Webb @ 2012-08-16 14:27 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: netdev, qemu-devel, Jason Wang, Arnd Bergmann
In-Reply-To: <20120816114233.GA21343@redhat.com>
"Michael S. Tsirkin" <mst@redhat.com> writes:
> On Thu, Aug 16, 2012 at 10:20:05AM +0100, Chris Webb wrote:
>
> > For example, I can run
> >
> > ip addr add 192.168.1.2/24 dev eth0
> > ip link set eth0 up
> > ip link add link eth0 name tap0 address 02:02:02:02:02:02 type macvtap mode bridge
> > ip link set tap0 up
> > qemu-kvm -hda debian.img -cpu host -m 512 -vnc :0 \
> > -net nic,model=virtio,macaddr=02:02:02:02:02:02 \
> > -net tap,fd=3 3<>/dev/tap$(< /sys/class/net/tap0/ifindex)
> >
> > on one physical host which is otherwise completely idle. From a second
> > physical host on the same network, I then scp a large (say 50MB) file onto
> > the new guest. On a gigabit LAN, speeds consistently drop to less than
> > 100kB/s as the transfer progresses, within a second of starting.
> Thanks for the report.
> I'll try to reproduce this early next week.
> Meanwhile a question - do you still observe this behaviour if you enable
> vhost-net?
I haven't tried running with vhost-net before. Is it sufficient to compile
the host kernel with CONFIG_VHOST_NET=y and boot the guest with
qemu-kvm -hda debian.img -cpu host -m 512 -vnc :0 \
-net nic,model=virtio,macaddr=02:02:02:02:02:02 \
-net tap,fd=3,vhost=on,vhostfd=4 \
3<>/dev/tap$(< /sys/class/net/tap0/ifindex) 4<>/dev/vhost-net
? If so, then I'm afraid this doesn't make any difference: it still stalls
and drops right down in speed.
The reason I'm hesitant about whether the vhost-net is actually working is
that with both vhost=off and vhost=on, I see an identical virtio feature set
within the guest:
# cat /sys/bus/virtio/devices/virtio0/features
0000011000000001111100000000100000000000000000000000000000000000
However, without the 4<>/dev/vhost-net or with 4<>/dev/null, it seems to
fail to start altogether with vhost=on,vhostfd=4, so perhaps it's fine?
Cheers,
Chris.
^ permalink raw reply
* [PATCH v0 3/5] cgroup: Protect access to task_cls_classid() when built as module
From: Daniel Wagner @ 2012-08-16 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, David S. Miller, Gao feng, Jamal Hadi Salim,
John Fastabend, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345126336-20755-1-git-send-email-wagi@monom.org>
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
The module version of task_cls_classid() checks if net_cls_sbusys_id
is valid to indentify when it is okay to access the controller.
Instead relying on the subusys_id to be set, make it explicit
with a jump label.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/net/cls_cgroup.h | 8 +++++++-
net/core/sock.c | 5 +++++
net/sched/cls_cgroup.c | 5 +++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 401672c..5b91220 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -16,6 +16,7 @@
#include <linux/cgroup.h>
#include <linux/hardirq.h>
#include <linux/rcupdate.h>
+#include <linux/jump_label.h>
#ifdef CONFIG_CGROUPS
struct cgroup_cls_state
@@ -24,6 +25,11 @@ struct cgroup_cls_state
u32 classid;
};
+#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
+extern struct static_key cgroup_cls_enabled;
+#define clscg_enabled static_key_false(&cgroup_cls_enabled)
+#endif
+
extern void sock_update_classid(struct sock *sk);
#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
@@ -52,7 +58,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
int id;
u32 classid = 0;
- if (in_interrupt())
+ if (!clscg_enabled || in_interrupt())
return 0;
rcu_read_lock();
diff --git a/net/core/sock.c b/net/core/sock.c
index 8f67ced..8d3a400 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -327,6 +327,11 @@ int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
EXPORT_SYMBOL(__sk_backlog_rcv);
#if defined(CONFIG_CGROUPS)
+#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
+struct static_key cgroup_cls_enabled = STATIC_KEY_INIT_FALSE;
+EXPORT_SYMBOL_GPL(cgroup_cls_enabled);
+#endif
+
#if !defined(CONFIG_NET_CLS_CGROUP)
int net_cls_subsys_id = -1;
EXPORT_SYMBOL_GPL(net_cls_subsys_id);
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 7743ea8..f40086b 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -44,12 +44,17 @@ static struct cgroup_subsys_state *cgrp_create(struct cgroup *cgrp)
if (cgrp->parent)
cs->classid = cgrp_cls_state(cgrp->parent)->classid;
+ else if (!clscg_enabled)
+ static_key_slow_inc(&cgroup_cls_enabled);
return &cs->css;
}
static void cgrp_destroy(struct cgroup *cgrp)
{
+ if (!cgrp->parent && clscg_enabled)
+ static_key_slow_dec(&cgroup_cls_enabled);
+
kfree(cgrp_cls_state(cgrp));
}
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v0 2/5] cgroup: Move sock_update_classid() decleration to cls_cgroup.h
From: Daniel Wagner @ 2012-08-16 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, Gao feng, Jamal Hadi Salim, John Fastabend,
Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345126336-20755-1-git-send-email-wagi@monom.org>
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
The only user of sock_update_classid() is net/socket.c which
happens to include cls_cgroup.h direclty.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/net/cls_cgroup.h | 8 ++++++++
include/net/sock.h | 8 --------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index e2fe2b9..401672c 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -24,6 +24,8 @@ struct cgroup_cls_state
u32 classid;
};
+extern void sock_update_classid(struct sock *sk);
+
#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
static inline u32 task_cls_classid(struct task_struct *p)
@@ -73,6 +75,12 @@ static inline u32 task_cls_classid(struct task_struct *p)
#endif /* CONFIG_NET_CLS_CGROUP */
+#else /* !CONFIG_CGROUPS */
+
+static inline void sock_update_classid(struct sock *sk)
+{
+}
+
#endif /* CONFIG_CGROURPS */
#endif /* _NET_CLS_CGROUP_H */
diff --git a/include/net/sock.h b/include/net/sock.h
index 72132ae..160a680 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1486,14 +1486,6 @@ extern void *sock_kmalloc(struct sock *sk, int size,
extern void sock_kfree_s(struct sock *sk, void *mem, int size);
extern void sk_send_sigurg(struct sock *sk);
-#ifdef CONFIG_CGROUPS
-extern void sock_update_classid(struct sock *sk);
-#else
-static inline void sock_update_classid(struct sock *sk)
-{
-}
-#endif
-
/*
* Functions to fill in entries in struct proto_ops when a protocol
* does not implement a particular function.
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v0 0/5] cgroup: Assign subsystem IDs during compile time
From: Daniel Wagner @ 2012-08-16 14:12 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, David S. Miller, Andrew Morton, Eric Dumazet,
Gao feng, Glauber Costa, Jamal Hadi Salim, John Fastabend,
Kamezawa Hiroyuki, Li Zefan, Neil Horman, Tejun Heo
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
Hi,
The patch #1 and #2 are there to be able to introduce (#3, #4) the
jump labels in task_cls_classid() and task_netprioidx(). The jump
labels are needed to know when it is safe to access the controller.
For example not safe means the module is not yet loaded.
All those patches are just preparation for the center piece (#5)
of these series. This one will remove the dynamic subsystem ID
generation and falls back to compile time generated IDs.
This is the first result from the discussion around on the
"cgroup cls & netprio 'cleanups'" patches.
This patches are against net-next
cheers,
daniel
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
Daniel Wagner (5):
cgroup: Use empty task_cls_classid() when !CONFIG_NET_CLS(_MODULE)
cgroup: Move sock_update_classid() decleration to cls_cgroup.h
cgroup: Protect access to task_cls_classid() when built as module
cgroup: Protect access to task_netprioidx() when built as module
cgroup: Assign subsystem IDs during compile time
include/linux/cgroup.h | 20 +++++++++++++-------
include/linux/cgroup_subsys.h | 24 ++++++++++++------------
include/net/cls_cgroup.h | 42 +++++++++++++++++++++++++++++-------------
include/net/netprio_cgroup.h | 23 +++++++++++------------
include/net/sock.h | 8 --------
kernel/cgroup.c | 31 +++++++++----------------------
net/core/netprio_cgroup.c | 17 ++++++-----------
net/core/sock.c | 12 ++++++------
net/sched/cls_cgroup.c | 18 +++++-------------
9 files changed, 91 insertions(+), 104 deletions(-)
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply
* [PATCH v0 5/5] cgroup: Assign subsystem IDs during compile time
From: Daniel Wagner @ 2012-08-16 14:12 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA
Cc: Daniel Wagner, David S. Miller, Andrew Morton, Eric Dumazet,
Gao feng, Glauber Costa, Jamal Hadi Salim, John Fastabend,
Kamezawa Hiroyuki, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345126336-20755-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
We are able to safe some space when we assign the subsystem
IDs at compile time. Instead of allocating per cgroup
cgroup->subsys[CGROUP_SUBSYS_COUNT] where CGROUP_SUBSYS_COUNT is
always 64, we allocate 12 + 1 at max (at this point there are 12
subsystem).
The enum is created by passing in cgroup_subsys.h twice and
redefine the IS_SUBSYS_ENABLED. In the first pass, we just select
the builtin subsystem and in the second pass only the module
subsystems. The enums regions are separated by
CGROUP_BUILTIN_SUBSYS_COUNT which is the reason why we loose one
enum.
That also means we need to update all iterators over the module
subsystem ids to start one later (or stop one earlier).
task_cls_classid() and task_netprioidx() (when built as
module) are protected by a jump label and therefore we can
simply replace the subsystem index lookup with the enum.
Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Cc: Eric Dumazet <edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
include/linux/cgroup.h | 20 +++++++++++++-------
include/linux/cgroup_subsys.h | 24 ++++++++++++------------
include/net/cls_cgroup.h | 12 +++---------
include/net/netprio_cgroup.h | 17 ++++-------------
kernel/cgroup.c | 31 +++++++++----------------------
net/core/netprio_cgroup.c | 11 -----------
net/core/sock.c | 9 ---------
net/sched/cls_cgroup.c | 13 -------------
8 files changed, 41 insertions(+), 96 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c90eaa8..995739f 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -46,16 +46,20 @@ extern const struct file_operations proc_cgroup_operations;
/* Define the enumeration of all builtin cgroup subsystems */
#define SUBSYS(_x) _x ## _subsys_id,
enum cgroup_subsys_id {
+
+#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
+#include <linux/cgroup_subsys.h>
+#undef IS_SUBSYS_ENABLED
+
+ CGROUP_BUILTIN_SUBSYS_COUNT,
+
+#define IS_SUBSYS_ENABLED(option) IS_MODULE(option)
#include <linux/cgroup_subsys.h>
- CGROUP_BUILTIN_SUBSYS_COUNT
+#undef IS_SUBSYS_ENABLED
+
+ CGROUP_SUBSYS_COUNT
};
#undef SUBSYS
-/*
- * This define indicates the maximum number of subsystems that can be loaded
- * at once. We limit to this many since cgroupfs_root has subsys_bits to keep
- * track of all of them.
- */
-#define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long))
/* Per-subsystem/per-cgroup state maintained by the system. */
struct cgroup_subsys_state {
@@ -521,7 +525,9 @@ struct cgroup_subsys {
};
#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
+#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)
#include <linux/cgroup_subsys.h>
+#undef IS_SUBSYS_ENABLED
#undef SUBSYS
static inline struct cgroup_subsys_state *cgroup_subsys_state(
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index dfae957..f204a7a 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -7,73 +7,73 @@
/* */
-#ifdef CONFIG_CPUSETS
+#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
SUBSYS(cpuset)
#endif
/* */
-#ifdef CONFIG_CGROUP_DEBUG
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
SUBSYS(debug)
#endif
/* */
-#ifdef CONFIG_CGROUP_SCHED
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
SUBSYS(cpu_cgroup)
#endif
/* */
-#ifdef CONFIG_CGROUP_CPUACCT
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
SUBSYS(cpuacct)
#endif
/* */
-#ifdef CONFIG_MEMCG
+#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
SUBSYS(mem_cgroup)
#endif
/* */
-#ifdef CONFIG_CGROUP_DEVICE
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
SUBSYS(devices)
#endif
/* */
-#ifdef CONFIG_CGROUP_FREEZER
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
SUBSYS(freezer)
#endif
/* */
-#ifdef CONFIG_NET_CLS_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
SUBSYS(net_cls)
#endif
/* */
-#ifdef CONFIG_BLK_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
SUBSYS(blkio)
#endif
/* */
-#ifdef CONFIG_CGROUP_PERF
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
SUBSYS(perf)
#endif
/* */
-#ifdef CONFIG_NETPRIO_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
SUBSYS(net_prio)
#endif
/* */
-#ifdef CONFIG_CGROUP_HUGETLB
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
SUBSYS(hugetlb)
#endif
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 5b91220..c82af60 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -51,22 +51,16 @@ static inline u32 task_cls_classid(struct task_struct *p)
#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
-extern int net_cls_subsys_id;
-
static inline u32 task_cls_classid(struct task_struct *p)
{
- int id;
- u32 classid = 0;
+ u32 classid;
if (!clscg_enabled || in_interrupt())
return 0;
rcu_read_lock();
- id = rcu_dereference_index_check(net_cls_subsys_id,
- rcu_read_lock_held());
- if (id >= 0)
- classid = container_of(task_subsys_state(p, id),
- struct cgroup_cls_state, css)->classid;
+ classid = container_of(task_subsys_state(p, net_cls_subsys_id),
+ struct cgroup_cls_state, css)->classid;
rcu_read_unlock();
return classid;
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index a0fd35a..5b790dc 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -31,10 +31,6 @@ struct cgroup_netprio_state {
u32 prioidx;
};
-#ifndef CONFIG_NETPRIO_CGROUP
-extern int net_prio_subsys_id;
-#endif
-
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
extern struct static_key cgroup_netprio_enabled;
#define netpriocg_enabled static_key_false(&cgroup_netprio_enabled)
@@ -62,20 +58,15 @@ static inline u32 task_netprioidx(struct task_struct *p)
static inline u32 task_netprioidx(struct task_struct *p)
{
struct cgroup_netprio_state *state;
- int subsys_id;
- u32 idx = 0;
+ u32 idx;
if (!netpriocg_enabled)
return 0;
rcu_read_lock();
- subsys_id = rcu_dereference_index_check(net_prio_subsys_id,
- rcu_read_lock_held());
- if (subsys_id >= 0) {
- state = container_of(task_subsys_state(p, subsys_id),
- struct cgroup_netprio_state, css);
- idx = state->prioidx;
- }
+ state = container_of(task_subsys_state(p, net_prio_subsys_id),
+ struct cgroup_netprio_state, css);
+ idx = state->prioidx;
rcu_read_unlock();
return idx;
}
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 7981850..aa629ce 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -93,9 +93,12 @@ static DEFINE_MUTEX(cgroup_root_mutex);
* cgroup_mutex.
*/
#define SUBSYS(_x) &_x ## _subsys,
+#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
static struct cgroup_subsys *subsys[CGROUP_SUBSYS_COUNT] = {
#include <linux/cgroup_subsys.h>
};
+#undef IS_SUBSYS_ENABLED
+#undef SUBSYS
#define MAX_CGROUP_ROOT_NAMELEN 64
@@ -1307,7 +1310,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
* raced with a module_delete call, and to the user this is
* essentially a "subsystem doesn't exist" case.
*/
- for (i--; i >= CGROUP_BUILTIN_SUBSYS_COUNT; i--) {
+ for (i--; i > CGROUP_BUILTIN_SUBSYS_COUNT; i--) {
/* drop refcounts only on the ones we took */
unsigned long bit = 1UL << i;
@@ -1324,7 +1327,7 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
static void drop_parsed_module_refcounts(unsigned long subsys_bits)
{
int i;
- for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
+ for (i = CGROUP_BUILTIN_SUBSYS_COUNT + 1; i < CGROUP_SUBSYS_COUNT; i++) {
unsigned long bit = 1UL << i;
if (!(bit & subsys_bits))
@@ -4322,7 +4325,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
*/
if (ss->module == NULL) {
/* a few sanity checks */
- BUG_ON(ss->subsys_id >= CGROUP_BUILTIN_SUBSYS_COUNT);
+ BUG_ON(ss->subsys_id > CGROUP_BUILTIN_SUBSYS_COUNT);
BUG_ON(subsys[ss->subsys_id] != ss);
return 0;
}
@@ -4330,24 +4333,8 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
/* init base cftset */
cgroup_init_cftsets(ss);
- /*
- * need to register a subsys id before anything else - for example,
- * init_cgroup_css needs it.
- */
mutex_lock(&cgroup_mutex);
- /* find the first empty slot in the array */
- for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
- if (subsys[i] == NULL)
- break;
- }
- if (i == CGROUP_SUBSYS_COUNT) {
- /* maximum number of subsystems already registered! */
- mutex_unlock(&cgroup_mutex);
- return -EBUSY;
- }
- /* assign ourselves the subsys_id */
- ss->subsys_id = i;
- subsys[i] = ss;
+ subsys[ss->subsys_id] = ss;
/*
* no ss->create seems to need anything important in the ss struct, so
@@ -4356,7 +4343,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
css = ss->create(dummytop);
if (IS_ERR(css)) {
/* failure case - need to deassign the subsys[] slot. */
- subsys[i] = NULL;
+ subsys[ss->subsys_id] = NULL;
mutex_unlock(&cgroup_mutex);
return PTR_ERR(css);
}
@@ -4372,7 +4359,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
if (ret) {
dummytop->subsys[ss->subsys_id] = NULL;
ss->destroy(dummytop);
- subsys[i] = NULL;
+ subsys[ss->subsys_id] = NULL;
mutex_unlock(&cgroup_mutex);
return ret;
}
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index 6fef72f..bf82a11 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -348,9 +348,7 @@ struct cgroup_subsys net_prio_subsys = {
.create = cgrp_create,
.destroy = cgrp_destroy,
.attach = net_prio_attach,
-#ifdef CONFIG_NETPRIO_CGROUP
.subsys_id = net_prio_subsys_id,
-#endif
.base_cftypes = ss_files,
.module = THIS_MODULE
};
@@ -388,10 +386,6 @@ static int __init init_cgroup_netprio(void)
ret = cgroup_load_subsys(&net_prio_subsys);
if (ret)
goto out;
-#ifndef CONFIG_NETPRIO_CGROUP
- smp_wmb();
- net_prio_subsys_id = net_prio_subsys.subsys_id;
-#endif
register_netdevice_notifier(&netprio_device_notifier);
@@ -408,11 +402,6 @@ static void __exit exit_cgroup_netprio(void)
cgroup_unload_subsys(&net_prio_subsys);
-#ifndef CONFIG_NETPRIO_CGROUP
- net_prio_subsys_id = -1;
- synchronize_rcu();
-#endif
-
rtnl_lock();
for_each_netdev(&init_net, dev) {
old = rtnl_dereference(dev->priomap);
diff --git a/net/core/sock.c b/net/core/sock.c
index d00da68..c2ce9bc 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -335,15 +335,6 @@ EXPORT_SYMBOL_GPL(cgroup_cls_enabled);
struct static_key cgroup_netprio_enabled = STATIC_KEY_INIT_FALSE;
EXPORT_SYMBOL_GPL(cgroup_netprio_enabled);
#endif
-
-#if !defined(CONFIG_NET_CLS_CGROUP)
-int net_cls_subsys_id = -1;
-EXPORT_SYMBOL_GPL(net_cls_subsys_id);
-#endif
-#if !defined(CONFIG_NETPRIO_CGROUP)
-int net_prio_subsys_id = -1;
-EXPORT_SYMBOL_GPL(net_prio_subsys_id);
-#endif
#endif
static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index f40086b..5d4b46d 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -82,9 +82,7 @@ struct cgroup_subsys net_cls_subsys = {
.name = "net_cls",
.create = cgrp_create,
.destroy = cgrp_destroy,
-#ifdef CONFIG_NET_CLS_CGROUP
.subsys_id = net_cls_subsys_id,
-#endif
.base_cftypes = ss_files,
.module = THIS_MODULE,
};
@@ -288,12 +286,6 @@ static int __init init_cgroup_cls(void)
if (ret)
goto out;
-#ifndef CONFIG_NET_CLS_CGROUP
- /* We can't use rcu_assign_pointer because this is an int. */
- smp_wmb();
- net_cls_subsys_id = net_cls_subsys.subsys_id;
-#endif
-
ret = register_tcf_proto_ops(&cls_cgroup_ops);
if (ret)
cgroup_unload_subsys(&net_cls_subsys);
@@ -306,11 +298,6 @@ static void __exit exit_cgroup_cls(void)
{
unregister_tcf_proto_ops(&cls_cgroup_ops);
-#ifndef CONFIG_NET_CLS_CGROUP
- net_cls_subsys_id = -1;
- synchronize_rcu();
-#endif
-
cgroup_unload_subsys(&net_cls_subsys);
}
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v0 4/5] cgroup: Protect access to task_netprioidx() when built as module
From: Daniel Wagner @ 2012-08-16 14:12 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA
Cc: Daniel Wagner, David S. Miller, Gao feng, Jamal Hadi Salim,
John Fastabend, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345126336-20755-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
The module version of task_netprioidex() checks if net_prio_subsys_id
is valid to indentify when it is okay to access the controller.
Instead relying on the net_prio_subsys_id to be set, make it explicit
with a jump label.
Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
include/net/netprio_cgroup.h | 10 +++++++++-
net/core/netprio_cgroup.c | 6 ++++++
net/core/sock.c | 4 ++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 2719dec..a0fd35a 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -16,7 +16,7 @@
#include <linux/cgroup.h>
#include <linux/hardirq.h>
#include <linux/rcupdate.h>
-
+#include <linux/jump_label.h>
struct netprio_map {
struct rcu_head rcu;
@@ -35,6 +35,11 @@ struct cgroup_netprio_state {
extern int net_prio_subsys_id;
#endif
+#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
+extern struct static_key cgroup_netprio_enabled;
+#define netpriocg_enabled static_key_false(&cgroup_netprio_enabled)
+#endif
+
extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
@@ -60,6 +65,9 @@ static inline u32 task_netprioidx(struct task_struct *p)
int subsys_id;
u32 idx = 0;
+ if (!netpriocg_enabled)
+ return 0;
+
rcu_read_lock();
subsys_id = rcu_dereference_index_check(net_prio_subsys_id,
rcu_read_lock_held());
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index ed0c043..6fef72f 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -155,6 +155,9 @@ static struct cgroup_subsys_state *cgrp_create(struct cgroup *cgrp)
goto out;
}
+ if (!netpriocg_enabled && !cgrp->parent)
+ static_key_slow_inc(&cgroup_netprio_enabled);
+
ret = update_netdev_tables();
if (ret < 0) {
put_prioidx(cs->prioidx);
@@ -173,6 +176,9 @@ static void cgrp_destroy(struct cgroup *cgrp)
struct net_device *dev;
struct netprio_map *map;
+ if (netpriocg_enabled && !cgrp->parent)
+ static_key_slow_dec(&cgroup_netprio_enabled);
+
cs = cgrp_netprio_state(cgrp);
rtnl_lock();
for_each_netdev(&init_net, dev) {
diff --git a/net/core/sock.c b/net/core/sock.c
index 8d3a400..d00da68 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -331,6 +331,10 @@ EXPORT_SYMBOL(__sk_backlog_rcv);
struct static_key cgroup_cls_enabled = STATIC_KEY_INIT_FALSE;
EXPORT_SYMBOL_GPL(cgroup_cls_enabled);
#endif
+#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
+struct static_key cgroup_netprio_enabled = STATIC_KEY_INIT_FALSE;
+EXPORT_SYMBOL_GPL(cgroup_netprio_enabled);
+#endif
#if !defined(CONFIG_NET_CLS_CGROUP)
int net_cls_subsys_id = -1;
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v0 1/5] cgroup: Use empty task_cls_classid() when !CONFIG_NET_CLS(_MODULE)
From: Daniel Wagner @ 2012-08-16 14:12 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA
Cc: Daniel Wagner, David S. Miller, Gao feng, Jamal Hadi Salim,
John Fastabend, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345126336-20755-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
include/net/cls_cgroup.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index a4dc5b0..e2fe2b9 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -24,7 +24,8 @@ struct cgroup_cls_state
u32 classid;
};
-#ifdef CONFIG_NET_CLS_CGROUP
+#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
+
static inline u32 task_cls_classid(struct task_struct *p)
{
int classid;
@@ -39,7 +40,9 @@ static inline u32 task_cls_classid(struct task_struct *p)
return classid;
}
-#else
+
+#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
+
extern int net_cls_subsys_id;
static inline u32 task_cls_classid(struct task_struct *p)
@@ -60,11 +63,16 @@ static inline u32 task_cls_classid(struct task_struct *p)
return classid;
}
-#endif
+
#else
+
static inline u32 task_cls_classid(struct task_struct *p)
{
return 0;
}
-#endif
+
+#endif /* CONFIG_NET_CLS_CGROUP */
+
+#endif /* CONFIG_CGROURPS */
+
#endif /* _NET_CLS_CGROUP_H */
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [Patch net-next] xfrm: use rcu_dereference_bh() when BH is disabled
From: Cong Wang @ 2012-08-16 14:09 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Priyanka Jain, Cong Wang
This patch fixes the following RCU warning:
===============================
[ INFO: suspicious RCU usage. ]
3.5.0+ #64 Not tainted
-------------------------------
net/xfrm/xfrm_policy.c:2504 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
2 locks held by swapper/1:
#0: (net_mutex){+.+.+.}, at: [<ffffffff814e1ad0>] register_pernet_subsys+0x21/0x57
#1: (rcu_read_lock_bh){......}, at: [<ffffffff822c7329>] xfrm_net_init+0x1e4/0x437
stack backtrace:
Pid: 1, comm: swapper Not tainted 3.5.0-01540-g1669891 #64
Call Trace:
[<ffffffff8108b375>] lockdep_rcu_suspicious+0x174/0x187
[<ffffffff822c7453>] xfrm_net_init+0x30e/0x437
[<ffffffff822c7329>] ? xfrm_net_init+0x1e4/0x437
[<ffffffff814e134a>] ops_init+0x1bb/0x1ff
[<ffffffff810861f9>] ? trace_hardirqs_on+0x1b/0x24
[<ffffffff814e17cd>] register_pernet_operations.isra.5+0x9d/0xfe
[<ffffffff814e1adf>] register_pernet_subsys+0x30/0x57
[<ffffffff822c7130>] xfrm_init+0x17/0x2c
[<ffffffff822c2f8c>] ip_rt_init+0x82/0xe7
[<ffffffff822c31dc>] ip_init+0x10/0x25
[<ffffffff822c3f77>] inet_init+0x235/0x360
[<ffffffff822c3d42>] ? devinet_init+0xf2/0xf2
[<ffffffff82283252>] do_one_initcall+0xb4/0x203
[<ffffffff8228354a>] kernel_init+0x1a9/0x29a
[<ffffffff822826d9>] ? loglevel+0x46/0x46
[<ffffffff816d3d84>] kernel_thread_helper+0x4/0x10
[<ffffffff816d262c>] ? retint_restore_args+0x13/0x13
[<ffffffff822833a1>] ? do_one_initcall+0x203/0x203
[<ffffffff816d3d80>] ? gs_change+0x13/0x13
which is caused by:
commit 418a99ac6ad487dc9c42e6b0e85f941af56330f2
Author: Priyanka Jain <Priyanka.Jain@freescale.com>
Date: Sun Aug 12 21:22:29 2012 +0000
Replace rwlock on xfrm_policy_afinfo with rcu
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Priyanka Jain <Priyanka.Jain@freescale.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 5ad4d2c..6405764 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2501,11 +2501,11 @@ static void __net_init xfrm_dst_ops_init(struct net *net)
struct xfrm_policy_afinfo *afinfo;
rcu_read_lock_bh();
- afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET]);
+ afinfo = rcu_dereference_bh(xfrm_policy_afinfo[AF_INET]);
if (afinfo)
net->xfrm.xfrm4_dst_ops = *afinfo->dst_ops;
#if IS_ENABLED(CONFIG_IPV6)
- afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET6]);
+ afinfo = rcu_dereference_bh(xfrm_policy_afinfo[AF_INET6]);
if (afinfo)
net->xfrm.xfrm6_dst_ops = *afinfo->dst_ops;
#endif
^ permalink raw reply related
* Re: [RFC PATCH 0/5] net: socket bind to file descriptor introduced
From: J. Bruce Fields @ 2012-08-16 13:54 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Stanislav Kinsbursky, tglx, mingo, davem, hpa, thierry.reding,
bfields, eric.dumazet, xemul, neilb, netdev, x86, linux-kernel,
paul.gortmaker, viro, gorcunov, akpm, tim.c.chen, devel
In-Reply-To: <87y5lf7d37.fsf@xmission.com>
On Wed, Aug 15, 2012 at 08:03:24PM -0700, Eric W. Biederman wrote:
> Stanislav Kinsbursky <skinsbursky@parallels.com> writes:
>
> > This patch set introduces new socket operation and new system call:
> > sys_fbind(), which allows to bind socket to opened file.
> > File to bind to can be created by sys_mknod(S_IFSOCK) and opened by
> > open(O_PATH).
> >
> > This system call is especially required for UNIX sockets, which has name
> > lenght limitation.
> >
> > The following series implements...
>
> Hmm. I just realized this patchset is even sillier than I thought.
>
> Stanislav is the problem you are ultimately trying to solve nfs clients
> in a container connecting to the wrong user space rpciod?
>
> Aka net/sunrpc/xprtsock.c:xs_setup_local only taking an absolute path
> and then creating a delayed work item to actually open the unix domain
> socket?
>
> The straight correct and straight forward thing to do appears to be:
> - Capture the root from current->fs in xs_setup_local.
> - In xs_local_finish_connect change current->fs.root to the captured
> version of root before kernel_connect, and restore current->fs.root
> after kernel_connect.
Ah, yep, that should do it.
--b.
>
> It might not be a bad idea to implement open on unix domain sockets in
> a filesystem as create(AF_LOCAL)+connect() which would allow you to
> replace __sock_create + kernel_connect with a simple file_open_root.
>
> But I think the simple scheme of:
> struct path old_root;
> old_root = current->fs.root;
> kernel_connect(...);
> current->fs.root = old_root;
>
> Is more than sufficient and will remove the need for anything
> except a purely local change to get nfs clients to connect from
> containers.
>
> Eric
^ permalink raw reply
* [patch] sctp: fix bogus if statement in sctp_auth_recv_cid()
From: Dan Carpenter @ 2012-08-16 13:16 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Vlad Yasevich, Sridhar Samudrala, David S. Miller, linux-sctp,
netdev, kernel-janitors
There is an extra semi-colon here, so we always return 0 instead of
calling __sctp_auth_cid().
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed for linux-next.
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index aaa6c12..159b9bc 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -695,7 +695,7 @@ int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
return 0;
net = sock_net(asoc->base.sk);
- if (!net->sctp.auth_enable);
+ if (!net->sctp.auth_enable)
return 0;
return __sctp_auth_cid(chunk,
^ permalink raw reply related
* Re: [PATCH] net: add new QCA alx ethernet driver
From: Joe Perches @ 2012-08-16 13:16 UTC (permalink / raw)
To: cjren
Cc: davem, netdev, linux-kernel, qca-linux-team, nic-devel,
Xiong Huang, Luis R. Rodriguez
In-Reply-To: <1345053189-10326-1-git-send-email-cjren@qca.qualcomm.com>
On Thu, 2012-08-16 at 01:53 +0800, cjren@qca.qualcomm.com wrote:
> From: Cloud Ren <cjren@qca.qualcomm.com>
>
> This driver support two new ethernet chipsets:
> 1969:1091 - AR8161 Gigabit Ethernet
> 1969:1090 - AR8162 Fast Ethernet
[]
> diff --git a/drivers/net/ethernet/atheros/alx/alx_main.c b/drivers/net/ethernet/atheros/alx/alx_main.c
[]
> +/*
> + * alx_hw_printk
> + */
> +void alx_hw_printk(const char *level, const struct alx_hw *hw,
> + const char *fmt, ...)
> +{
> + struct va_format vaf;
> + va_list args;
> +
> + va_start(args, fmt);
> + vaf.fmt = fmt;
> + vaf.va = &args;
> +
> + if (hw && hw->adpt && hw->adpt->netdev)
> + __netdev_printk(level, hw->adpt->netdev, &vaf);
Hi Cloud. Please convert this to
netdev_printk(level, hw->adpt->netdev, "%pV", &vaf);
I will submit a patch soon to make the __netdev_printk variant static.
^ permalink raw reply
* [patch] ipv6: move dereference after check in fl_free()
From: Dan Carpenter @ 2012-08-16 13:15 UTC (permalink / raw)
To: Eric W. Biederman
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, netdev, kernel-janitors
There is a dereference before checking for NULL bug here. Generally
free() functions should accept NULL pointers. For example, fl_create()
can pass a NULL pointer to fl_free() on the error path.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed on linux-next.
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index c836a6a..90bbefb 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -91,12 +91,9 @@ static struct ip6_flowlabel *fl_lookup(struct net *net, __be32 label)
static void fl_free(struct ip6_flowlabel *fl)
{
- switch (fl->share) {
- case IPV6_FL_S_PROCESS:
- put_pid(fl->owner.pid);
- break;
- }
if (fl) {
+ if (fl->share == IPV6_FL_S_PROCESS)
+ put_pid(fl->owner.pid);
release_net(fl->fl_net);
kfree(fl->opt);
}
^ permalink raw reply related
* [patch] gre: information leak in ip6_tnl_ioctl()
From: Dan Carpenter @ 2012-08-16 13:14 UTC (permalink / raw)
To: xeb
Cc: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, netdev, kernel-janitors
There is a one byte hole between p->hop_limit and p->flowinfo where
stack memory is leaked to the user. This was introduced in c12b395a46
"gre: Support GRE over IPv6".
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is only needed in linux-next.
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 33d2a0e..cb7e2de 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1312,6 +1312,8 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
ip6_tnl_parm_from_user(&p1, &p);
t = ip6_tnl_locate(net, &p1, 0);
+ } else {
+ memset(&p, 0, sizeof(p));
}
if (t == NULL)
t = netdev_priv(dev);
^ permalink raw reply related
* [iproute2][PATCH] utils: invarg: msg precedes the faulty arg
From: Dan Kenigsberg @ 2012-08-16 12:25 UTC (permalink / raw)
To: netdev; +Cc: Dan Kenigsberg
fix all call which reversed the arg order.
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
---
ip/ip.c | 2 +-
ip/ipaddress.c | 2 +-
tc/tc_class.c | 10 +++++-----
tc/tc_filter.c | 12 ++++++------
tc/tc_qdisc.c | 4 ++--
5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/ip/ip.c b/ip/ip.c
index 20dc3b5..4e8ac5c 100644
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
else if (strcmp(argv[1], "help") == 0)
usage();
else
- invarg(argv[1], "invalid protocol family");
+ invarg("invalid protocol family", argv[1]);
} else if (strcmp(opt, "-4") == 0) {
preferred_family = AF_INET;
} else if (strcmp(opt, "-6") == 0) {
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 69a63b3..cbff143 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1147,7 +1147,7 @@ static int ipaddr_modify(int cmd, int flags, int argc, char **argv)
unsigned scope = 0;
NEXT_ARG();
if (rtnl_rtscope_a2n(&scope, *argv))
- invarg(*argv, "invalid scope value.");
+ invarg("invalid scope value.", *argv);
req.ifa.ifa_scope = scope;
scoped = 1;
} else if (strcmp(*argv, "dev") == 0) {
diff --git a/tc/tc_class.c b/tc/tc_class.c
index de18fd1..95bf615 100644
--- a/tc/tc_class.c
+++ b/tc/tc_class.c
@@ -74,7 +74,7 @@ int tc_class_modify(int cmd, unsigned flags, int argc, char **argv)
if (req.t.tcm_handle)
duparg("classid", *argv);
if (get_tc_classid(&handle, *argv))
- invarg(*argv, "invalid class ID");
+ invarg("invalid class ID", *argv);
req.t.tcm_handle = handle;
} else if (strcmp(*argv, "handle") == 0) {
fprintf(stderr, "Error: try \"classid\" instead of \"handle\"\n");
@@ -91,7 +91,7 @@ int tc_class_modify(int cmd, unsigned flags, int argc, char **argv)
if (req.t.tcm_parent)
duparg("parent", *argv);
if (get_tc_classid(&handle, *argv))
- invarg(*argv, "invalid parent ID");
+ invarg("invalid parent ID", *argv);
req.t.tcm_parent = handle;
} else if (matches(*argv, "estimator") == 0) {
if (parse_estimator(&argc, &argv, &est))
@@ -252,13 +252,13 @@ int tc_class_list(int argc, char **argv)
if (filter_qdisc)
duparg("qdisc", *argv);
if (get_qdisc_handle(&filter_qdisc, *argv))
- invarg(*argv, "invalid qdisc ID");
+ invarg("invalid qdisc ID", *argv);
} else if (strcmp(*argv, "classid") == 0) {
NEXT_ARG();
if (filter_classid)
duparg("classid", *argv);
if (get_tc_classid(&filter_classid, *argv))
- invarg(*argv, "invalid class ID");
+ invarg("invalid class ID", *argv);
} else if (strcmp(*argv, "root") == 0) {
if (t.tcm_parent) {
fprintf(stderr, "Error: \"root\" is duplicate parent ID\n");
@@ -271,7 +271,7 @@ int tc_class_list(int argc, char **argv)
duparg("parent", *argv);
NEXT_ARG();
if (get_tc_classid(&handle, *argv))
- invarg(*argv, "invalid parent ID");
+ invarg("invalid parent ID", *argv);
t.tcm_parent = handle;
} else if (matches(*argv, "help") == 0) {
usage();
diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index 04c3b82..c9e09d8 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -93,7 +93,7 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
if (req.t.tcm_parent)
duparg("parent", *argv);
if (get_tc_classid(&handle, *argv))
- invarg(*argv, "Invalid parent ID");
+ invarg("Invalid parent ID", *argv);
req.t.tcm_parent = handle;
} else if (strcmp(*argv, "handle") == 0) {
NEXT_ARG();
@@ -106,14 +106,14 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
if (prio)
duparg("priority", *argv);
if (get_u32(&prio, *argv, 0) || prio > 0xFFFF)
- invarg(*argv, "invalid priority value");
+ invarg("invalid priority value", *argv);
} else if (matches(*argv, "protocol") == 0) {
__u16 id;
NEXT_ARG();
if (protocol_set)
duparg("protocol", *argv);
if (ll_proto_a2n(&id, *argv))
- invarg(*argv, "invalid protocol");
+ invarg("invalid protocol", *argv);
protocol = id;
protocol_set = 1;
} else if (matches(*argv, "estimator") == 0) {
@@ -290,7 +290,7 @@ int tc_filter_list(int argc, char **argv)
if (t.tcm_parent)
duparg("parent", *argv);
if (get_tc_classid(&handle, *argv))
- invarg(*argv, "invalid parent ID");
+ invarg("invalid parent ID", *argv);
filter_parent = t.tcm_parent = handle;
} else if (strcmp(*argv, "handle") == 0) {
NEXT_ARG();
@@ -303,7 +303,7 @@ int tc_filter_list(int argc, char **argv)
if (prio)
duparg("priority", *argv);
if (get_u32(&prio, *argv, 0))
- invarg(*argv, "invalid preference");
+ invarg("invalid preference", *argv);
filter_prio = prio;
} else if (matches(*argv, "protocol") == 0) {
__u16 res;
@@ -311,7 +311,7 @@ int tc_filter_list(int argc, char **argv)
if (protocol)
duparg("protocol", *argv);
if (ll_proto_a2n(&res, *argv))
- invarg(*argv, "invalid protocol");
+ invarg("invalid protocol", *argv);
protocol = res;
filter_protocol = protocol;
} else if (matches(*argv, "help") == 0) {
diff --git a/tc/tc_qdisc.c b/tc/tc_qdisc.c
index 3f932a7..c8d7335 100644
--- a/tc/tc_qdisc.c
+++ b/tc/tc_qdisc.c
@@ -83,7 +83,7 @@ int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv)
duparg("handle", *argv);
NEXT_ARG();
if (get_qdisc_handle(&handle, *argv))
- invarg(*argv, "invalid qdisc ID");
+ invarg("invalid qdisc ID", *argv);
req.t.tcm_handle = handle;
} else if (strcmp(*argv, "root") == 0) {
if (req.t.tcm_parent) {
@@ -111,7 +111,7 @@ int tc_qdisc_modify(int cmd, unsigned flags, int argc, char **argv)
if (req.t.tcm_parent)
duparg("parent", *argv);
if (get_tc_classid(&handle, *argv))
- invarg(*argv, "invalid parent ID");
+ invarg("invalid parent ID", *argv);
req.t.tcm_parent = handle;
} else if (matches(*argv, "estimator") == 0) {
if (parse_estimator(&argc, &argv, &est))
--
1.7.7.6
^ permalink raw reply related
* Re: [net V2] act_mirred: do not drop packets when fails to mirror it
From: Jamal Hadi Salim @ 2012-08-16 12:11 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, linux-kernel, davem
In-Reply-To: <1345099467-40922-1-git-send-email-jasowang@redhat.com>
On Thu, 2012-08-16 at 14:44 +0800, Jason Wang wrote:
> We drop packet unconditionally when we fail to mirror it. This is not intended
> in some cases. Consdier for kvm guest, we may mirror the traffic of the bridge
> to a tap device used by a VM. When kernel fails to mirror the packet in
> conditions such as when qemu crashes or stop polling the tap, it's hard for the
> management software to detect such condition and clean the the mirroring
> before. This would lead all packets to the bridge to be dropped and break the
> netowrk of other virtual machines.
>
> To solve the issue, the patch does not drop packets when kernel fails to mirror
> it, and only drop the redirected packets.
>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
cheers,
jamal
^ permalink raw reply
* Re: Slow inbound traffic on macvtap interfaces
From: Michael S. Tsirkin @ 2012-08-16 11:42 UTC (permalink / raw)
To: Chris Webb; +Cc: netdev, qemu-devel, Jason Wang, Arnd Bergmann
In-Reply-To: <20120816092004.GA1894@arachsys.com>
On Thu, Aug 16, 2012 at 10:20:05AM +0100, Chris Webb wrote:
> I'm experiencing a problem with qemu + macvtap which I can reproduce on a
> variety of hardware, with kernels varying from 3.0.4 (the oldest I tried) to
> 3.5.1 and with qemu[-kvm] versions 0.14.1, 1.0, and 1.1.
>
> Large data transfers over TCP into a guest from another machine on the
> network are very slow (often less than 100kB/s) whereas transfers outbound
> from the guest, between two guests on the same host, or between the guest
> and its host run at normal speeds (>= 50MB/s).
>
> The slow inbound data transfer speeds up substantially when a ping flood is
> aimed either at the host or the guest, or when the qemu process is straced.
> Presumably both of these are ways to wake up something that is otherwise
> sleeping too long?
>
> For example, I can run
>
> ip addr add 192.168.1.2/24 dev eth0
> ip link set eth0 up
> ip link add link eth0 name tap0 address 02:02:02:02:02:02 type macvtap mode bridge
> ip link set tap0 up
> qemu-kvm -hda debian.img -cpu host -m 512 -vnc :0 \
> -net nic,model=virtio,macaddr=02:02:02:02:02:02 \
> -net tap,fd=3 3<>/dev/tap$(< /sys/class/net/tap0/ifindex)
>
> on one physical host which is otherwise completely idle. From a second
> physical host on the same network, I then scp a large (say 50MB) file onto
> the new guest. On a gigabit LAN, speeds consistently drop to less than
> 100kB/s as the transfer progresses, within a second of starting.
>
> The choice of virtio virtual nic in the above isn't significant: the same thing
> happens with e1000 or rtl8139. You can also replace the scp with a straight
> netcat and see the same effect.
>
> Doing the transfer in the other direction (i.e. copying a large file from the
> guest to an external host) achieves 50MB/s or faster as expected. Copying
> between two guests on the same host (i.e. taking advantage of the 'mode
> bridge') is also fast.
>
> If I create a macvlan device attached to eth0 and move the host IP address to
> that, I can communicate between the host itself and the guest because of the
> 'mode bridge'. Again, this case is fast in both directions.
>
> Using a bridge and a standard tap interface, transfers in and out are fast
> too:
>
> ip tuntap add tap0 mode tap
> brctl addbr br0
> brctl addif br0 eth0
> brctl addif br0 tap1
> ip link set eth0 up
> ip link set tap0 up
> ip link set br0 up
> ip addr add 192.168.1.2/24 dev br0
> qemu-kvm -hda debian.img -cpu host -m 512 -vnc :0 \
> -net nic,model=virtio,macaddr=02:02:02:02:02:02 \
> -net tap,script=no,downscript=no,ifname=tap0
>
> As mentioned in the summary at the beginning of this report, when I strace a
> guest in the original configuration which is receiving data slowly, the data
> rate improves from less than 100kB/s to around 3.1MB/s. Similarly, if I ping
> flood either the guest or the host it is running on from another machine on
> the network, the transfer rate improves to around 1.1MB/s. This seems quite
> suggestive of a problem with delayed wake-up of the guest.
>
> Two reasonably up-to-date examples of machines I've reproduced this on are
> my laptop with an r8169 gigabit ethernet card, Debian qemu-kvm 1.0 and
> upstream 3.4.8 kernel whose .config and boot dmesg are at
>
> http://cdw.me.uk/tmp/laptop-config.txt
> http://cdw.me.uk/tmp/laptop-dmesg.txt
>
> and one of our large servers with an igb gigabit ethernet card, upstream
> qemu-kvm 1.1.1 and upstream 3.5.1 linux:
>
> http://cdw.me.uk/tmp/server-config.txt
> http://cdw.me.uk/tmp/server-dmesg.txt
>
> For completeness, I've put the Debian 6 test image I've been using for
> testing at
>
> http://cdw.me.uk/tmp/test-debian.img.xz
>
> though I've see the same problem from a variety of guest operating systems.
> (In fact, I've not yet found any combination of host kernel, guest OS and
> hardware which doesn't show these symptoms, so it seems to be very easy to
> reproduce.)
>
> Cheers,
>
> Chris.
Thanks for the report.
I'll try to reproduce this early next week.
Meanwhile a question - do you still observe this behaviour if you enable
vhost-net?
Thanks,
--
MST
^ permalink raw reply
* [PATCH net-next] sctp: fix compile issue with disabled CONFIG_NET_NS
From: Ulrich Weber @ 2012-08-16 11:24 UTC (permalink / raw)
To: davem; +Cc: netdev, ebiederm
struct seq_net_private has no struct net
if CONFIG_NET_NS is not enabled
Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
---
net/sctp/proc.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 3e62ee5..d9cb2ab 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -199,7 +199,6 @@ static void * sctp_eps_seq_next(struct seq_file *seq, void *v, loff_t *pos)
/* Display sctp endpoints (/proc/net/sctp/eps). */
static int sctp_eps_seq_show(struct seq_file *seq, void *v)
{
- struct seq_net_private *priv = seq->private;
struct sctp_hashbucket *head;
struct sctp_ep_common *epb;
struct sctp_endpoint *ep;
@@ -216,7 +215,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v)
sctp_for_each_hentry(epb, node, &head->chain) {
ep = sctp_ep(epb);
sk = epb->sk;
- if (!net_eq(sock_net(sk), priv->net))
+ if (!net_eq(sock_net(sk), seq_file_net(seq)))
continue;
seq_printf(seq, "%8pK %8pK %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk,
sctp_sk(sk)->type, sk->sk_state, hash,
@@ -307,7 +306,6 @@ static void * sctp_assocs_seq_next(struct seq_file *seq, void *v, loff_t *pos)
/* Display sctp associations (/proc/net/sctp/assocs). */
static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
{
- struct seq_net_private *priv = seq->private;
struct sctp_hashbucket *head;
struct sctp_ep_common *epb;
struct sctp_association *assoc;
@@ -324,7 +322,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
sctp_for_each_hentry(epb, node, &head->chain) {
assoc = sctp_assoc(epb);
sk = epb->sk;
- if (!net_eq(sock_net(sk), priv->net))
+ if (!net_eq(sock_net(sk), seq_file_net(seq)))
continue;
seq_printf(seq,
"%8pK %8pK %-3d %-3d %-2d %-4d "
@@ -423,7 +421,6 @@ static void sctp_remaddr_seq_stop(struct seq_file *seq, void *v)
static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
{
- struct seq_net_private *priv = seq->private;
struct sctp_hashbucket *head;
struct sctp_ep_common *epb;
struct sctp_association *assoc;
@@ -438,7 +435,7 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
sctp_local_bh_disable();
read_lock(&head->lock);
sctp_for_each_hentry(epb, node, &head->chain) {
- if (!net_eq(sock_net(epb->sk), priv->net))
+ if (!net_eq(sock_net(epb->sk), seq_file_net(seq)))
continue;
assoc = sctp_assoc(epb);
list_for_each_entry(tsp, &assoc->peer.transport_addr_list,
--
1.7.9.5
^ permalink raw reply related
* RE:DEAR WINNER,OPEN THE ATTACHED FILE FOR YOUR SHELL AWARD WINNING INFORMATION:
From: SHELL AWARD 2012 @ 2012-08-16 11:02 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: spdc docment.docx --]
[-- Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document, Size: 39166 bytes --]
^ permalink raw reply
* Re: [PATCH 001/001] smsc95xx: Fix hard_header_len
From: Steve Glendinning @ 2012-08-16 9:57 UTC (permalink / raw)
To: JamesBetts; +Cc: netdev, David Miller
In-Reply-To: <1345060138-5629-1-git-send-email-jimbob.betts@googlemail.com>
Hi James,
Thanks for spotting this, I don't think I've ever tested this device with IMQ.
> - dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM;
> - dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
> + dev->net->needed_headroom = SMSC95XX_TX_OVERHEAD_CSUM;
> + dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len +
> dev->net->needed_headroom;
I'm unsure what we *should* be setting hard_header_len and
needed_headroom to. David?
Thanks,
--
Steve Glendinning
^ 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