Re: [PATCH bpf-next v1 07/19] bpf: create anonymous bpf iterator

2020-04-28 Thread Andrii Nakryiko
On Mon, Apr 27, 2020 at 1:19 PM Yonghong Song wrote: > > A new bpf command BPF_ITER_CREATE is added. > > The anonymous bpf iterator is seq_file based. > The seq_file private data are referenced by targets. > The bpf_iter infrastructure allocated additional space > at seq_file->private after the sp

Re: linux-next: manual merge of the akpm-current tree with the bpf-next tree

2020-04-28 Thread Christoph Hellwig
On Tue, Apr 28, 2020 at 11:49:34PM -0700, Alexei Starovoitov wrote: > On Tue, Apr 28, 2020 at 11:47 PM Christoph Hellwig wrote: > > > > On Wed, Apr 29, 2020 at 04:45:07PM +1000, Stephen Rothwell wrote: > > > Hi all, > > > > > > Today's linux-next merge of the akpm-current tree got a conflict in: >

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Yonghong Song
On 4/28/20 11:34 PM, Martin KaFai Lau wrote: On Tue, Apr 28, 2020 at 11:20:30PM -0700, Yonghong Song wrote: On 4/28/20 11:08 PM, Andrii Nakryiko wrote: On Tue, Apr 28, 2020 at 10:10 PM Yonghong Song wrote: On 4/28/20 7:44 PM, Alexei Starovoitov wrote: On 4/28/20 6:15 PM, Yonghong Son

Re: linux-next: manual merge of the akpm-current tree with the bpf-next tree

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 11:47 PM Christoph Hellwig wrote: > > On Wed, Apr 29, 2020 at 04:45:07PM +1000, Stephen Rothwell wrote: > > Hi all, > > > > Today's linux-next merge of the akpm-current tree got a conflict in: > > > > kernel/sysctl.c > > > > between commit: > > > > f461d2dcd511 ("sysctl

Re: linux-next: manual merge of the akpm-current tree with the bpf-next tree

2020-04-28 Thread Christoph Hellwig
On Wed, Apr 29, 2020 at 04:45:07PM +1000, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the akpm-current tree got a conflict in: > > kernel/sysctl.c > > between commit: > > f461d2dcd511 ("sysctl: avoid forward declarations") > > from the bpf-next tree and commits: Hmm,

