* Re: [PATCH 3/3] selftests: silence test output by default
From: Josef Bacik @ 2017-09-18 17:52 UTC (permalink / raw)
To: Shuah Khan
Cc: josef, Josef Bacik, David S. Miller, linux-kernel,
linux-kselftest, netdev, shuah Khan
In-Reply-To: <e8b067d2-9cef-2f3c-78a5-d6630aa765c1@kernel.org>
On Mon, Sep 18, 2017 at 11:46:18AM -0600, Shuah Khan wrote:
> On 09/18/2017 11:37 AM, josef@toxicpanda.com wrote:
> > From: Josef Bacik <jbacik@fb.com>
> >
> > Some of the networking tests are very noisy and make it impossible to
> > see if we actually passed the tests as they run. Default to suppressing
> > the output from any tests run in order to make it easier to track what
> > failed.
> >
> > Signed-off-by: Josef Bacik <jbacik@fb.com>
> > --
>
> This change suppresses pass/fail wrapper output for all tests, not just the
> networking tests.
>
> Could you please send me before and after results for what you are trying
> to fix.
>
Yeah I wanted to suppress extraneous output from everybody, I just happened to
notice it because I was testing net. The default thing already spits out what
it's running and pass/fail, there's no need to include all of the random output
unless the user wants to go and run the test manually. As it is now it's
_impossible_ to tell what ran and what passed/failed because of all the random
output.
Ideally kselftests would work like xfstests does and simply capture the output
to a log so you could go check afterwards, but that's a lot more work. Making
it easier to tell which tests passed/failed is a good enough first step.
Thanks,
Josef
^ permalink raw reply
* Re: [REGRESSION] Warning in tcp_fastretrans_alert() of net/ipv4/tcp_input.c
From: Oleksandr Natalenko @ 2017-09-18 17:59 UTC (permalink / raw)
To: Yuchung Cheng
Cc: Neal Cardwell, David S. Miller, Alexey Kuznetsov,
Hideaki YOSHIFUJI, Netdev
In-Reply-To: <CAK6E8=ekw7ybf6nwNy7S49ASZBsCS4c_7KR2Bcxq6WiXUKY56w@mail.gmail.com>
OK. Should I keep FACK disabled?
On pondělí 18. září 2017 19:51:21 CEST Yuchung Cheng wrote:
> Can you try this patch to verify my theory with tcp_recovery=0 and 1? thanks
>
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 5af2f04f8859..9253d9ee7d0e 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -2381,6 +2381,7 @@ static void tcp_undo_cwnd_reduction(struct sock
> *sk, bool unmark_loss)
> }
> tp->snd_cwnd_stamp = tcp_time_stamp;
> tp->undo_marker = 0;
> + WARN_ON(tp->retrans_out);
> }
^ permalink raw reply
* Re: [REGRESSION] Warning in tcp_fastretrans_alert() of net/ipv4/tcp_input.c
From: Yuchung Cheng @ 2017-09-18 18:01 UTC (permalink / raw)
To: Oleksandr Natalenko
Cc: Neal Cardwell, David S. Miller, Alexey Kuznetsov,
Hideaki YOSHIFUJI, Netdev
In-Reply-To: <40697505.YK5nrFG7Le@natalenko.name>
On Mon, Sep 18, 2017 at 10:59 AM, Oleksandr Natalenko
<oleksandr@natalenko.name> wrote:
> OK. Should I keep FACK disabled?
Yes since it is disabled in the upstream by default. Although you can
experiment FACK enabled additionally.
Do we know the crash you first experienced is tied to this issue?
>
> On pondělí 18. září 2017 19:51:21 CEST Yuchung Cheng wrote:
>> Can you try this patch to verify my theory with tcp_recovery=0 and 1? thanks
>>
>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>> index 5af2f04f8859..9253d9ee7d0e 100644
>> --- a/net/ipv4/tcp_input.c
>> +++ b/net/ipv4/tcp_input.c
>> @@ -2381,6 +2381,7 @@ static void tcp_undo_cwnd_reduction(struct sock
>> *sk, bool unmark_loss)
>> }
>> tp->snd_cwnd_stamp = tcp_time_stamp;
>> tp->undo_marker = 0;
>> + WARN_ON(tp->retrans_out);
>> }
>
^ permalink raw reply
* Re: [REGRESSION] Warning in tcp_fastretrans_alert() of net/ipv4/tcp_input.c
From: Oleksandr Natalenko @ 2017-09-18 18:04 UTC (permalink / raw)
To: Yuchung Cheng
Cc: Neal Cardwell, David S. Miller, Alexey Kuznetsov,
Hideaki YOSHIFUJI, Netdev
In-Reply-To: <CAK6E8=djbT-35JuHq+hhOKOG+BEO3RCwgsVPoKcDhNBph5OezA@mail.gmail.com>
On pondělí 18. září 2017 20:01:42 CEST Yuchung Cheng wrote:
> Yes since it is disabled in the upstream by default. Although you can
> experiment FACK enabled additionally.
OK.
> Do we know the crash you first experienced is tied to this issue?
No, unfortunately. I wasn't able to re-create it again, so lets focus on
tcp_fastretrans_alert warning only.
^ permalink raw reply
* [PATCH net] tcp: remove two unused functions
From: Yuchung Cheng @ 2017-09-18 18:05 UTC (permalink / raw)
To: davem; +Cc: netdev, Yuchung Cheng, Neal Cardwell, Eric Dumazet
remove tcp_may_send_now and tcp_snd_test that are no longer used
Fixes: 840a3cbe8969 ("tcp: remove forward retransmit feature")
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/tcp.h | 1 -
net/ipv4/tcp_output.c | 34 ----------------------------------
2 files changed, 35 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index ada65e767b28..a25c97f13b62 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -543,7 +543,6 @@ u32 tcp_tso_autosize(const struct sock *sk, unsigned int mss_now,
int min_tso_segs);
void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
int nonagle);
-bool tcp_may_send_now(struct sock *sk);
int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs);
int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs);
void tcp_retransmit_timer(struct sock *sk);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index b7661a68d498..b2d5d1c7ec6d 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1803,40 +1803,6 @@ static bool tcp_snd_wnd_test(const struct tcp_sock *tp,
return !after(end_seq, tcp_wnd_end(tp));
}
-/* This checks if the data bearing packet SKB (usually tcp_send_head(sk))
- * should be put on the wire right now. If so, it returns the number of
- * packets allowed by the congestion window.
- */
-static unsigned int tcp_snd_test(const struct sock *sk, struct sk_buff *skb,
- unsigned int cur_mss, int nonagle)
-{
- const struct tcp_sock *tp = tcp_sk(sk);
- unsigned int cwnd_quota;
-
- tcp_init_tso_segs(skb, cur_mss);
-
- if (!tcp_nagle_test(tp, skb, cur_mss, nonagle))
- return 0;
-
- cwnd_quota = tcp_cwnd_test(tp, skb);
- if (cwnd_quota && !tcp_snd_wnd_test(tp, skb, cur_mss))
- cwnd_quota = 0;
-
- return cwnd_quota;
-}
-
-/* Test if sending is allowed right now. */
-bool tcp_may_send_now(struct sock *sk)
-{
- const struct tcp_sock *tp = tcp_sk(sk);
- struct sk_buff *skb = tcp_send_head(sk);
-
- return skb &&
- tcp_snd_test(sk, skb, tcp_current_mss(sk),
- (tcp_skb_is_last(sk, skb) ?
- tp->nonagle : TCP_NAGLE_PUSH));
-}
-
/* Trim TSO SKB to LEN bytes, put the remaining data into a new packet
* which is put after SKB on the list. It is very much like
* tcp_fragment() except that it may make several kinds of assumptions
--
2.14.1.690.gbb1197296e-goog
^ permalink raw reply related
* Re: Regression in throughput between kvm guests over virtual bridge
From: Matthew Rosato @ 2017-09-18 18:11 UTC (permalink / raw)
To: Jason Wang, netdev; +Cc: davem, mst
In-Reply-To: <c9d43af9-f095-043a-7d46-acd84a18f75a@redhat.com>
On 09/18/2017 03:36 AM, Jason Wang wrote:
>
>
> On 2017年09月18日 11:13, Jason Wang wrote:
>>
>>
>> On 2017年09月16日 03:19, Matthew Rosato wrote:
>>>> It looks like vhost is slowed down for some reason which leads to more
>>>> idle time on 4.13+VHOST_RX_BATCH=1. Appreciated if you can collect the
>>>> perf.diff on host, one for rx and one for tx.
>>>>
>>> perf data below for the associated vhost threads, baseline=4.12,
>>> delta1=4.13, delta2=4.13+VHOST_RX_BATCH=1
>>>
>>> Client vhost:
>>>
>>> 60.12% -11.11% -12.34% [kernel.vmlinux] [k] raw_copy_from_user
>>> 13.76% -1.28% -0.74% [kernel.vmlinux] [k] get_page_from_freelist
>>> 2.00% +3.69% +3.54% [kernel.vmlinux] [k] __wake_up_sync_key
>>> 1.19% +0.60% +0.66% [kernel.vmlinux] [k] __alloc_pages_nodemask
>>> 1.12% +0.76% +0.86% [kernel.vmlinux] [k] copy_page_from_iter
>>> 1.09% +0.28% +0.35% [vhost] [k] vhost_get_vq_desc
>>> 1.07% +0.31% +0.26% [kernel.vmlinux] [k] alloc_skb_with_frags
>>> 0.94% +0.42% +0.65% [kernel.vmlinux] [k] alloc_pages_current
>>> 0.91% -0.19% -0.18% [kernel.vmlinux] [k] memcpy
>>> 0.88% +0.26% +0.30% [kernel.vmlinux] [k] __next_zones_zonelist
>>> 0.85% +0.05% +0.12% [kernel.vmlinux] [k] iov_iter_advance
>>> 0.79% +0.09% +0.19% [vhost] [k] __vhost_add_used_n
>>> 0.74% [kernel.vmlinux] [k] get_task_policy.part.7
>>> 0.74% -0.01% -0.05% [kernel.vmlinux] [k] tun_net_xmit
>>> 0.60% +0.17% +0.33% [kernel.vmlinux] [k] policy_nodemask
>>> 0.58% -0.15% -0.12% [ebtables] [k] ebt_do_table
>>> 0.52% -0.25% -0.22% [kernel.vmlinux] [k] __alloc_skb
>>> ...
>>> 0.42% +0.58% +0.59% [kernel.vmlinux] [k] eventfd_signal
>>> ...
>>> 0.32% +0.96% +0.93% [kernel.vmlinux] [k] finish_task_switch
>>> ...
>>> +1.50% +1.16% [kernel.vmlinux] [k] get_task_policy.part.9
>>> +0.40% +0.42% [kernel.vmlinux] [k] __skb_get_hash_symmetr
>>> +0.39% +0.40% [kernel.vmlinux] [k] _copy_from_iter_full
>>> +0.24% +0.23% [vhost_net] [k] vhost_net_buf_peek
>>>
>>> Server vhost:
>>>
>>> 61.93% -10.72% -10.91% [kernel.vmlinux] [k] raw_copy_to_user
>>> 9.25% +0.47% +0.86% [kernel.vmlinux] [k] free_hot_cold_page
>>> 5.16% +1.41% +1.57% [vhost] [k] vhost_get_vq_desc
>>> 5.12% -3.81% -3.78% [kernel.vmlinux] [k] skb_release_data
>>> 3.30% +0.42% +0.55% [kernel.vmlinux] [k] raw_copy_from_user
>>> 1.29% +2.20% +2.28% [kernel.vmlinux] [k] copy_page_to_iter
>>> 1.24% +1.65% +0.45% [vhost_net] [k] handle_rx
>>> 1.08% +3.03% +2.85% [kernel.vmlinux] [k] __wake_up_sync_key
>>> 0.96% +0.70% +1.10% [vhost] [k] translate_desc
>>> 0.69% -0.20% -0.22% [kernel.vmlinux] [k] tun_do_read.part.10
>>> 0.69% [kernel.vmlinux] [k] tun_peek_len
>>> 0.67% +0.75% +0.78% [kernel.vmlinux] [k] eventfd_signal
>>> 0.52% +0.96% +0.98% [kernel.vmlinux] [k] finish_task_switch
>>> 0.50% +0.05% +0.09% [vhost] [k] vhost_add_used_n
>>> ...
>>> +0.63% +0.58% [vhost_net] [k] vhost_net_buf_peek
>>> +0.32% +0.32% [kernel.vmlinux] [k] _copy_to_iter
>>> +0.19% +0.19% [kernel.vmlinux] [k] __skb_get_hash_symmetr
>>> +0.11% +0.21% [vhost] [k] vhost_umem_interval_tr
>>>
>>
>> Looks like for some unknown reason which leads more wakeups.
>>
>> Could you please try to attached patch to see if it solves or mitigate
>> the issue?
>>
>> Thanks
>
> My bad, please try this.
>
> Thanks
Thanks Jason. Built 4.13 + supplied patch, I see some decrease in
wakeups, but there's still quite a bit more compared to 4.12
(baseline=4.12, delta1=4.13, delta2=4.13+patch):
client:
2.00% +3.69% +2.55% [kernel.vmlinux] [k] __wake_up_sync_key
server:
1.08% +3.03% +1.85% [kernel.vmlinux] [k] __wake_up_sync_key
Throughput was roughly equivalent to base 4.13 (so, still seeing the
regression w/ this patch applied).
^ permalink raw reply
* Re: [PATCH 3/3] selftests: silence test output by default
From: Shuah Khan @ 2017-09-18 18:13 UTC (permalink / raw)
To: Josef Bacik, Shuah Khan
Cc: Josef Bacik, David S. Miller, linux-kernel, linux-kselftest,
netdev, Shuah Khan
In-Reply-To: <20170918175254.lsdzqvjm4uvix4rj@destiny>
On 09/18/2017 11:52 AM, Josef Bacik wrote:
> On Mon, Sep 18, 2017 at 11:46:18AM -0600, Shuah Khan wrote:
>> On 09/18/2017 11:37 AM, josef@toxicpanda.com wrote:
>>> From: Josef Bacik <jbacik@fb.com>
>>>
>>> Some of the networking tests are very noisy and make it impossible to
>>> see if we actually passed the tests as they run. Default to suppressing
>>> the output from any tests run in order to make it easier to track what
>>> failed.
>>>
>>> Signed-off-by: Josef Bacik <jbacik@fb.com>
>>> --
>>
>> This change suppresses pass/fail wrapper output for all tests, not just the
>> networking tests.
>>
>> Could you please send me before and after results for what you are trying
>> to fix.
>>
>
> Yeah I wanted to suppress extraneous output from everybody, I just happened to
> notice it because I was testing net. The default thing already spits out what
> it's running and pass/fail, there's no need to include all of the random output
> unless the user wants to go and run the test manually. As it is now it's
> _impossible_ to tell what ran and what passed/failed because of all the random
> output.
Unfortunately kselftests have lots of users that want different things. A recent
request is to use TAP13 format for output for external parsers to be able to parse.
That is what this change to add TAP13 header does.
The output you are seeing is the TAP 13 format to indicate the test has passed.
The right fix would be to suppress the Pass/Fail from the individual shell script
and have the shell script exit with error code. kselftest lib.mk will handle the
error code and print out pass/fail like it is doing now.
Using the common logic will help avoid duplicate code in tests/test scripts and
also makes the pass/fail messages consistent.
In the following output the individual test output can be eliminated since lib.mk
run_tests does that for you. In addition, you will also get a count of tests at
the end of the run of all tests in a test directory.
TAP version 13
selftests: run_netsocktests
========================================
--------------------
running socket test
--------------------
[PASS]
ok 1..1 selftests: run_netsocktests [PASS]
selftests: run_afpackettests
========================================
must be run as root
ok 1..2 selftests: run_afpackettests [PASS]
selftests: test_bpf.sh
========================================
test_bpf: [FAIL]
not ok 1..3 selftests: test_bpf.sh [FAIL]
selftests: netdevice.sh
========================================
SKIP: Need root privileges
ok 1..4 selftests: netdevice.sh [PASS]
If you eliminate that you will just see the common lib.mk results.
TAP version 13
selftests: run_netsocktests
========================================
ok 1..1 selftests: run_netsocktests [PASS]
selftests: run_afpackettests
========================================
must be run as root
ok 1..2 selftests: run_afpackettests [PASS]
========================================
selftests: test_bpf.sh
========================================
not ok 1..3 selftests: test_bpf.sh [FAIL]
selftests: netdevice.sh
========================================
SKIP: Need root privileges
ok 1..4 selftests: netdevice.sh [PASS]
If you would like to fix the duplicate output, please send me patches
to remove pass/fail output strings from tests instead. It is on my
todo to do that this release.
thanks,
-- Shuah
^ permalink raw reply
* [PATCH] vsock: vmci: Remove unneeded linux/miscdevice.h include
From: Corentin Labbe @ 2017-09-18 18:18 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Corentin Labbe
net/vmw_vsock/vmci_transport.c does not use any miscdevice so this patch
remove this unnecessary inclusion.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
net/vmw_vsock/vmci_transport.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 10ae7823a19d..0206155bff53 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -21,7 +21,6 @@
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/list.h>
-#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/net.h>
--
2.13.5
^ permalink raw reply related
* Re: [PATCH 3/3] selftests: silence test output by default
From: Josef Bacik @ 2017-09-18 18:24 UTC (permalink / raw)
To: Shuah Khan
Cc: Josef Bacik, Shuah Khan, Josef Bacik, David S. Miller,
linux-kernel, linux-kselftest, netdev
In-Reply-To: <ed8261a2-557a-cf1c-7298-d530bb7861d0@osg.samsung.com>
On Mon, Sep 18, 2017 at 12:13:40PM -0600, Shuah Khan wrote:
> On 09/18/2017 11:52 AM, Josef Bacik wrote:
> > On Mon, Sep 18, 2017 at 11:46:18AM -0600, Shuah Khan wrote:
> >> On 09/18/2017 11:37 AM, josef@toxicpanda.com wrote:
> >>> From: Josef Bacik <jbacik@fb.com>
> >>>
> >>> Some of the networking tests are very noisy and make it impossible to
> >>> see if we actually passed the tests as they run. Default to suppressing
> >>> the output from any tests run in order to make it easier to track what
> >>> failed.
> >>>
> >>> Signed-off-by: Josef Bacik <jbacik@fb.com>
> >>> --
> >>
> >> This change suppresses pass/fail wrapper output for all tests, not just the
> >> networking tests.
> >>
> >> Could you please send me before and after results for what you are trying
> >> to fix.
> >>
> >
> > Yeah I wanted to suppress extraneous output from everybody, I just happened to
> > notice it because I was testing net. The default thing already spits out what
> > it's running and pass/fail, there's no need to include all of the random output
> > unless the user wants to go and run the test manually. As it is now it's
> > _impossible_ to tell what ran and what passed/failed because of all the random
> > output.
>
> Unfortunately kselftests have lots of users that want different things. A recent
> request is to use TAP13 format for output for external parsers to be able to parse.
> That is what this change to add TAP13 header does.
>
> The output you are seeing is the TAP 13 format to indicate the test has passed.
>
> The right fix would be to suppress the Pass/Fail from the individual shell script
> and have the shell script exit with error code. kselftest lib.mk will handle the
> error code and print out pass/fail like it is doing now.
>
> Using the common logic will help avoid duplicate code in tests/test scripts and
> also makes the pass/fail messages consistent.
>
> In the following output the individual test output can be eliminated since lib.mk
> run_tests does that for you. In addition, you will also get a count of tests at
> the end of the run of all tests in a test directory.
>
> TAP version 13
> selftests: run_netsocktests
> ========================================
> --------------------
> running socket test
> --------------------
> [PASS]
> ok 1..1 selftests: run_netsocktests [PASS]
> selftests: run_afpackettests
> ========================================
> must be run as root
> ok 1..2 selftests: run_afpackettests [PASS]
> selftests: test_bpf.sh
> ========================================
> test_bpf: [FAIL]
> not ok 1..3 selftests: test_bpf.sh [FAIL]
> selftests: netdevice.sh
> ========================================
> SKIP: Need root privileges
> ok 1..4 selftests: netdevice.sh [PASS]
>
> If you eliminate that you will just see the common lib.mk results.
>
> TAP version 13
> selftests: run_netsocktests
> ========================================
> ok 1..1 selftests: run_netsocktests [PASS]
> selftests: run_afpackettests
> ========================================
> must be run as root
> ok 1..2 selftests: run_afpackettests [PASS]
> ========================================
> selftests: test_bpf.sh
> ========================================
> not ok 1..3 selftests: test_bpf.sh [FAIL]
> selftests: netdevice.sh
> ========================================
> SKIP: Need root privileges
> ok 1..4 selftests: netdevice.sh [PASS]
>
>
> If you would like to fix the duplicate output, please send me patches
> to remove pass/fail output strings from tests instead. It is on my
> todo to do that this release.
>
I'm confused, this is exactly what my patch does, it strips all of the
extraneous output and leaves only the TAP13 output. Here is the output without
my suppression patch
https://da.gd/pup0
and here is the output with my suppression patch
https://da.gd/3olKj
Unless I'm missing something subtle it appears to be exactly the output you
want, without the random crap from the other tests. The only thing I'm
redirecting is the output of the _test_ itself, $$BASENAME_TEST from what I can
tell is the actual test we're running, not the wrapper, so everything is as it
should be. Thanks,
Josef
^ permalink raw reply
* Re: [PATCH] net: tcp_input: Neaten DBGUNDO
From: David Miller @ 2017-09-18 18:29 UTC (permalink / raw)
To: joe; +Cc: kuznet, yoshfuji, netdev, linux-kernel
In-Reply-To: <fcac7d078947b59e47ad4474d2c60d4fd3395bcd.1505095255.git.joe@perches.com>
From: Joe Perches <joe@perches.com>
Date: Sun, 10 Sep 2017 19:02:25 -0700
> Move the #ifdef into the static void function so that the use
> of DBGUNDO is validated when FASTRETRANS_DEBUG <= 1.
>
> Remove the now unnecessary #else and #define DBGUNDO.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next v2 1/2] net: phy: realtek: rename RTL8211F_PAGE_SELECT to RTL821x_PAGE_SELECT
From: David Miller @ 2017-09-18 18:29 UTC (permalink / raw)
To: hayashi.kunihiko; +Cc: andrew, f.fainelli, netdev, jaswinder.singh
In-Reply-To: <1505210076-32311-1-git-send-email-hayashi.kunihiko@socionext.com>
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Date: Tue, 12 Sep 2017 18:54:35 +0900
> This renames the definition of page select register from
> RTL8211F_PAGE_SELECT to RTL821x_PAGE_SELECT to use it across models.
>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next v2 2/2] net: phy: realtek: add RTL8201F phy-id and functions
From: David Miller @ 2017-09-18 18:29 UTC (permalink / raw)
To: hayashi.kunihiko
Cc: andrew, f.fainelli, netdev, jaswinder.singh, neidhard.kim
In-Reply-To: <1505210076-32311-2-git-send-email-hayashi.kunihiko@socionext.com>
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Date: Tue, 12 Sep 2017 18:54:36 +0900
> From: Jassi Brar <jaswinder.singh@linaro.org>
>
> Add RTL8201F phy-id and the related functions to the driver.
>
> The original patch is as follows:
> https://patchwork.kernel.org/patch/2538341/
>
> Signed-off-by: Jongsung Kim <neidhard.kim@lge.com>
> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Applied.
^ permalink raw reply
* Re: [net-next] dummy: declare dummy devices as enumerated devices
From: David Miller @ 2017-09-18 18:29 UTC (permalink / raw)
To: zhangshengju; +Cc: netdev, ezegomez
In-Reply-To: <1505179965-12117-1-git-send-email-zhangshengju@cmss.chinamobile.com>
From: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Date: Tue, 12 Sep 2017 09:32:45 +0800
> Dummy device name is enumerated by the kernel, let user space be aware
> of the naming scheme used by dummy devices:
> (visible in /sys/class/net/<iface>/name_assign_type).
>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Applied.
^ permalink raw reply
* [PATCH v2] net: stmmac: dwmac-sun8i: Use reset exclusive
From: Corentin Labbe @ 2017-09-18 18:30 UTC (permalink / raw)
To: peppe.cavallaro, alexandre.torgue, maxime.ripard, wens
Cc: netdev, linux-arm-kernel, linux-kernel, Corentin Labbe
The current dwmac_sun8i module cannot be rmmod/modprobe due to that
the reset controller was not released when removed.
This patch remove ambiguity, by using of_reset_control_get_exclusive and
add the missing reset_control_put().
Note that we cannot use devm_reset_control_get, since the reset is not
in the device node.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
Changes since v1:
- added a note about devm_reset_control_get in commit message
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 57bb6dd7b401..1736d7cb0d96 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -854,6 +854,7 @@ static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
clk_disable_unprepare(gmac->ephy_clk);
reset_control_assert(gmac->rst_ephy);
+ reset_control_put(gmac->rst_ephy);
return 0;
}
@@ -1010,7 +1011,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
return -EINVAL;
}
- gmac->rst_ephy = of_reset_control_get(plat_dat->phy_node, NULL);
+ gmac->rst_ephy = of_reset_control_get_exclusive(plat_dat->phy_node, NULL);
if (IS_ERR(gmac->rst_ephy)) {
ret = PTR_ERR(gmac->rst_ephy);
if (ret == -EPROBE_DEFER)
--
2.13.5
^ permalink raw reply related
* Re: [PATCH] ravb: document R8A77970 bindings
From: David Miller @ 2017-09-18 18:38 UTC (permalink / raw)
To: sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, mark.rutland-5wv7dgnIgG8,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20170912200228.015376134-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
From: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
Date: Tue, 12 Sep 2017 23:02:08 +0300
> R-Car V3M (R8A77970) SoC also has the R-Car gen3 compatible EtherAVB
> device, so document the SoC specific bindings.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
Applied to net-next.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* net-next is OPEN...
From: David Miller @ 2017-09-18 18:39 UTC (permalink / raw)
To: netdev
http://vger.kernel.org/~davem/net-next.html
^ permalink raw reply
* Re: [PATCH] net: Convert int functions to bool
From: David Miller @ 2017-09-18 18:40 UTC (permalink / raw)
To: joe; +Cc: kuznet, yoshfuji, netdev, linux-kernel
In-Reply-To: <f9e044957a949f10d472a48437f62649ea57f858.1505336212.git.joe@perches.com>
From: Joe Perches <joe@perches.com>
Date: Wed, 13 Sep 2017 13:58:15 -0700
> Global function ipv6_rcv_saddr_equal and static functions
> ipv6_rcv_saddr_equal and ipv4_rcv_saddr_equal currently return int.
>
> bool is slightly more descriptive for these functions so change
> their return type from int to bool.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.
^ permalink raw reply
* Re: [PATCH] dt-bindings: net: renesas-ravb: Add support for R8A77995 RAVB
From: David Miller @ 2017-09-18 18:41 UTC (permalink / raw)
To: yoshihiro.shimoda.uh
Cc: robh+dt, mark.rutland, netdev, linux-renesas-soc, devicetree
In-Reply-To: <1505347598-4156-1-git-send-email-yoshihiro.shimoda.uh@renesas.com>
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date: Thu, 14 Sep 2017 09:06:38 +0900
> Add a new compatible string for the R8A77995 (R-Car D3) RAVB.
>
> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH net] udpv6: Fix the checksum computation when HW checksum does not apply
From: David Miller @ 2017-09-18 18:43 UTC (permalink / raw)
To: subashab; +Cc: netdev, vyasevic
In-Reply-To: <1505352651-14828-1-git-send-email-subashab@codeaurora.org>
From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Date: Wed, 13 Sep 2017 19:30:51 -0600
> While trying an ESP transport mode encryption for UDPv6 packets of
> datagram size 1436 with MTU 1500, checksum error was observed in
> the secondary fragment.
>
> This error occurs due to the UDP payload checksum being missed out
> when computing the full checksum for these packets in
> udp6_hwcsum_outgoing().
>
> Fixes: d39d938c8228 ("ipv6: Introduce udpv6_send_skb()")
> Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Good catch, applied and queued up for -stable.
^ permalink raw reply
* cross namespace interface notification for tun devices
From: Jason A. Donenfeld @ 2017-09-18 18:47 UTC (permalink / raw)
To: Netdev; +Cc: Mathias
Hey guys,
It's possible to create a tun device in a process in namespace A and
then move that interface to namespace B. The controlling process in A
needs to receive notifications on when the interface is brought up or
down. It can receive these notifications via netlink while the
interface lives in A but not when it moves to B.
Any tricks or APIs to get around this?
The best I've come up with is, in a sleep loop, writing to the tun
device's fd something with a NULL or invalid payload. If the interface
is down, the kernel returns -EIO. If the interface is up, the kernel
returns -EFAULT. This seems to be a reliable distinguisher, but is a
pretty insane way of doing it. And sleep loops are somewhat different
from events too.
If there aren't any current APIs for receiving events directly from
the fd of a tun interface, would this list be happy with a patch that
adds one?
Thanks,
Jason
^ permalink raw reply
* [PATCH net-next 0/7] net: speedup netns create/delete time
From: Eric Dumazet @ 2017-09-18 19:07 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric W . Biederman, Eric Dumazet, Eric Dumazet
When rate of netns creation/deletion is high enough,
we observe softlockups in cleanup_net() caused by huge list
of netns and way too many rcu_barrier() calls.
This patch series does some optimizations in kobject,
and add batching to tunnels so that netns dismantles are
less costly.
IPv6 addrlabels also get a per netns list, and tcp_metrics
also benefit from batch flushing.
This gives me one order of magnitude gain.
(~50 ms -> ~5 ms for one netns create/delete pair)
Tested:
for i in `seq 1 40`
do
(for j in `seq 1 100` ; do unshare -n /bin/true >/dev/null ; done) &
done
wait ; grep net_namespace /proc/slabinfo
Before patch series :
$ time ./add_del_unshare.sh
net_namespace 116 258 5504 1 2 : tunables 8 4 0 : slabdata 116 258 0
real 3m24.910s
user 0m0.747s
sys 0m43.162s
After :
$ time ./add_del_unshare.sh
net_namespace 135 291 5504 1 2 : tunables 8 4 0 : slabdata 135 291 0
real 0m22.117s
user 0m0.728s
sys 0m35.328s
Eric Dumazet (7):
kobject: add kobject_uevent_net_broadcast()
kobject: copy env blob in one go
kobject: factorize skb setup in kobject_uevent_net_broadcast()
ipv6: addrlabel: per netns list
tcp: batch tcp_net_metrics_exit
ipv6: speedup ipv6 tunnels dismantle
ipv4: speedup ipv6 tunnels dismantle
include/net/ip_tunnels.h | 3 +-
include/net/netns/ipv6.h | 5 +++
lib/kobject_uevent.c | 95 ++++++++++++++++++++++++++----------------------
net/ipv4/ip_gre.c | 22 +++++------
net/ipv4/ip_tunnel.c | 13 +++++--
net/ipv4/ip_vti.c | 7 ++--
net/ipv4/ipip.c | 7 ++--
net/ipv4/tcp_metrics.c | 14 ++++---
net/ipv6/addrlabel.c | 81 +++++++++++++++--------------------------
net/ipv6/ip6_gre.c | 8 ++--
net/ipv6/ip6_tunnel.c | 20 +++++-----
net/ipv6/ip6_vti.c | 23 +++++++-----
net/ipv6/sit.c | 9 +++--
13 files changed, 159 insertions(+), 148 deletions(-)
--
2.14.1.690.gbb1197296e-goog
^ permalink raw reply
* [PATCH net-next 1/7] kobject: add kobject_uevent_net_broadcast()
From: Eric Dumazet @ 2017-09-18 19:07 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric W . Biederman, Eric Dumazet, Eric Dumazet
In-Reply-To: <20170918190733.26272-1-edumazet@google.com>
This removes some #ifdef pollution and will ease follow up patches.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
lib/kobject_uevent.c | 96 +++++++++++++++++++++++++++++-----------------------
1 file changed, 53 insertions(+), 43 deletions(-)
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index e590523ea4761425df5e112a2c2aab873dbaa90d..4f48cc3b11d566e44c4115cc7716bc3b1cdf96df 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -294,6 +294,57 @@ static void cleanup_uevent_env(struct subprocess_info *info)
}
#endif
+static int kobject_uevent_net_broadcast(struct kobject *kobj,
+ struct kobj_uevent_env *env,
+ const char *action_string,
+ const char *devpath)
+{
+ int retval = 0;
+#if defined(CONFIG_NET)
+ struct uevent_sock *ue_sk;
+
+ /* send netlink message */
+ list_for_each_entry(ue_sk, &uevent_sock_list, list) {
+ struct sock *uevent_sock = ue_sk->sk;
+ struct sk_buff *skb;
+ size_t len;
+
+ if (!netlink_has_listeners(uevent_sock, 1))
+ continue;
+
+ /* allocate message with the maximum possible size */
+ len = strlen(action_string) + strlen(devpath) + 2;
+ skb = alloc_skb(len + env->buflen, GFP_KERNEL);
+ if (skb) {
+ char *scratch;
+ int i;
+
+ /* add header */
+ scratch = skb_put(skb, len);
+ sprintf(scratch, "%s@%s", action_string, devpath);
+
+ /* copy keys to our continuous event payload buffer */
+ for (i = 0; i < env->envp_idx; i++) {
+ len = strlen(env->envp[i]) + 1;
+ scratch = skb_put(skb, len);
+ strcpy(scratch, env->envp[i]);
+ }
+
+ NETLINK_CB(skb).dst_group = 1;
+ retval = netlink_broadcast_filtered(uevent_sock, skb,
+ 0, 1, GFP_KERNEL,
+ kobj_bcast_filter,
+ kobj);
+ /* ENOBUFS should be handled in userspace */
+ if (retval == -ENOBUFS || retval == -ESRCH)
+ retval = 0;
+ } else
+ retval = -ENOMEM;
+ }
+#endif
+ return retval;
+}
+
/**
* kobject_uevent_env - send an uevent with environmental data
*
@@ -316,9 +367,6 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
const struct kset_uevent_ops *uevent_ops;
int i = 0;
int retval = 0;
-#ifdef CONFIG_NET
- struct uevent_sock *ue_sk;
-#endif
pr_debug("kobject: '%s' (%p): %s\n",
kobject_name(kobj), kobj, __func__);
@@ -427,46 +475,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
mutex_unlock(&uevent_sock_mutex);
goto exit;
}
-
-#if defined(CONFIG_NET)
- /* send netlink message */
- list_for_each_entry(ue_sk, &uevent_sock_list, list) {
- struct sock *uevent_sock = ue_sk->sk;
- struct sk_buff *skb;
- size_t len;
-
- if (!netlink_has_listeners(uevent_sock, 1))
- continue;
-
- /* allocate message with the maximum possible size */
- len = strlen(action_string) + strlen(devpath) + 2;
- skb = alloc_skb(len + env->buflen, GFP_KERNEL);
- if (skb) {
- char *scratch;
-
- /* add header */
- scratch = skb_put(skb, len);
- sprintf(scratch, "%s@%s", action_string, devpath);
-
- /* copy keys to our continuous event payload buffer */
- for (i = 0; i < env->envp_idx; i++) {
- len = strlen(env->envp[i]) + 1;
- scratch = skb_put(skb, len);
- strcpy(scratch, env->envp[i]);
- }
-
- NETLINK_CB(skb).dst_group = 1;
- retval = netlink_broadcast_filtered(uevent_sock, skb,
- 0, 1, GFP_KERNEL,
- kobj_bcast_filter,
- kobj);
- /* ENOBUFS should be handled in userspace */
- if (retval == -ENOBUFS || retval == -ESRCH)
- retval = 0;
- } else
- retval = -ENOMEM;
- }
-#endif
+ retval = kobject_uevent_net_broadcast(kobj, env, action_string,
+ devpath);
mutex_unlock(&uevent_sock_mutex);
#ifdef CONFIG_UEVENT_HELPER
--
2.14.1.690.gbb1197296e-goog
^ permalink raw reply related
* [PATCH net-next 2/7] kobject: copy env blob in one go
From: Eric Dumazet @ 2017-09-18 19:07 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric W . Biederman, Eric Dumazet, Eric Dumazet
In-Reply-To: <20170918190733.26272-1-edumazet@google.com>
No need to iterate over strings, just copy in one efficient memcpy() call.
Tested:
time perf record "(for f in `seq 1 3000` ; do ip netns add tast$f; done)"
[ perf record: Woken up 10 times to write data ]
[ perf record: Captured and wrote 8.224 MB perf.data (~359301 samples) ]
real 0m52.554s # instead of 1m7.492s
user 0m0.309s
sys 0m51.375s # instead of 1m6.875s
9.88% ip [kernel.kallsyms] [k] netlink_broadcast_filtered
8.86% ip [kernel.kallsyms] [k] string
7.37% ip [kernel.kallsyms] [k] __ip6addrlbl_add
5.68% ip [kernel.kallsyms] [k] netlink_has_listeners
5.52% ip [kernel.kallsyms] [k] memcpy_erms
4.76% ip [kernel.kallsyms] [k] __alloc_skb
4.54% ip [kernel.kallsyms] [k] vsnprintf
3.94% ip [kernel.kallsyms] [k] format_decode
3.80% ip [kernel.kallsyms] [k] kmem_cache_alloc_node_trace
3.71% ip [kernel.kallsyms] [k] kmem_cache_alloc_node
3.66% ip [kernel.kallsyms] [k] kobject_uevent_env
3.38% ip [kernel.kallsyms] [k] strlen
2.65% ip [kernel.kallsyms] [k] _raw_spin_lock_irqsave
2.20% ip [kernel.kallsyms] [k] kfree
2.09% ip [kernel.kallsyms] [k] memset_erms
2.07% ip [kernel.kallsyms] [k] ___cache_free
1.95% ip [kernel.kallsyms] [k] kmem_cache_free
1.91% ip [kernel.kallsyms] [k] _raw_read_lock
1.45% ip [kernel.kallsyms] [k] ksize
1.25% ip [kernel.kallsyms] [k] _raw_spin_unlock_irqrestore
1.00% ip [kernel.kallsyms] [k] widen_string
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
lib/kobject_uevent.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 4f48cc3b11d566e44c4115cc7716bc3b1cdf96df..cb5102d638452ea6c03d12e61ea8c55c9dd72675 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -317,18 +317,13 @@ static int kobject_uevent_net_broadcast(struct kobject *kobj,
skb = alloc_skb(len + env->buflen, GFP_KERNEL);
if (skb) {
char *scratch;
- int i;
/* add header */
scratch = skb_put(skb, len);
sprintf(scratch, "%s@%s", action_string, devpath);
- /* copy keys to our continuous event payload buffer */
- for (i = 0; i < env->envp_idx; i++) {
- len = strlen(env->envp[i]) + 1;
- scratch = skb_put(skb, len);
- strcpy(scratch, env->envp[i]);
- }
+ scratch = skb_put(skb, env->buflen);
+ memcpy(scratch, env->buf, env->buflen);
NETLINK_CB(skb).dst_group = 1;
retval = netlink_broadcast_filtered(uevent_sock, skb,
--
2.14.1.690.gbb1197296e-goog
^ permalink raw reply related
* [PATCH net-next 3/7] kobject: factorize skb setup in kobject_uevent_net_broadcast()
From: Eric Dumazet @ 2017-09-18 19:07 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric W . Biederman, Eric Dumazet, Eric Dumazet
In-Reply-To: <20170918190733.26272-1-edumazet@google.com>
We can build one skb and let it be cloned in netlink.
This is much faster, and use less memory (all clones will
share the same skb->head)
Tested:
time perf record (for f in `seq 1 3000` ; do ip netns add tast$f; done)
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 4.110 MB perf.data (~179584 samples) ]
real 0m24.227s # instead of 0m52.554s
user 0m0.329s
sys 0m23.753s # instead of 0m51.375s
14.77% ip [kernel.kallsyms] [k] __ip6addrlbl_add
14.56% ip [kernel.kallsyms] [k] netlink_broadcast_filtered
11.65% ip [kernel.kallsyms] [k] netlink_has_listeners
6.19% ip [kernel.kallsyms] [k] _raw_spin_lock_irqsave
5.66% ip [kernel.kallsyms] [k] kobject_uevent_env
4.97% ip [kernel.kallsyms] [k] memset_erms
4.67% ip [kernel.kallsyms] [k] refcount_sub_and_test
4.41% ip [kernel.kallsyms] [k] _raw_read_lock
3.59% ip [kernel.kallsyms] [k] refcount_inc_not_zero
3.13% ip [kernel.kallsyms] [k] _raw_spin_unlock_irqrestore
1.55% ip [kernel.kallsyms] [k] __wake_up
1.20% ip [kernel.kallsyms] [k] strlen
1.03% ip [kernel.kallsyms] [k] __wake_up_common
0.93% ip [kernel.kallsyms] [k] consume_skb
0.92% ip [kernel.kallsyms] [k] netlink_trim
0.87% ip [kernel.kallsyms] [k] insert_header
0.63% ip [kernel.kallsyms] [k] unmap_page_range
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
lib/kobject_uevent.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index cb5102d638452ea6c03d12e61ea8c55c9dd72675..05166f3a2528f2aa915405675c6662579e67de52 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -301,23 +301,26 @@ static int kobject_uevent_net_broadcast(struct kobject *kobj,
{
int retval = 0;
#if defined(CONFIG_NET)
+ struct sk_buff *skb = NULL;
struct uevent_sock *ue_sk;
/* send netlink message */
list_for_each_entry(ue_sk, &uevent_sock_list, list) {
struct sock *uevent_sock = ue_sk->sk;
- struct sk_buff *skb;
- size_t len;
if (!netlink_has_listeners(uevent_sock, 1))
continue;
- /* allocate message with the maximum possible size */
- len = strlen(action_string) + strlen(devpath) + 2;
- skb = alloc_skb(len + env->buflen, GFP_KERNEL);
- if (skb) {
+ if (!skb) {
+ /* allocate message with the maximum possible size */
+ size_t len = strlen(action_string) + strlen(devpath) + 2;
char *scratch;
+ retval = -ENOMEM;
+ skb = alloc_skb(len + env->buflen, GFP_KERNEL);
+ if (!skb)
+ continue;
+
/* add header */
scratch = skb_put(skb, len);
sprintf(scratch, "%s@%s", action_string, devpath);
@@ -326,16 +329,17 @@ static int kobject_uevent_net_broadcast(struct kobject *kobj,
memcpy(scratch, env->buf, env->buflen);
NETLINK_CB(skb).dst_group = 1;
- retval = netlink_broadcast_filtered(uevent_sock, skb,
- 0, 1, GFP_KERNEL,
- kobj_bcast_filter,
- kobj);
- /* ENOBUFS should be handled in userspace */
- if (retval == -ENOBUFS || retval == -ESRCH)
- retval = 0;
- } else
- retval = -ENOMEM;
+ }
+
+ retval = netlink_broadcast_filtered(uevent_sock, skb_get(skb),
+ 0, 1, GFP_KERNEL,
+ kobj_bcast_filter,
+ kobj);
+ /* ENOBUFS should be handled in userspace */
+ if (retval == -ENOBUFS || retval == -ESRCH)
+ retval = 0;
}
+ consume_skb(skb);
#endif
return retval;
}
--
2.14.1.690.gbb1197296e-goog
^ permalink raw reply related
* [PATCH net-next 4/7] ipv6: addrlabel: per netns list
From: Eric Dumazet @ 2017-09-18 19:07 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric W . Biederman, Eric Dumazet, Eric Dumazet
In-Reply-To: <20170918190733.26272-1-edumazet@google.com>
Having a global list of labels do not scale to thousands of
netns in the cloud era. This causes quadratic behavior on
netns creation and deletion.
This is time having a per netns list of ~10 labels.
Tested:
$ time perf record (for f in `seq 1 3000` ; do ip netns add tast$f; done)
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 3.637 MB perf.data (~158898 samples) ]
real 0m20.837s # instead of 0m24.227s
user 0m0.328s
sys 0m20.338s # instead of 0m23.753s
16.17% ip [kernel.kallsyms] [k] netlink_broadcast_filtered
12.30% ip [kernel.kallsyms] [k] netlink_has_listeners
6.76% ip [kernel.kallsyms] [k] _raw_spin_lock_irqsave
5.78% ip [kernel.kallsyms] [k] memset_erms
5.77% ip [kernel.kallsyms] [k] kobject_uevent_env
5.18% ip [kernel.kallsyms] [k] refcount_sub_and_test
4.96% ip [kernel.kallsyms] [k] _raw_read_lock
3.82% ip [kernel.kallsyms] [k] refcount_inc_not_zero
3.33% ip [kernel.kallsyms] [k] _raw_spin_unlock_irqrestore
2.11% ip [kernel.kallsyms] [k] unmap_page_range
1.77% ip [kernel.kallsyms] [k] __wake_up
1.69% ip [kernel.kallsyms] [k] strlen
1.17% ip [kernel.kallsyms] [k] __wake_up_common
1.09% ip [kernel.kallsyms] [k] insert_header
1.04% ip [kernel.kallsyms] [k] page_remove_rmap
1.01% ip [kernel.kallsyms] [k] consume_skb
0.98% ip [kernel.kallsyms] [k] netlink_trim
0.51% ip [kernel.kallsyms] [k] kernfs_link_sibling
0.51% ip [kernel.kallsyms] [k] filemap_map_pages
0.46% ip [kernel.kallsyms] [k] memcpy_erms
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/netns/ipv6.h | 5 +++
net/ipv6/addrlabel.c | 81 ++++++++++++++++++------------------------------
2 files changed, 35 insertions(+), 51 deletions(-)
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 2544f9760a4263b7f1b8d622331ca63038586137..2ea1ed341ef81901b4fa271b0f7f4592e17c4f8a 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -89,6 +89,11 @@ struct netns_ipv6 {
atomic_t fib6_sernum;
struct seg6_pernet_data *seg6_data;
struct fib_notifier_ops *notifier_ops;
+ struct {
+ struct hlist_head head;
+ spinlock_t lock;
+ u32 seq;
+ } ip6addrlbl_table;
};
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index b055bc79f56d555c89684116c1580984950f77a8..c6311d7108f651c7385cd6316752ba4a86667dcc 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -30,7 +30,6 @@
* Policy Table
*/
struct ip6addrlbl_entry {
- possible_net_t lbl_net;
struct in6_addr prefix;
int prefixlen;
int ifindex;
@@ -41,19 +40,6 @@ struct ip6addrlbl_entry {
struct rcu_head rcu;
};
-static struct ip6addrlbl_table
-{
- struct hlist_head head;
- spinlock_t lock;
- u32 seq;
-} ip6addrlbl_table;
-
-static inline
-struct net *ip6addrlbl_net(const struct ip6addrlbl_entry *lbl)
-{
- return read_pnet(&lbl->lbl_net);
-}
-
/*
* Default policy table (RFC6724 + extensions)
*
@@ -148,13 +134,10 @@ static inline void ip6addrlbl_put(struct ip6addrlbl_entry *p)
}
/* Find label */
-static bool __ip6addrlbl_match(struct net *net,
- const struct ip6addrlbl_entry *p,
+static bool __ip6addrlbl_match(const struct ip6addrlbl_entry *p,
const struct in6_addr *addr,
int addrtype, int ifindex)
{
- if (!net_eq(ip6addrlbl_net(p), net))
- return false;
if (p->ifindex && p->ifindex != ifindex)
return false;
if (p->addrtype && p->addrtype != addrtype)
@@ -169,8 +152,9 @@ static struct ip6addrlbl_entry *__ipv6_addr_label(struct net *net,
int type, int ifindex)
{
struct ip6addrlbl_entry *p;
- hlist_for_each_entry_rcu(p, &ip6addrlbl_table.head, list) {
- if (__ip6addrlbl_match(net, p, addr, type, ifindex))
+
+ hlist_for_each_entry_rcu(p, &net->ipv6.ip6addrlbl_table.head, list) {
+ if (__ip6addrlbl_match(p, addr, type, ifindex))
return p;
}
return NULL;
@@ -196,8 +180,7 @@ u32 ipv6_addr_label(struct net *net,
}
/* allocate one entry */
-static struct ip6addrlbl_entry *ip6addrlbl_alloc(struct net *net,
- const struct in6_addr *prefix,
+static struct ip6addrlbl_entry *ip6addrlbl_alloc(const struct in6_addr *prefix,
int prefixlen, int ifindex,
u32 label)
{
@@ -236,24 +219,23 @@ static struct ip6addrlbl_entry *ip6addrlbl_alloc(struct net *net,
newp->addrtype = addrtype;
newp->label = label;
INIT_HLIST_NODE(&newp->list);
- write_pnet(&newp->lbl_net, net);
refcount_set(&newp->refcnt, 1);
return newp;
}
/* add a label */
-static int __ip6addrlbl_add(struct ip6addrlbl_entry *newp, int replace)
+static int __ip6addrlbl_add(struct net *net, struct ip6addrlbl_entry *newp,
+ int replace)
{
- struct hlist_node *n;
struct ip6addrlbl_entry *last = NULL, *p = NULL;
+ struct hlist_node *n;
int ret = 0;
ADDRLABEL(KERN_DEBUG "%s(newp=%p, replace=%d)\n", __func__, newp,
replace);
- hlist_for_each_entry_safe(p, n, &ip6addrlbl_table.head, list) {
+ hlist_for_each_entry_safe(p, n, &net->ipv6.ip6addrlbl_table.head, list) {
if (p->prefixlen == newp->prefixlen &&
- net_eq(ip6addrlbl_net(p), ip6addrlbl_net(newp)) &&
p->ifindex == newp->ifindex &&
ipv6_addr_equal(&p->prefix, &newp->prefix)) {
if (!replace) {
@@ -273,10 +255,10 @@ static int __ip6addrlbl_add(struct ip6addrlbl_entry *newp, int replace)
if (last)
hlist_add_behind_rcu(&newp->list, &last->list);
else
- hlist_add_head_rcu(&newp->list, &ip6addrlbl_table.head);
+ hlist_add_head_rcu(&newp->list, &net->ipv6.ip6addrlbl_table.head);
out:
if (!ret)
- ip6addrlbl_table.seq++;
+ net->ipv6.ip6addrlbl_table.seq++;
return ret;
}
@@ -292,12 +274,12 @@ static int ip6addrlbl_add(struct net *net,
__func__, prefix, prefixlen, ifindex, (unsigned int)label,
replace);
- newp = ip6addrlbl_alloc(net, prefix, prefixlen, ifindex, label);
+ newp = ip6addrlbl_alloc(prefix, prefixlen, ifindex, label);
if (IS_ERR(newp))
return PTR_ERR(newp);
- spin_lock(&ip6addrlbl_table.lock);
- ret = __ip6addrlbl_add(newp, replace);
- spin_unlock(&ip6addrlbl_table.lock);
+ spin_lock(&net->ipv6.ip6addrlbl_table.lock);
+ ret = __ip6addrlbl_add(net, newp, replace);
+ spin_unlock(&net->ipv6.ip6addrlbl_table.lock);
if (ret)
ip6addrlbl_free(newp);
return ret;
@@ -315,9 +297,8 @@ static int __ip6addrlbl_del(struct net *net,
ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n",
__func__, prefix, prefixlen, ifindex);
- hlist_for_each_entry_safe(p, n, &ip6addrlbl_table.head, list) {
+ hlist_for_each_entry_safe(p, n, &net->ipv6.ip6addrlbl_table.head, list) {
if (p->prefixlen == prefixlen &&
- net_eq(ip6addrlbl_net(p), net) &&
p->ifindex == ifindex &&
ipv6_addr_equal(&p->prefix, prefix)) {
hlist_del_rcu(&p->list);
@@ -340,9 +321,9 @@ static int ip6addrlbl_del(struct net *net,
__func__, prefix, prefixlen, ifindex);
ipv6_addr_prefix(&prefix_buf, prefix, prefixlen);
- spin_lock(&ip6addrlbl_table.lock);
+ spin_lock(&net->ipv6.ip6addrlbl_table.lock);
ret = __ip6addrlbl_del(net, &prefix_buf, prefixlen, ifindex);
- spin_unlock(&ip6addrlbl_table.lock);
+ spin_unlock(&net->ipv6.ip6addrlbl_table.lock);
return ret;
}
@@ -354,6 +335,9 @@ static int __net_init ip6addrlbl_net_init(struct net *net)
ADDRLABEL(KERN_DEBUG "%s\n", __func__);
+ spin_lock_init(&net->ipv6.ip6addrlbl_table.lock);
+ INIT_HLIST_HEAD(&net->ipv6.ip6addrlbl_table.head);
+
for (i = 0; i < ARRAY_SIZE(ip6addrlbl_init_table); i++) {
int ret = ip6addrlbl_add(net,
ip6addrlbl_init_table[i].prefix,
@@ -373,14 +357,12 @@ static void __net_exit ip6addrlbl_net_exit(struct net *net)
struct hlist_node *n;
/* Remove all labels belonging to the exiting net */
- spin_lock(&ip6addrlbl_table.lock);
- hlist_for_each_entry_safe(p, n, &ip6addrlbl_table.head, list) {
- if (net_eq(ip6addrlbl_net(p), net)) {
- hlist_del_rcu(&p->list);
- ip6addrlbl_put(p);
- }
+ spin_lock(&net->ipv6.ip6addrlbl_table.lock);
+ hlist_for_each_entry_safe(p, n, &net->ipv6.ip6addrlbl_table.head, list) {
+ hlist_del_rcu(&p->list);
+ ip6addrlbl_put(p);
}
- spin_unlock(&ip6addrlbl_table.lock);
+ spin_unlock(&net->ipv6.ip6addrlbl_table.lock);
}
static struct pernet_operations ipv6_addr_label_ops = {
@@ -390,8 +372,6 @@ static struct pernet_operations ipv6_addr_label_ops = {
int __init ipv6_addr_label_init(void)
{
- spin_lock_init(&ip6addrlbl_table.lock);
-
return register_pernet_subsys(&ipv6_addr_label_ops);
}
@@ -510,11 +490,10 @@ static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb)
int err;
rcu_read_lock();
- hlist_for_each_entry_rcu(p, &ip6addrlbl_table.head, list) {
- if (idx >= s_idx &&
- net_eq(ip6addrlbl_net(p), net)) {
+ hlist_for_each_entry_rcu(p, &net->ipv6.ip6addrlbl_table.head, list) {
+ if (idx >= s_idx) {
err = ip6addrlbl_fill(skb, p,
- ip6addrlbl_table.seq,
+ net->ipv6.ip6addrlbl_table.seq,
NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq,
RTM_NEWADDRLABEL,
@@ -571,7 +550,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh,
p = __ipv6_addr_label(net, addr, ipv6_addr_type(addr), ifal->ifal_index);
if (p && !ip6addrlbl_hold(p))
p = NULL;
- lseq = ip6addrlbl_table.seq;
+ lseq = net->ipv6.ip6addrlbl_table.seq;
rcu_read_unlock();
if (!p) {
--
2.14.1.690.gbb1197296e-goog
^ permalink raw reply related
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