[PATCH v8 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
Add test for BPF_ENABLE_STATS, which should enable run_time_ns stats. ~/selftests/bpf# ./test_progs -t enable_stats -v test_enable_stats:PASS:skel_open_and_load 0 nsec test_enable_stats:PASS:get_stats_fd 0 nsec test_enable_stats:PASS:attach_raw_tp 0 nsec test_enable_stats:PASS:get_prog_info 0 nse

[PATCH v8 bpf-next 2/3] libbpf: add support for command BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
bpf_enable_stats() is added to enable given stats. Signed-off-by: Song Liu --- tools/lib/bpf/bpf.c | 10 ++ tools/lib/bpf/bpf.h | 1 + tools/lib/bpf/libbpf.map | 1 + 3 files changed, 12 insertions(+) diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 8f2f0958d446.

[PATCH v8 bpf-next 1/3] bpf: sharing bpf runtime stats with BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
Currently, sysctl kernel.bpf_stats_enabled controls BPF runtime stats. Typical userspace tools use kernel.bpf_stats_enabled as follows: 1. Enable kernel.bpf_stats_enabled; 2. Check program run_time_ns; 3. Sleep for the monitoring period; 4. Check program run_time_ns again, calculate the di

linux-next: manual merge of the akpm-current tree with the bpf-next tree

2020-04-28 Thread Stephen Rothwell
Hi all, Today's linux-next merge of the akpm-current tree got a conflict in: kernel/sysctl.c between commit: f461d2dcd511 ("sysctl: avoid forward declarations") from the bpf-next tree and commits: 0fe73f87ba37 ("parisc: add sysctl file interface panic_on_stackoverflow") 631b6d13906c (

[PATCH v8 bpf-next 0/3] bpf: sharing bpf runtime stats with

2020-04-28 Thread Song Liu
run_time_ns is a useful stats for BPF programs. However, it is gated by sysctl kernel.bpf_stats_enabled. When multiple user space tools are toggling kernl.bpf_stats_enabled at the same time, they may confuse each other. Solve this problem with a new BPF command BPF_ENABLE_STATS. Changes v7 => v8:

Re: [iproute2 v3] devlink: add support for DEVLINK_CMD_REGION_NEW

2020-04-28 Thread Jiri Pirko
Tue, Apr 28, 2020 at 10:43:24PM CEST, jacob.e.kel...@intel.com wrote: >Add support to request that a new snapshot be taken immediately for >a devlink region. To avoid confusion, the desired snapshot id must be >provided. > >Note that if a region does not support snapshots on demand, the kernel >wil

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Yonghong Song
On 4/28/20 11:40 PM, Andrii Nakryiko wrote: On Tue, Apr 28, 2020 at 11:30 PM Alexei Starovoitov wrote: On 4/28/20 11:20 PM, Yonghong Song wrote: On 4/28/20 11:08 PM, Andrii Nakryiko wrote: On Tue, Apr 28, 2020 at 10:10 PM Yonghong Song wrote: On 4/28/20 7:44 PM, Alexei Starovoitov

Re: [PATCH bpf-next v1 06/19] bpf: support bpf tracing/iter programs for BPF_LINK_UPDATE

2020-04-28 Thread Martin KaFai Lau
On Tue, Apr 28, 2020 at 11:32:15PM -0700, Andrii Nakryiko wrote: > On Tue, Apr 28, 2020 at 10:59 PM Martin KaFai Lau wrote: > > > > On Tue, Apr 28, 2020 at 10:04:54PM -0700, Yonghong Song wrote: > > > > > > > > > On 4/28/20 6:32 PM, Martin KaFai Lau wrote: > > > > On Mon, Apr 27, 2020 at 01:12:41P

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Andrii Nakryiko
On Tue, Apr 28, 2020 at 11:30 PM Alexei Starovoitov wrote: > > On 4/28/20 11:20 PM, Yonghong Song wrote: > > > > > > On 4/28/20 11:08 PM, Andrii Nakryiko wrote: > >> On Tue, Apr 28, 2020 at 10:10 PM Yonghong Song wrote: > >>> > >>> > >>> > >>> On 4/28/20 7:44 PM, Alexei Starovoitov wrote: >

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Martin KaFai Lau
On Tue, Apr 28, 2020 at 11:20:30PM -0700, Yonghong Song wrote: > > > On 4/28/20 11:08 PM, Andrii Nakryiko wrote: > > On Tue, Apr 28, 2020 at 10:10 PM Yonghong Song wrote: > > > > > > > > > > > > On 4/28/20 7:44 PM, Alexei Starovoitov wrote: > > > > On 4/28/20 6:15 PM, Yonghong Song wrote: > >

Re: [PATCH bpf-next v1 06/19] bpf: support bpf tracing/iter programs for BPF_LINK_UPDATE

2020-04-28 Thread Andrii Nakryiko
On Tue, Apr 28, 2020 at 10:59 PM Martin KaFai Lau wrote: > > On Tue, Apr 28, 2020 at 10:04:54PM -0700, Yonghong Song wrote: > > > > > > On 4/28/20 6:32 PM, Martin KaFai Lau wrote: > > > On Mon, Apr 27, 2020 at 01:12:41PM -0700, Yonghong Song wrote: > > > > Added BPF_LINK_UPDATE support for tracing

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Alexei Starovoitov
On 4/28/20 11:20 PM, Yonghong Song wrote: On 4/28/20 11:08 PM, Andrii Nakryiko wrote: On Tue, Apr 28, 2020 at 10:10 PM Yonghong Song wrote: On 4/28/20 7:44 PM, Alexei Starovoitov wrote: On 4/28/20 6:15 PM, Yonghong Song wrote: On 4/28/20 5:48 PM, Alexei Starovoitov wrote: On 4/28/20

Re: [PATCH bpf-next v1 05/19] bpf: support bpf tracing/iter programs for BPF_LINK_CREATE

2020-04-28 Thread Andrii Nakryiko
On Mon, Apr 27, 2020 at 1:13 PM Yonghong Song wrote: > > Given a bpf program, the step to create an anonymous bpf iterator is: > - create a bpf_iter_link, which combines bpf program and the target. > In the future, there could be more information recorded in the link. > A link_fd will be

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Yonghong Song
On 4/28/20 11:08 PM, Andrii Nakryiko wrote: On Tue, Apr 28, 2020 at 10:10 PM Yonghong Song wrote: On 4/28/20 7:44 PM, Alexei Starovoitov wrote: On 4/28/20 6:15 PM, Yonghong Song wrote: On 4/28/20 5:48 PM, Alexei Starovoitov wrote: On 4/28/20 5:37 PM, Martin KaFai Lau wrote: +pro

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Andrii Nakryiko
On Tue, Apr 28, 2020 at 10:10 PM Yonghong Song wrote: > > > > On 4/28/20 7:44 PM, Alexei Starovoitov wrote: > > On 4/28/20 6:15 PM, Yonghong Song wrote: > >> > >> > >> On 4/28/20 5:48 PM, Alexei Starovoitov wrote: > >>> On 4/28/20 5:37 PM, Martin KaFai Lau wrote: > > +prog = bpf_iter_get_p

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Andrii Nakryiko
On Mon, Apr 27, 2020 at 1:18 PM Yonghong Song wrote: > > The bpf_map iterator is implemented. > The bpf program is called at seq_ops show() and stop() functions. > bpf_iter_get_prog() will retrieve bpf program and other > parameters during seq_file object traversal. In show() function, > bpf progr

Re: [PATCH bpf-next v1 06/19] bpf: support bpf tracing/iter programs for BPF_LINK_UPDATE

2020-04-28 Thread Martin KaFai Lau
On Tue, Apr 28, 2020 at 10:04:54PM -0700, Yonghong Song wrote: > > > On 4/28/20 6:32 PM, Martin KaFai Lau wrote: > > On Mon, Apr 27, 2020 at 01:12:41PM -0700, Yonghong Song wrote: > > > Added BPF_LINK_UPDATE support for tracing/iter programs. > > > This way, a file based bpf iterator, which holds

Re: [PATCH net-next] devlink: let kernel allocate region snapshot id

2020-04-28 Thread Jiri Pirko
Wed, Apr 29, 2020 at 03:42:48AM CEST, k...@kernel.org wrote: >Currently users have to choose a free snapshot id before >calling DEVLINK_CMD_REGION_NEW. This is potentially racy >and inconvenient. > >Make the DEVLINK_ATTR_REGION_SNAPSHOT_ID optional and try >to allocate id automatically. Send a mess

Re: [PATCH bpf-next v1 07/19] bpf: create anonymous bpf iterator

2020-04-28 Thread Martin KaFai Lau
On Mon, Apr 27, 2020 at 01:12:42PM -0700, Yonghong Song wrote: > A new bpf command BPF_ITER_CREATE is added. > > The anonymous bpf iterator is seq_file based. > The seq_file private data are referenced by targets. > The bpf_iter infrastructure allocated additional space > at seq_file->private afte

Re: [PATCH bpf-next v1 01/19] net: refactor net assignment for seq_net_private structure

2020-04-28 Thread Andrii Nakryiko
On Mon, Apr 27, 2020 at 1:13 PM Yonghong Song wrote: > > Refactor assignment of "net" in seq_net_private structure > in proc_net.c to a helper function. The helper later will > be used by bpfdump. typo: bpfdump -> bpf_iter ? Otherwise: Acked-by: Andrii Nakryiko > > Signed-off-by: Yonghong Son

Re: [net-next PATCH v2 0/3] Introduce new APIs to support phylink and phy layers

2020-04-28 Thread Calvin Johnson
On Mon, Apr 27, 2020 at 03:48:07PM +0100, Russell King - ARM Linux admin wrote: > On Mon, Apr 27, 2020 at 08:02:38PM +0530, Calvin Johnson wrote: > > On Mon, Apr 27, 2020 at 02:58:20PM +0100, Russell King - ARM Linux admin > > wrote: > > > On Mon, Apr 27, 2020 at 06:54:06PM +0530, Calvin Johnson w

Re: [PATCH v7 bpf-next 2/3] libbpf: add support for command BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
> On Apr 28, 2020, at 10:32 PM, Andrii Nakryiko > wrote: > > On Tue, Apr 28, 2020 at 8:59 PM Song Liu wrote: >> >> bpf_enable_stats() is added to enable given stats. >> >> Signed-off-by: Song Liu >> --- >> tools/lib/bpf/bpf.c | 10 ++ >> tools/lib/bpf/bpf.h | 1 + >> tool

RE: [PATCH bpf-next] bpf: bpf_{g,s}etsockopt for struct bpf_sock

2020-04-28 Thread John Fastabend
Stanislav Fomichev wrote: > Currently, bpf_getsocktop and bpf_setsockopt helpers operate on the > 'struct bpf_sock_ops' context in BPF_PROG_TYPE_CGROUP_SOCKOPT program. > Let's generalize them and make the first argument be 'struct bpf_sock'. > That way, in the future, we can allow those helpers in

Re: [PATCH v7 bpf-next 2/3] libbpf: add support for command BPF_ENABLE_STATS

2020-04-28 Thread Andrii Nakryiko
On Tue, Apr 28, 2020 at 8:59 PM Song Liu wrote: > > bpf_enable_stats() is added to enable given stats. > > Signed-off-by: Song Liu > --- > tools/lib/bpf/bpf.c | 10 ++ > tools/lib/bpf/bpf.h | 1 + > tools/lib/bpf/libbpf.map | 5 + > 3 files changed, 16 insertions(+) > > d

Re: [PATCH v7 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
> On Apr 28, 2020, at 9:57 PM, Alexei Starovoitov > wrote: > > On Tue, Apr 28, 2020 at 08:58:41PM -0700, Song Liu wrote: >> + >> +skel = test_enable_stats__open_and_load(); >> +if (CHECK(!skel, "skel_open_and_load", "skeleton open/load failed\n")) >> +return; >> + >> +

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Yonghong Song
On 4/28/20 7:44 PM, Alexei Starovoitov wrote: On 4/28/20 6:15 PM, Yonghong Song wrote: On 4/28/20 5:48 PM, Alexei Starovoitov wrote: On 4/28/20 5:37 PM, Martin KaFai Lau wrote: +    prog = bpf_iter_get_prog(seq, sizeof(struct bpf_iter_seq_map_info), + &meta.session_id, &m

Re: [PATCH bpf-next v1 06/19] bpf: support bpf tracing/iter programs for BPF_LINK_UPDATE

2020-04-28 Thread Yonghong Song
On 4/28/20 6:32 PM, Martin KaFai Lau wrote: On Mon, Apr 27, 2020 at 01:12:41PM -0700, Yonghong Song wrote: Added BPF_LINK_UPDATE support for tracing/iter programs. This way, a file based bpf iterator, which holds a reference to the link, can have its bpf program updated without creating new f

Re: [PATCH v7 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 08:58:41PM -0700, Song Liu wrote: > + > + skel = test_enable_stats__open_and_load(); > + if (CHECK(!skel, "skel_open_and_load", "skeleton open/load failed\n")) > + return; > + > + stats_fd = bpf_enable_stats(BPF_STATS_RUNTIME_CNT); Just realized that

Re: [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c

2020-04-28 Thread Rylan Dmello
On Tue, Apr 28, 2020 at 09:31:10PM -0700, Joe Perches wrote: > On Wed, 2020-04-29 at 00:04 -0400, Rylan Dmello wrote: > > Fix checkpatch.pl warnings: > > > > WARNING: Avoid multiple line dereference - prefer 'qdev->func' > > WARNING: Avoid multiple line dereference - prefer 'qdev->flags' > >

Re: [PATCH v4 1/4] dt-bindings: net: phy: Add support for NXP TJA11xx

2020-04-28 Thread Florian Fainelli
On 4/28/2020 9:38 PM, Oleksij Rempel wrote: > @Rob, thank you for the review. > > @David, should I send fixes or reworked initial patches? You need to send incremental patches, once David applies the patches, they are part of the git history for the trees he maintains. -- Florian

Re: [PATCH v7 bpf-next 1/3] bpf: sharing bpf runtime stats with BPF_ENABLE_STATS

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 08:58:39PM -0700, Song Liu wrote: > + > +static int bpf_enable_stats(union bpf_attr *attr) > +{ CHECK_ATTR() is missing which makes it non-extensible. > + switch (attr->enable_stats.type) { > + case BPF_STATS_RUNTIME_CNT: > + return bpf_enable_runtime_s

Re: [PATCH v4 1/4] dt-bindings: net: phy: Add support for NXP TJA11xx

2020-04-28 Thread Oleksij Rempel
@Rob, thank you for the review. @David, should I send fixes or reworked initial patches? On Tue, Apr 28, 2020 at 12:30:06PM -0500, Rob Herring wrote: > On Fri, Mar 13, 2020 at 12:23 AM Oleksij Rempel > wrote: > > > > Document the NXP TJA11xx PHY bindings. > > Given the discussion, I'd marked t

Re: [PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c

2020-04-28 Thread Joe Perches
On Wed, 2020-04-29 at 00:04 -0400, Rylan Dmello wrote: > Fix checkpatch.pl warnings: > > WARNING: Avoid multiple line dereference - prefer 'qdev->func' > WARNING: Avoid multiple line dereference - prefer 'qdev->flags' Assuming you are doing this for exercise: It'd be better to unindent all t

Re: [PATCH net-next v2 4/4] net: phy: bcm54140: add second PHY ID

2020-04-28 Thread Florian Fainelli
On 4/28/2020 4:06 PM, Michael Walle wrote: > This PHY has two PHY IDs depending on its mode. Adjust the mask so that > it includes both IDs. > > Signed-off-by: Michael Walle Reviewed-by: Florian Fainelli For future submissions to netdev, if you have a patch count > 1, please include a cover

[PATCH -next v2] hinic: Use ARRAY_SIZE for nic_vf_cmd_msg_handler

2020-04-28 Thread Zou Wei
fix coccinelle warning, use ARRAY_SIZE drivers/net/ethernet/huawei/hinic/hinic_sriov.c:713:43-44: WARNING: Use ARRAY_SIZE -- v1-->v2: remove cmd_number Reported-by: Hulk Robot Signed-off-by: Zou Wei --- drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 8 +++- 1 file changed,

[PATCH 3/3] staging: qlge: Fix function argument alignment warning in qlge_main.c

2020-04-28 Thread Rylan Dmello
Fix checkpatch.pl check: CHECK: Alignment should match open parenthesis Signed-off-by: Rylan Dmello --- drivers/staging/qlge/qlge_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.c index 0edeea525f

[PATCH 2/3] staging: qlge: Fix suspect indentation warning in qlge_main.c

2020-04-28 Thread Rylan Dmello
Fix checkpatch.pl warning: WARNING: suspect code indent for conditional statements (16, 23) Signed-off-by: Rylan Dmello --- drivers/staging/qlge/qlge_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/qlge/qlge_main.c b/drivers/staging/qlge/qlge_main.

[PATCH 1/3] staging: qlge: Remove multi-line dereferences from qlge_main.c

2020-04-28 Thread Rylan Dmello
Fix checkpatch.pl warnings: WARNING: Avoid multiple line dereference - prefer 'qdev->func' WARNING: Avoid multiple line dereference - prefer 'qdev->flags' Signed-off-by: Rylan Dmello --- drivers/staging/qlge/qlge_main.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --

[PATCH v7 bpf-next 1/3] bpf: sharing bpf runtime stats with BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
Currently, sysctl kernel.bpf_stats_enabled controls BPF runtime stats. Typical userspace tools use kernel.bpf_stats_enabled as follows: 1. Enable kernel.bpf_stats_enabled; 2. Check program run_time_ns; 3. Sleep for the monitoring period; 4. Check program run_time_ns again, calculate the di

[PATCH v7 bpf-next 0/3] bpf: sharing bpf runtime stats with

2020-04-28 Thread Song Liu
run_time_ns is a useful stats for BPF programs. However, it is gated by sysctl kernel.bpf_stats_enabled. When multiple user space tools are toggling kernl.bpf_stats_enabled at the same time, they may confuse each other. Solve this problem with a new BPF command BPF_ENABLE_STATS. Changes v6 => v7:

[PATCH v7 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
Add test for BPF_ENABLE_STATS, which should enable run_time_ns stats. ~/selftests/bpf# ./test_progs -t enable_stats -v test_enable_stats:PASS:skel_open_and_load 0 nsec test_enable_stats:PASS:get_stats_fd 0 nsec test_enable_stats:PASS:attach_raw_tp 0 nsec test_enable_stats:PASS:get_prog_info 0 nse

[PATCH v7 bpf-next 2/3] libbpf: add support for command BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
bpf_enable_stats() is added to enable given stats. Signed-off-by: Song Liu --- tools/lib/bpf/bpf.c | 10 ++ tools/lib/bpf/bpf.h | 1 + tools/lib/bpf/libbpf.map | 5 + 3 files changed, 16 insertions(+) diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 5cc1b0785

Re: [PATCH -next] hinic: Use ARRAY_SIZE for nic_vf_cmd_msg_handler

2020-04-28 Thread Samuel Zou
Hi Joe, Thanks for your comments, I will modify and send the v2 On 2020/4/29 11:23, Joe Perches wrote: On Wed, 2020-04-29 at 11:15 +0800, Zou Wei wrote: fix coccinelle warning, use ARRAY_SIZE drivers/net/ethernet/huawei/hinic/hinic_sriov.c:713:43-44: WARNING: Use ARRAY_SIZE Reported-by: Hulk

[PATCH V2] net: hns3: adds support for reading module eeprom info

2020-04-28 Thread Huazhong Tan
From: Yonglong Liu This patch adds support for reading the optical module eeprom info via "ethtool -m". Signed-off-by: Yonglong Liu Signed-off-by: Huazhong Tan --- V2: replace self-defined macro with the SFF8024_ID_* in sfp.h suggested by Jakub Kicinski. --- drivers/net/ethernet/hisilicon

RE: [EXT] Re: [PATCH net-next] net: ethernet: fec: Prevent MII event after MII_SPEED write

2020-04-28 Thread Andy Duan
From: David Miller Sent: Wednesday, April 29, 2020 11:35 AM > From: Andy Duan > Date: Wed, 29 Apr 2020 01:55:35 + > > > From: David Miller Sent: Wednesday, April 29, > > 2020 5:34 AM > >> From: Andrew Lunn > >> Date: Tue, 28 Apr 2020 19:58:33 +0200 > >> > >> > The change to polled IO for

Re: [EXT] Re: [PATCH net-next] net: ethernet: fec: Prevent MII event after MII_SPEED write

2020-04-28 Thread David Miller
From: Andy Duan Date: Wed, 29 Apr 2020 01:55:35 + > From: David Miller Sent: Wednesday, April 29, 2020 5:34 > AM >> From: Andrew Lunn >> Date: Tue, 28 Apr 2020 19:58:33 +0200 >> >> > The change to polled IO for MDIO completion assumes that MII events >> > are only generated for MDIO trans

Re: [PATCH bpf-next] bpf: bpf_{g,s}etsockopt for struct bpf_sock

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 11:57:19AM -0700, Stanislav Fomichev wrote: > Currently, bpf_getsocktop and bpf_setsockopt helpers operate on the > 'struct bpf_sock_ops' context in BPF_PROG_TYPE_CGROUP_SOCKOPT program. > Let's generalize them and make the first argument be 'struct bpf_sock'. > That way, in

[PATCH -next] hinic: Use kmemdup instead of kzalloc and memcpy

2020-04-28 Thread Zou Wei
Fixes coccicheck warnings: drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:452:17-24: WARNING opportunity for kmemdup drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:458:23-30: WARNING opportunity for kmemdup Reported-by: Hulk Robot Signed-off-by: Zou Wei --- drivers/net/ethernet/huawe

Re: [PATCH -next] hinic: Use ARRAY_SIZE for nic_vf_cmd_msg_handler

2020-04-28 Thread Joe Perches
On Wed, 2020-04-29 at 11:15 +0800, Zou Wei wrote: > fix coccinelle warning, use ARRAY_SIZE > > drivers/net/ethernet/huawei/hinic/hinic_sriov.c:713:43-44: WARNING: Use > ARRAY_SIZE > > Reported-by: Hulk Robot > Signed-off-by: Zou Wei > --- > drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 3

[PATCH -next] hinic: Use ARRAY_SIZE for nic_vf_cmd_msg_handler

2020-04-28 Thread Zou Wei
fix coccinelle warning, use ARRAY_SIZE drivers/net/ethernet/huawei/hinic/hinic_sriov.c:713:43-44: WARNING: Use ARRAY_SIZE Reported-by: Hulk Robot Signed-off-by: Zou Wei --- drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dr

Re: general protection fault in tcf_action_destroy (2)

2020-04-28 Thread syzbot
syzbot suspects this bug was fixed by commit: commit 0d1c3530e1bd38382edef72591b78e877e0edcd3 Author: Cong Wang Date: Thu Mar 12 05:42:28 2020 + net_sched: keep alloc_hash updated after hash allocation bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=15e7415410 start c

Re: [PATCH v2 bpf-next 00/11] Fix libbpf and selftest issues detected by ASAN

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 06:21:00PM -0700, Andrii Nakryiko wrote: > Add necessary infra to build selftests with ASAN (or any other sanitizer). Fix > a bunch of found memory leaks and other memory access issues. > > v1->v2: > - don't add ASAN flavor, but allow extra flags for build (Alexei); > -

[PATCH net-next v2] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_probe()

2020-04-28 Thread Wei Yongjun
platform_get_resource() may fail and return NULL, so we should better check it's return value to avoid a NULL pointer dereference since devm_ioremap() does not check input parameters for null. This is detected by Coccinelle semantic patch. @@ expression pdev, res, n, t, e, e1, e2; @@ res = \(pla

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Alexei Starovoitov
On 4/28/20 6:15 PM, Yonghong Song wrote: On 4/28/20 5:48 PM, Alexei Starovoitov wrote: On 4/28/20 5:37 PM, Martin KaFai Lau wrote: +    prog = bpf_iter_get_prog(seq, sizeof(struct bpf_iter_seq_map_info), + &meta.session_id, &meta.seq_num, + v == (void *)0);  F

Re: [PATCH 00/16] kbuild: support 'userprogs' syntax

2020-04-28 Thread Masahiro Yamada
Hi Sam, On Sat, Apr 25, 2020 at 8:53 PM Sam Ravnborg wrote: > > Hi Masahiro > > On Thu, Apr 23, 2020 at 04:39:13PM +0900, Masahiro Yamada wrote: > > > > Several Makefiles use 'hostprogs' for building the code for > > the host architecture is not appropriate. > > > > This is just because Kbuild do

Re: [PATCH v6 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
> On Apr 28, 2020, at 5:43 PM, Alexei Starovoitov > wrote: > > On Tue, Apr 28, 2020 at 05:33:54PM -0700, Yonghong Song wrote: >> >> >> On 4/28/20 5:29 PM, Song Liu wrote: >>> Add test for BPF_ENABLE_STATS, which should enable run_time_ns stats. >>> >>> ~/selftests/bpf# ./test_progs -t ena

[PATCH net] devlink: fix return value after hitting end in region read

2020-04-28 Thread Jakub Kicinski
Commit d5b90e99e1d5 ("devlink: report 0 after hitting end in region read") fixed region dump, but region read still returns a spurious error: $ devlink region read netdevsim/netdevsim1/dummy snapshot 0 addr 0 len 128 a6 f4 c4 1c 21 35 95 a6 9d 34 c3 5b 87 5b 35 79 0010

RE: [EXT] Re: [PATCH net-next] net: ethernet: fec: Prevent MII event after MII_SPEED write

2020-04-28 Thread Andy Duan
From: David Miller Sent: Wednesday, April 29, 2020 5:34 AM > From: Andrew Lunn > Date: Tue, 28 Apr 2020 19:58:33 +0200 > > > The change to polled IO for MDIO completion assumes that MII events > > are only generated for MDIO transactions. However on some SoCs writing > > to the MII_SPEED registe

Re: [net-next PATCH V3 1/3] mm: add dma_addr_t to struct page

2020-04-28 Thread Matthew Wilcox
On Wed, Apr 29, 2020 at 03:38:43AM +0300, Kirill A. Shutemov wrote: > On Wed, Feb 13, 2019 at 02:55:40AM +0100, Jesper Dangaard Brouer wrote: > > The page_pool API is using page->private to store DMA addresses. > > As pointed out by David Miller we can't use that on 32-bit architectures > > with 64

RE: [EXT] [PATCH net-next] net: ethernet: fec: Prevent MII event after MII_SPEED write

2020-04-28 Thread Andy Duan
From: Andrew Lunn Sent: Wednesday, April 29, 2020 1:59 AM > The change to polled IO for MDIO completion assumes that MII events are > only generated for MDIO transactions. However on some SoCs writing to the > MII_SPEED register can also trigger an MII event. As a result, the next MDIO > read has

[PATCH -next] hinic: make symbol 'dump_mox_reg' static

2020-04-28 Thread Zheng Bin
Fix sparse warnings: drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c:601:6: warning: symbol 'dump_mox_reg' was not declared. Should it be static? Reported-by: Hulk Robot Signed-off-by: Zheng Bin --- drivers/net/ethernet/huawei/hinic/hinic_hw_mbox.c | 2 +- 1 file changed, 1 insertion(+), 1

Re: [PATCH net-next] net: hns3: adds support for reading module eeprom info

2020-04-28 Thread tanhuazhong
On 2020/4/29 2:49, Jakub Kicinski wrote: On Tue, 28 Apr 2020 19:58:25 +0800 Huazhong Tan wrote: From: Yonglong Liu This patch adds support for reading the optical module eeprom info via "ethtool -m". Signed-off-by: Yonglong Liu Signed-off-by: Huazhong Tan diff --git a/drivers/net/ethe

[PATCH net-next] devlink: let kernel allocate region snapshot id

2020-04-28 Thread Jakub Kicinski
Currently users have to choose a free snapshot id before calling DEVLINK_CMD_REGION_NEW. This is potentially racy and inconvenient. Make the DEVLINK_ATTR_REGION_SNAPSHOT_ID optional and try to allocate id automatically. Send a message back to the caller with the snapshot info. The message carryin

RE: [EXT] Re: [PATCH net-next] net: ethernet: fec: Prevent MII event after MII_SPEED write

2020-04-28 Thread Andy Duan
From: Andrew Lunn Sent: Wednesday, April 29, 2020 2:02 AM > On Tue, Apr 28, 2020 at 07:58:33PM +0200, Andrew Lunn wrote: > > The change to polled IO for MDIO completion assumes that MII events > > are only generated for MDIO transactions. However on some SoCs writing > > to the MII_SPEED register

Re: [PATCH bpf-next v1 06/19] bpf: support bpf tracing/iter programs for BPF_LINK_UPDATE

2020-04-28 Thread Martin KaFai Lau
On Mon, Apr 27, 2020 at 01:12:41PM -0700, Yonghong Song wrote: > Added BPF_LINK_UPDATE support for tracing/iter programs. > This way, a file based bpf iterator, which holds a reference > to the link, can have its bpf program updated without > creating new files. > > Signed-off-by: Yonghong Song >

Re: [PATCH bpf-next v1 04/19] bpf: allow loading of a bpf_iter program

2020-04-28 Thread Yonghong Song
On 4/28/20 5:54 PM, Martin KaFai Lau wrote: On Mon, Apr 27, 2020 at 01:12:39PM -0700, Yonghong Song wrote: A bpf_iter program is a tracing program with attach type BPF_TRACE_ITER. The load attribute attach_btf_id is used by the verifier against a particular kernel function, e.g., __bpf_ite

[PATCH v2 bpf-next 03/11] selftests/bpf: convert test_hashmap into test_progs test

2020-04-28 Thread Andrii Nakryiko
Fold stand-alone test_hashmap test into test_progs. Signed-off-by: Andrii Nakryiko --- tools/testing/selftests/bpf/.gitignore| 2 - tools/testing/selftests/bpf/Makefile | 2 +- .../{test_hashmap.c => prog_tests/hashmap.c} | 280 +- 3 files changed, 140 inser

[PATCH v2 bpf-next 05/11] selftests/bpf: fix memory leak in test selector

2020-04-28 Thread Andrii Nakryiko
Free test selector substrings, which were strdup()'ed. Fixes: b65053cd94f4 ("selftests/bpf: Add whitelist/blacklist of test names to test_progs") Signed-off-by: Andrii Nakryiko --- tools/testing/selftests/bpf/test_progs.c | 20 1 file changed, 16 insertions(+), 4 deletions(

[PATCH v2 bpf-next 07/11] selftests/bpf: fix invalid memory reads in core_relo selftest

2020-04-28 Thread Andrii Nakryiko
Another one found by AddressSanitizer. input_len is bigger than actually initialized data size. Fixes: c7566a69695c ("selftests/bpf: Add field existence CO-RE relocs tests") Signed-off-by: Andrii Nakryiko --- tools/testing/selftests/bpf/prog_tests/core_reloc.c | 2 +- 1 file changed, 1 insertion

[PATCH v2 bpf-next 01/11] selftests/bpf: ensure test flavors use correct skeletons

2020-04-28 Thread Andrii Nakryiko
Ensure that test runner flavors include their own skeletons from / directory. Previously, skeletons generated for no-flavor test_progs were used. Apart from fixing correctness, this also makes it possible to compile only flavors individually: $ make clean && make test_progs-no_alu32 ... now su

[PATCH v2 bpf-next 10/11] selftests/bpf: fix bpf_link leak in ns_current_pid_tgid selftest

2020-04-28 Thread Andrii Nakryiko
If condition is inverted, but it's also just not necessary. Cc: Carlos Neira Fixes: 1c1052e0140a ("tools/testing/selftests/bpf: Add self-tests for new helper bpf_get_ns_current_pid_tgid.") Signed-off-by: Andrii Nakryiko --- tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c | 5 +

[PATCH v2 bpf-next 02/11] selftests/bpf: add SAN_CFLAGS param to selftests build to allow sanitizers

2020-04-28 Thread Andrii Nakryiko
Add ability to specify extra compiler flags with SAN_CFLAGS for compilation of all user-space C files. This allows to build all of selftest programs with, e.g., custom sanitizer flags, without requiring support for such sanitizers from anyone compiling selftest/bpf. As an example, to compile ever

[PATCH v2 bpf-next 09/11] selftests/bpf: disable ASAN instrumentation for mmap()'ed memory read

2020-04-28 Thread Andrii Nakryiko
AddressSanitizer assumes that all memory dereferences are done against memory allocated by sanitizer's malloc()/free() code and not touched by anyone else. Seems like this doesn't hold for perf buffer memory. Disable instrumentation on perf buffer callback function. Signed-off-by: Andrii Nakryiko

[PATCH v2 bpf-next 06/11] selftests/bpf: fix memory leak in extract_build_id()

2020-04-28 Thread Andrii Nakryiko
getline() allocates string, which has to be freed. Cc: Song Liu Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID") Signed-off-by: Andrii Nakryiko --- tools/testing/selftests/bpf/test_progs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftest

[PATCH v2 bpf-next 08/11] libbpf: fix huge memory leak in libbpf_find_vmlinux_btf_id()

2020-04-28 Thread Andrii Nakryiko
BTF object wasn't freed. Cc: KP Singh Fixes: a6ed02cac690 ("libbpf: Load btf_vmlinux only once per object.") Signed-off-by: Andrii Nakryiko --- tools/lib/bpf/libbpf.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 8e

[PATCH v2 bpf-next 11/11] selftests/bpf: add runqslower binary to .gitignore

2020-04-28 Thread Andrii Nakryiko
With recent changes, runqslower is being copied into selftests/bpf root directory. So add it into .gitignore. Cc: Veronika Kabatova Fixes: b26d1e2b6028 ("selftests/bpf: Copy runqslower to OUTPUT directory") Signed-off-by: Andrii Nakryiko --- tools/testing/selftests/bpf/.gitignore | 2 +- 1 file

[PATCH v2 bpf-next 04/11] libbpf: fix memory leak and possible double-free in hashmap__clear

2020-04-28 Thread Andrii Nakryiko
Fix memory leak in hashmap_clear() not freeing hashmap_entry structs for each of the remaining entries. Also NULL-out bucket list to prevent possible double-free between hashmap__clear() and hashmap__free(). Running test_progs-asan flavor clearly showed this problem. Cc: Alston Tang Reported-by:

[PATCH v2 bpf-next 00/11] Fix libbpf and selftest issues detected by ASAN

2020-04-28 Thread Andrii Nakryiko
Add necessary infra to build selftests with ASAN (or any other sanitizer). Fix a bunch of found memory leaks and other memory access issues. v1->v2: - don't add ASAN flavor, but allow extra flags for build (Alexei); - fix few more found issues, which somehow were missed first time. Andrii Nak

Re: [Potential Spoof] [PATCH bpf-next v1 05/19] bpf: support bpf tracing/iter programs for BPF_LINK_CREATE

2020-04-28 Thread Martin KaFai Lau
On Mon, Apr 27, 2020 at 01:12:40PM -0700, Yonghong Song wrote: > Given a bpf program, the step to create an anonymous bpf iterator is: > - create a bpf_iter_link, which combines bpf program and the target. > In the future, there could be more information recorded in the link. > A link_fd

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Yonghong Song
On 4/28/20 5:48 PM, Alexei Starovoitov wrote: On 4/28/20 5:37 PM, Martin KaFai Lau wrote: +    prog = bpf_iter_get_prog(seq, sizeof(struct bpf_iter_seq_map_info), + &meta.session_id, &meta.seq_num, + v == (void *)0);  From looking at seq_file.c, when will show

[PATCH -next] hinic: remove set but not used variable 'func_id'

2020-04-28 Thread Zheng Bin
Fixes gcc '-Wunused-but-set-variable' warning: drivers/net/ethernet/huawei/hinic/hinic_sriov.c:792:6: warning: variable ‘func_id’ set but not used [-Wunused-but-set-variable] It is introduced by commit 7dd29ee12865 ("hinic: add sriov feature support"), but never used, so remove it. Reported-by:

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Yonghong Song
On 4/28/20 5:37 PM, Martin KaFai Lau wrote: On Mon, Apr 27, 2020 at 01:12:37PM -0700, Yonghong Song wrote: The bpf_map iterator is implemented. The bpf program is called at seq_ops show() and stop() functions. bpf_iter_get_prog() will retrieve bpf program and other parameters during seq_file

possible deadlock in sch_direct_xmit (2)

2020-04-28 Thread syzbot
Hello, syzbot found the following crash on: HEAD commit:3f2eaebb bpf, riscv: Fix tail call count off by one in RV3.. git tree: bpf-next console output: https://syzkaller.appspot.com/x/log.txt?x=120d180810 kernel config: https://syzkaller.appspot.com/x/.config?x=3b755b963c64ac09 das

Re: [PATCH bpf-next v1 04/19] bpf: allow loading of a bpf_iter program

2020-04-28 Thread Martin KaFai Lau
On Mon, Apr 27, 2020 at 01:12:39PM -0700, Yonghong Song wrote: > A bpf_iter program is a tracing program with attach type > BPF_TRACE_ITER. The load attribute > attach_btf_id > is used by the verifier against a particular kernel function, > e.g., __bpf_iter__bpf_map in our previous bpf_map iterat

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Alexei Starovoitov
On 4/28/20 5:37 PM, Martin KaFai Lau wrote: + prog = bpf_iter_get_prog(seq, sizeof(struct bpf_iter_seq_map_info), +&meta.session_id, &meta.seq_num, +v == (void *)0); From looking at seq_file.c, when will show() be called with

Re: [PATCH v6 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 05:33:54PM -0700, Yonghong Song wrote: > > > On 4/28/20 5:29 PM, Song Liu wrote: > > Add test for BPF_ENABLE_STATS, which should enable run_time_ns stats. > > > > ~/selftests/bpf# ./test_progs -t enable_stats -v > > test_enable_stats:PASS:skel_open_and_load 0 nsec > > t

Re: [net-next PATCH V3 1/3] mm: add dma_addr_t to struct page

2020-04-28 Thread Kirill A. Shutemov
On Wed, Feb 13, 2019 at 02:55:40AM +0100, Jesper Dangaard Brouer wrote: > The page_pool API is using page->private to store DMA addresses. > As pointed out by David Miller we can't use that on 32-bit architectures > with 64-bit DMA > > This patch adds a new dma_addr_t struct to allow storing DMA a

Re: [PATCH bpf-next v1 03/19] bpf: add bpf_map iterator

2020-04-28 Thread Martin KaFai Lau
On Mon, Apr 27, 2020 at 01:12:37PM -0700, Yonghong Song wrote: > The bpf_map iterator is implemented. > The bpf program is called at seq_ops show() and stop() functions. > bpf_iter_get_prog() will retrieve bpf program and other > parameters during seq_file object traversal. In show() function, > bp

Re: [PATCH v3 bpf-next 0/3] Add BTF-defined map-in-map support to libbpf

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 05:27:36PM -0700, Andrii Nakryiko wrote: > This patch set teaches libbpf how to declare and initialize ARRAY_OF_MAPS and > HASH_OF_MAPS maps. See patch #3 for all the details. > > Patch #1 refactors parsing BTF definition of map to re-use it cleanly for > inner map definiti

Re: [PATCH v6 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS

2020-04-28 Thread Yonghong Song
On 4/28/20 5:29 PM, Song Liu wrote: Add test for BPF_ENABLE_STATS, which should enable run_time_ns stats. ~/selftests/bpf# ./test_progs -t enable_stats -v test_enable_stats:PASS:skel_open_and_load 0 nsec test_enable_stats:PASS:get_stats_fd 0 nsec test_enable_stats:PASS:attach_raw_tp 0 nsec

Re: [PATCH v3 bpf-next 00/10] bpf_link observability APIs

2020-04-28 Thread Alexei Starovoitov
On Tue, Apr 28, 2020 at 05:16:04PM -0700, Andrii Nakryiko wrote: > This patch series adds various observability APIs to bpf_link: > - each bpf_link now gets ID, similar to bpf_map and bpf_prog, by which > user-space can iterate over all existing bpf_links and create limited FD > from ID;

[PATCH v6 bpf-next 0/3] bpf: sharing bpf runtime stats with

2020-04-28 Thread Song Liu
run_time_ns is a useful stats for BPF programs. However, it is gated by sysctl kernel.bpf_stats_enabled. When multiple user space tools are toggling kernl.bpf_stats_enabled at the same time, they may confuse each other. Solve this problem with a new BPF command BPF_ENABLE_STATS. Changes v5 => v6:

[PATCH v6 bpf-next 3/3] bpf: add selftest for BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
Add test for BPF_ENABLE_STATS, which should enable run_time_ns stats. ~/selftests/bpf# ./test_progs -t enable_stats -v test_enable_stats:PASS:skel_open_and_load 0 nsec test_enable_stats:PASS:get_stats_fd 0 nsec test_enable_stats:PASS:attach_raw_tp 0 nsec test_enable_stats:PASS:get_prog_info 0 ns

[PATCH v6 bpf-next 1/3] bpf: sharing bpf runtime stats with BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
Currently, sysctl kernel.bpf_stats_enabled controls BPF runtime stats. Typical userspace tools use kernel.bpf_stats_enabled as follows: 1. Enable kernel.bpf_stats_enabled; 2. Check program run_time_ns; 3. Sleep for the monitoring period; 4. Check program run_time_ns again, calculate the di

[PATCH v6 bpf-next 2/3] libbpf: add support for command BPF_ENABLE_STATS

2020-04-28 Thread Song Liu
bpf_enable_stats() is added to enable given stats. Signed-off-by: Song Liu --- tools/lib/bpf/bpf.c | 10 ++ tools/lib/bpf/bpf.h | 1 + tools/lib/bpf/libbpf.map | 5 + 3 files changed, 16 insertions(+) diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 5cc1b0785

  1   2   3   4   >