[PATCH] selftests/bpf: add config fragment CONFIG_NF_NAT_IPV6

2018-11-29 Thread Naresh Kamboju
CONFIG_NF_NAT_IPV6=y is required for bpf test_sockmap test case
Fixes,
ip6tables v1.6.1: can't initialize ip6tables table `nat': Table does
not exist

Signed-off-by: Naresh Kamboju 
---
 tools/testing/selftests/bpf/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/config 
b/tools/testing/selftests/bpf/config
index 37f947ec44ed..d7076cf04a9d 100644
--- a/tools/testing/selftests/bpf/config
+++ b/tools/testing/selftests/bpf/config
@@ -23,3 +23,4 @@ CONFIG_LWTUNNEL=y
 CONFIG_BPF_STREAM_PARSER=y
 CONFIG_XDP_SOCKETS=y
 CONFIG_FTRACE_SYSCALLS=y
+CONFIG_NF_NAT_IPV6=y
-- 
2.17.1



[PATCH] selftests/bpf: add config fragment CONFIG_FTRACE_SYSCALLS

2018-11-27 Thread Naresh Kamboju
CONFIG_FTRACE_SYSCALLS=y is required for get_cgroup_id_user test case
this test reads a file from debug trace path
/sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id

Signed-off-by: Naresh Kamboju 
---
 tools/testing/selftests/bpf/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/config 
b/tools/testing/selftests/bpf/config
index 7f90d3645af8..37f947ec44ed 100644
--- a/tools/testing/selftests/bpf/config
+++ b/tools/testing/selftests/bpf/config
@@ -22,3 +22,4 @@ CONFIG_NET_CLS_FLOWER=m
 CONFIG_LWTUNNEL=y
 CONFIG_BPF_STREAM_PARSER=y
 CONFIG_XDP_SOCKETS=y
+CONFIG_FTRACE_SYSCALLS=y
-- 
2.17.1



selftests/bpf: libbpf: object file doesn't contain bpf program

2018-11-21 Thread Naresh Kamboju
The listed bpf test case failed due to,
libbpf: object file doesn't contain bpf program

We are cross compiling, installing selftests on device under test
and running tests by using run_kselftest.sh script file.

selftests: bpf: test_maps
libbpf: object file doesn't contain bpf program
Failed to load SK_SKB parse prog
not ok 1..3 selftests: bpf: test_maps [FAIL]

selftests: bpf: test_progs
libbpf: object file doesn't contain bpf program
libbpf: object file doesn't contain bpf program
libbpf: object file doesn't contain bpf program
libbpf: object file doesn't contain bpf program
libbpf: ./test_tcp_estats.o doesn't provide kernel version
libbpf: object file doesn't contain bpf program

selftests: bpf: test_tcpbpf_user
libbpf: object file doesn't contain bpf program
FAILED: load_bpf_file failed for: test_tcpbpf_kern.o
not ok 1..10 selftests: bpf: test_tcpbpf_user [FAIL]

selftests: bpf: test_tcpnotify_user
libbpf: object file doesn't contain bpf program
FAILED: load_bpf_file failed for: test_tcpnotify_kern.o
not ok 1..21 selftests: bpf: test_tcpnotify_user [FAIL]

selftests: bpf: test_flow_dissector.sh
bpffs not mounted. Mounting...
libbpf: object file doesn't contain bpf program
./flow_dissector_load: bpf_prog_load bpf_flow.o
selftests: test_flow_dissector [FAILED]

Do you see problem when running on target devices ?

Best regards
Naresh Kamboju


selftests/bpf :get_cgroup_id_user: File not found: /sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id

2018-11-21 Thread Naresh Kamboju
Kselftest bpf get_cgroup_id_user is failed on all devices.

selftests: bpf: get_cgroup_id_user
main:PASS:setup_cgroup_environment
main:PASS:create_and_get_cgroup
main:PASS:join_cgroup
main:PASS:bpf_prog_load
main:PASS:bpf_find_map
main:PASS:bpf_find_map
main:FAIL:open err -1 errno 2
not ok 1..15 selftests: bpf: get_cgroup_id_user [FAIL]

The strace output shows,
This expected file not found,
"/sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id"

bpf(BPF_MAP_UPDATE_ELEM, {map_fd=5, key=0x7fff0c68c138,
value=0x7fff0c68c13c, flags=BPF_ANY}, 72) = 0
open(\"/sys/kernel/debug/tracing/events/syscalls/sys_enter_nanosleep/id\",
O_RDONLY) = -1 ENOENT (No such file or directory)
write(1, \"main:FAIL:open err -1 errno 2\n\", 30main:FAIL:open err -1 errno 2

Am I missing any pre-requirement ?

Best regards
Naresh Kamboju


Re: selftests: net: udpgro.sh hangs on DUT devices running Linux -next

2018-11-18 Thread Naresh Kamboju
Hi Paolo,

On Sun, 18 Nov 2018 at 05:01, Paolo Abeni  wrote:
>
> Hi,
>
> On Fri, 2018-11-16 at 14:55 +0530, Naresh Kamboju wrote:
> > Kernel selftests: net: udpgro.sh hangs / waits forever on x86_64 and
> > arm32 devices running Linux -next. Test getting PASS on arm64 devices.
> >
> > Do you see this problem ?
> >
> > Short error log:
> > -
> > ip6tables v1.6.1: can't initialize ip6tables table `nat': Table does
> > not exist (do you need to insmod?)
>
> Thank you for the report.
>
> It looks like your kernel config has
>
> # CONFIG_NF_NAT_IPV6 is not set
>
> Can you please confirm ?

 # CONFIG_NF_NAT_IPV6 is not set on the devices where the test is getting hang.

>
> net selftests do not explicitly ask for that, despiting using such
> functionality (my bad).
>
> I'll be travelling up to Monday (included). I'll have a better look
> after that.

Thank you.

- Naresh

>
> Cheers,
>
> Paolo
>


selftests: net: udpgro.sh hangs on DUT devices running Linux -next

2018-11-16 Thread Naresh Kamboju
Pv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
 GRO ok
[ 1015.334213] IPv6: ADDRCONF(NETDEV_UP): veth0: link is not ready
[ 1015.457938] IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
 GRO chk cmsgok
[ 1015.823508] IPv6: ADDRCONF(NETDEV_UP): veth0: link is not ready
[ 1015.935954] IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
 GRO with custom segment sizeok
[ 1016.332459] IPv6: ADDRCONF(NETDEV_UP): veth0: link is not ready
[ 1016.453954] IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
 GRO with custom segment size cmsg   ok
 bad GRO lookup  ip6tables v1.6.1: can't
initialize ip6tables table `nat': Table does not exist (do you need to
insmod?)

Best regards
Naresh Kamboju


Re: BUG: sleeping function called from invalid context at mm/slab.h:421

2018-11-14 Thread Naresh Kamboju
Hi Roman,

On Tue, 13 Nov 2018 at 23:07, Roman Gushchin  wrote:
>
> On Tue, Nov 13, 2018 at 10:03:38PM +0530, Naresh Kamboju wrote:
> > While running kernel selftests bpf test_cgroup_storage test this
> > kernel BUG reported every time on all devices running Linux -next
> > 4.20.0-rc2-next-20181113 (from 4.19.0-rc5-next-20180928).
> > This kernel BUG log is from x86_64 machine.
> >
> > Do you see at your end ?
> >
> > [   73.047526] BUG: sleeping function called from invalid context at
> > /srv/oe/build/tmp-rpb-glibc/work-shared/intel-corei7-64/kernel-source/mm/slab.h:421
> > [   73.060915] in_atomic(): 1, irqs_disabled(): 0, pid: 3157, name:
> > test_cgroup_sto
> > [   73.068342] INFO: lockdep is turned off.
> > [   73.072293] CPU: 2 PID: 3157 Comm: test_cgroup_sto Not tainted
> > 4.20.0-rc2-next-20181113 #1
> > [   73.080548] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS
> > 2.0b 07/27/2017
> > [   73.088018] Call Trace:
> > [   73.090463]  dump_stack+0x70/0xa5
> > [   73.093783]  ___might_sleep+0x152/0x240
> > [   73.097619]  __might_sleep+0x4a/0x80
> > [   73.101191]  __kmalloc_node+0x1cf/0x2f0
> > [   73.105031]  ? cgroup_storage_update_elem+0x46/0x90
> > [   73.109909]  cgroup_storage_update_elem+0x46/0x90
>
> Hi Naresh!
>
> Thank you for the report! Can you, please, try the following patch?

The below patch tested and it is working.
After applying the patch i do not see reported "BUG:".
Thanks for the fix patch.
Happy to test :)

- Naresh

>
> Thanks!
>
> --
>
> diff --git a/kernel/bpf/local_storage.c b/kernel/bpf/local_storage.c
> index c97a8f968638..d91710fb8360 100644
> --- a/kernel/bpf/local_storage.c
> +++ b/kernel/bpf/local_storage.c
> @@ -139,8 +139,8 @@ static int cgroup_storage_update_elem(struct bpf_map 
> *map, void *_key,
> return -ENOENT;
>
> new = kmalloc_node(sizeof(struct bpf_storage_buffer) +
> -  map->value_size, __GFP_ZERO | GFP_USER,
> -  map->numa_node);
> +  map->value_size, __GFP_ZERO | GFP_ATOMIC |
> +  __GFP_NOWARN, map->numa_node);
> if (!new)
> return -ENOMEM;
>


BUG: sleeping function called from invalid context at mm/slab.h:421

2018-11-13 Thread Naresh Kamboju
While running kernel selftests bpf test_cgroup_storage test this
kernel BUG reported every time on all devices running Linux -next
4.20.0-rc2-next-20181113 (from 4.19.0-rc5-next-20180928).
This kernel BUG log is from x86_64 machine.

Do you see at your end ?

[   73.047526] BUG: sleeping function called from invalid context at
/srv/oe/build/tmp-rpb-glibc/work-shared/intel-corei7-64/kernel-source/mm/slab.h:421
[   73.060915] in_atomic(): 1, irqs_disabled(): 0, pid: 3157, name:
test_cgroup_sto
[   73.068342] INFO: lockdep is turned off.
[   73.072293] CPU: 2 PID: 3157 Comm: test_cgroup_sto Not tainted
4.20.0-rc2-next-20181113 #1
[   73.080548] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS
2.0b 07/27/2017
[   73.088018] Call Trace:
[   73.090463]  dump_stack+0x70/0xa5
[   73.093783]  ___might_sleep+0x152/0x240
[   73.097619]  __might_sleep+0x4a/0x80
[   73.101191]  __kmalloc_node+0x1cf/0x2f0
[   73.105031]  ? cgroup_storage_update_elem+0x46/0x90
[   73.109909]  cgroup_storage_update_elem+0x46/0x90
[   73.114608]  map_update_elem+0x4a1/0x4c0
[   73.118534]  __x64_sys_bpf+0x124/0x280
[   73.122286]  do_syscall_64+0x4f/0x190
[   73.125952]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
[   73.131004] RIP: 0033:0x7f46b93ea7f9
[   73.134581] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00
00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24
08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 4f e6 2b 00 f7 d8 64 89
01 48
[   73.153318] RSP: 002b:7fffc6595858 EFLAGS: 0206 ORIG_RAX:
0141
[   73.160876] RAX: ffda RBX: 014a0260 RCX: 7f46b93ea7f9
[   73.167999] RDX: 0048 RSI: 7fffc65958a0 RDI: 0002
[   73.175124] RBP: 7fffc6595870 R08: 7fffc65958a0 R09: 7fffc65958a0
[   73.182246] R10: 7fffc65958a0 R11: 0206 R12: 0003
[   73.189369] R13: 0004 R14: 0005 R15: 0006
selftests: bpf: test_cgroup_storage

Please find full test log,
https://lkft.validation.linaro.org/scheduler/job/506640#L2874

Thank you.
Best regards
Naresh Kamboju


[PATCH] selftests/bpf: add config fragments BPF_STREAM_PARSER and XDP_SOCKETS

2018-10-25 Thread Naresh Kamboju
BPF sockmap and hashmap are dependent on CONFIG_BPF_STREAM_PARSER and
xskmap is dependent on CONFIG_XDP_SOCKETS

Signed-off-by: Naresh Kamboju 
---
 tools/testing/selftests/bpf/config | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/bpf/config 
b/tools/testing/selftests/bpf/config
index dd49df5e2df4..7f90d3645af8 100644
--- a/tools/testing/selftests/bpf/config
+++ b/tools/testing/selftests/bpf/config
@@ -20,3 +20,5 @@ CONFIG_VXLAN=y
 CONFIG_GENEVE=y
 CONFIG_NET_CLS_FLOWER=m
 CONFIG_LWTUNNEL=y
+CONFIG_BPF_STREAM_PARSER=y
+CONFIG_XDP_SOCKETS=y
-- 
2.17.1



Re: [PATCH bpf-next 6/6] selftests/bpf: test_verifier, check bpf_map_lookup_elem access in bpf prog

2018-10-25 Thread Naresh Kamboju
 "prevent map lookup in stack trace",
> > +   .insns = {
> > +   BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
> > +   BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
> > +   BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
> > +   BPF_LD_MAP_FD(BPF_REG_1, 0),
> > +   BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
> > +BPF_FUNC_map_lookup_elem),
> > +   BPF_EXIT_INSN(),
> > +   },
> > +   .fixup_map_stacktrace = { 3 },
> > +   .result = REJECT,
> > +   .errstr = "cannot pass map_type 7 into func 
> > bpf_map_lookup_elem",
> > +   .prog_type = BPF_PROG_TYPE_PERF_EVENT,
> > +   },
> > +   {
> > +   "prevent map lookup in prog array",
> > +   .insns = {
> > +   BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
> > +   BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
> > +   BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
> > +   BPF_LD_MAP_FD(BPF_REG_1, 0),
> > +   BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0,
> > +BPF_FUNC_map_lookup_elem),
> > +   BPF_EXIT_INSN(),
> > +   },
> > +   .fixup_prog2 = { 3 },
> > +   .result = REJECT,
> > +   .errstr = "cannot pass map_type 3 into func 
> > bpf_map_lookup_elem",
> > +   },
> > {
> > "valid map access into an array with a constant",
> > .insns = {
> > @@ -13515,6 +13598,10 @@ static void do_test_fixup(struct bpf_test *test, 
> > enum bpf_map_type prog_type,
> > int *fixup_map_hash_48b = test->fixup_map_hash_48b;
> > int *fixup_map_hash_16b = test->fixup_map_hash_16b;
> > int *fixup_map_array_48b = test->fixup_map_array_48b;
> > +   int *fixup_map_sockmap = test->fixup_map_sockmap;
> > +   int *fixup_map_sockhash = test->fixup_map_sockhash;
> > +   int *fixup_map_xskmap = test->fixup_map_xskmap;
> > +   int *fixup_map_stacktrace = test->fixup_map_stacktrace;
> > int *fixup_prog1 = test->fixup_prog1;
> > int *fixup_prog2 = test->fixup_prog2;
> > int *fixup_map_in_map = test->fixup_map_in_map;
> > @@ -13603,6 +13690,38 @@ static void do_test_fixup(struct bpf_test *test, 
> > enum bpf_map_type prog_type,
> > fixup_percpu_cgroup_storage++;
> > } while (*fixup_percpu_cgroup_storage);
> > }
> > +   if (*fixup_map_sockmap) {
> > +   map_fds[9] = create_map(BPF_MAP_TYPE_SOCKMAP, sizeof(int),
> > +   sizeof(int), 1);
> > +   do {
> > +   prog[*fixup_map_sockmap].imm = map_fds[9];
> > +   fixup_map_sockmap++;
> > +   } while (*fixup_map_sockmap);
> > +   }
> > +   if (*fixup_map_sockhash) {
> > +   map_fds[10] = create_map(BPF_MAP_TYPE_SOCKHASH, sizeof(int),
> > +   sizeof(int), 1);
> > +   do {
> > +   prog[*fixup_map_sockhash].imm = map_fds[10];
> > +   fixup_map_sockhash++;
> > +   } while (*fixup_map_sockhash);
> > +   }
> > +   if (*fixup_map_xskmap) {
> > +   map_fds[11] = create_map(BPF_MAP_TYPE_XSKMAP, sizeof(int),
> > +   sizeof(int), 1);
> > +   do {
> > +   prog[*fixup_map_xskmap].imm = map_fds[11];
> > +   fixup_map_xskmap++;
> > +   } while (*fixup_map_xskmap);
> > +   }

selftests: bpf: test_verifier sockmap, sockhash, xskmap failed on
mainline and next
(from 4.19.0-rc7-next-20181011 to till date )
Are we missing any pre-required kernel configs ?

Test log,

selftests: bpf: test_verifier
<>
#274/p prevent map lookup in sockmap Failed to create hash map
'Invalid argument'!
FAIL
Unexpected error message!
EXP: cannot pass map_type 15 into func bpf_map_lookup_elem
RES: fd -1 is not pointing to valid bpf_map
fd -1 is not pointing to valid bpf_map
#275/p prevent map lookup in sockhash Failed to create hash map
'Invalid argument'!
FAIL
Unexpected error message!
EXP: cannot pass map_type 18 into func bpf_map_

Re: selftests/bpf: test_kmod.sh hangs on all devices

2018-10-09 Thread Naresh Kamboju
Hi Shuah,

On Mon, 8 Oct 2018 at 20:46, Shuah Khan  wrote:
>
> Hi Naresh,
>
> Please use sh...@kernel.org for faster responses. I updated MAINTAINERS
> entry a while back removing shua...@osg.samsung.com address due to IT
> infrastructure changes at Samsung.
+1

Thank you.

Best Regards
Naresh Kamboju


Re: selftests/bpf: test_kmod.sh hangs on all devices

2018-10-09 Thread Naresh Kamboju
> > > OTOH,
> > > There is a kernel BUG,
> >
> > This is quite an old linux-next kernel, should be fixed by 100811936f89 
> > ("bpf: test_bpf:
> > add init_net to dev for flow_dissector"). Please make sure you have that 
> > commit included
> > in your testing:

This patch included in the linux next tree.

>
> I will re-validate on latest code base and let you know.

test_kmod.sh PASS on linux-next.

+ ./test_kmod.sh
[ JIT enabled:0 hardened:0 ]
[   25.886816] test_bpf: #0 TAX jited:0 441 435 436 PASS
[   25.889223] test_bpf: #1 TXA jited:0 144 143 143 PASS

[  105.557950] test_bpf: #377 JNE signed compare, test 7 jited:1 46 PASS
[  105.564354] test_bpf: Summary: 378 PASSED, 0 FAILED, [366/366 JIT'ed]
test_bpf: ok
[  105.564354] test_bpf: Summary: 378 PASSED, 0 FAILED

Thank you
- Naresh


Re: selftests/bpf: test_kmod.sh hangs on all devices

2018-10-08 Thread Naresh Kamboju
Daniel,

On Mon, 8 Oct 2018 at 18:58, Daniel Borkmann  wrote:
>
> On 10/08/2018 03:13 PM, Naresh Kamboju wrote:
> > BPF test case test_kmod.sh hangs on all devices running linux next.
> >
> > + cd /opt/kselftests/default-in-kernel/bpf
> > + ./test_kmod.sh
> > sysctl: cannot stat /proc/sys/net/core/bpf_jit_enable: No such file or 
> > directory
> > sysctl: cannot stat /proc/sys/net/core/bpf_jit_harden: No such file or 
> > directory
> > sysctl: cannot stat /proc/sys/net/core/bpf_jit_enable: No such file or 
> > directory
> > sysctl: cannot stat /proc/sys/net/core/bpf_jit_harden: No such file or 
> > directory
> > [ JIT enabled:0 hardened:0 ]
> >
> > https://lkft.validation.linaro.org/scheduler/job/429726
> >
> > Test hangs started from 4.19.0-rc4-next-20180918.
> > Linux version 4.19.0-rc4-next-20180918 (oe-user@oe-host) (gcc version
> > 7.1.1 20170707 (Linaro GCC 7.1-2017.08)) #1 SMP Tue Sep 18 05:26:00
> > UTC 2018
> >
> > History can be compared from this page.
> > https://qa-reports.linaro.org/lkft/linux-next-oe/tests/kselftest/bpf_test_kmod.sh
> >
> > OTOH,
> > There is a kernel BUG,
>
> This is quite an old linux-next kernel, should be fixed by 100811936f89 
> ("bpf: test_bpf:
> add init_net to dev for flow_dissector"). Please make sure you have that 
> commit included
> in your testing:

I will re-validate on latest code base and let you know.

>
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=100811936f89fd455eda1984810c09003550555b

Thanks for the quick reply.

- Naresh
>
> Thanks,
> Daniel


mainline: x86_64: kernel panic: RIP: 0010:__xfrm_policy_check+0xcb/0x690

2018-06-11 Thread Naresh Kamboju
[  214.083451] RDX: b863ebe0 RSI:  RDI: 
[  214.090574] RBP: 91cf6fd03b18 R08: b863ebe0 R09: 
[  214.097699] R10: 91cf6fd039d0 R11:  R12: 
[  214.104821] R13: 91cf5b23d84e R14: 91cf5b779f80 R15: 91cf5589cc00
[  214.111945] FS:  () GS:91cf6fd0()
knlGS:
[  214.120022] CS:  0010 DS:  ES:  CR0: 80050033
[  214.125760] CR2: 0008 CR3: 4201e001 CR4: 003606e0
[  214.132885] DR0:  DR1:  DR2: 
[  214.140009] DR3:  DR6: fffe0ff0 DR7: 0400
[  214.147131] Kernel panic - not syncing: Fatal exception in interrupt
[  214.153519] Kernel Offset: 0x36c0 from 0x8100
(relocation range: 0x8000-0xbfff)
[  214.164292] ---[ end Kernel panic - not syncing: Fatal exception in
interrupt ]---
[  214.171852] [ cut here ]

Kconfigs on this kernel,
---
CONFIG_XFRM=y
CONFIG_XFRM_ALGO=y
CONFIG_XFRM_USER=y
# CONFIG_XFRM_SUB_POLICY is not set
# CONFIG_XFRM_MIGRATE is not set
# CONFIG_XFRM_STATISTICS is not set
http://snapshots.linaro.org/openembedded/lkft/morty/intel-core2-32/rpb/linux-next/274/config

Test case source:
--
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/selftests/bpf/test_tunnel.sh#n565

steps to reproduce:
--
cd /tools/testing/selftests/bpf/
./test_tunnel.sh

Debugging shows it is coming from function
setup_xfrm_tunnel() {

ip xfrm state add src 172.16.1.100 dst 172.16.1.200 proto esp spi 0x1 \
 reqid 1 mode tunnel auth-trunc 'hmac(sha1)'  \
 0x 96 enc 'cbc(aes)' \
 0x

}

Complete test log can be found in this location,
https://lkft.validation.linaro.org/scheduler/job/269604#L2092

Best regards
Naresh Kamboju


selftests: pmtu: Need pre-required configs ?

2018-05-17 Thread Naresh Kamboju
kselftest net pmtu.sh skipped due to missing dependencies ?
This is an open issues on all devices running linux-mainline and linux-next.

[  105.064609] test_bpf: test_skb_segment: success in skb_segment!
[  105.648758] IPv6: ADDRCONF(NETDEV_UP): veth_a: link is not ready
[  105.692738] IPv6: ADDRCONF(NETDEV_UP): veth_b: link is not ready
[  105.698774] IPv6: ADDRCONF(NETDEV_CHANGE): veth_b: link becomes ready
[  105.705256] IPv6: ADDRCONF(NETDEV_CHANGE): veth_a: link becomes ready
RTNETLINK answers: Operation not supported
  vti6 not supported
TEST: vti6: PMTU exceptions [SKIP]
[  106.248522] IPv6: ADDRCONF(NETDEV_UP): veth_a: link is not ready
[  106.296914] IPv6: ADDRCONF(NETDEV_CHANGE): veth_a: link becomes ready
RTNETLINK answers: Operation not supported
  vti4 not supported
TEST: vti4: PMTU exceptions [SKIP]
[  106.812715] IPv6: ADDRCONF(NETDEV_UP): veth_a: link is not ready
[  106.890709] IPv6: ADDRCONF(NETDEV_CHANGE): veth_a: link becomes ready
RTNETLINK answers: Operation not supported
  vti4 not supported
TEST: vti4: default MTU assignment  [SKIP]
[  107.393724] IPv6: ADDRCONF(NETDEV_UP): veth_a: link is not ready
[  107.453358] IPv6: ADDRCONF(NETDEV_UP): veth_b: link is not ready
[  107.459380] IPv6: ADDRCONF(NETDEV_CHANGE): veth_b: link becomes ready
[  107.465852] IPv6: ADDRCONF(NETDEV_CHANGE): veth_a: link becomes ready
RTNETLINK answers: Operation not supported
  vti6 not supported
TEST: vti6: default MTU assignment  [SKIP]
RTNETLINK answers: Operation not supported
TEST: vti4: MTU setting on link creation[SKIP]
  vti not supported
RTNETLINK answers: Operation not supported
TEST: vti6: MTU setting on link creation[SKIP]
  vti6 not supported
RTNETLINK answers: Operation not supported
TEST: vti6: MTU changes on link changes [SKIP]
  dummy not supported
selftests: pmtu.sh [PASS]

The current config is,
http://snapshots.linaro.org/openembedded/lkft/morty/intel-core2-32/rpb/\
linux-mainline/852/config

For more details please refer this log,
https://lkft.validation.linaro.org/scheduler/job/212320#L3395

Best regards
Naresh Kamboju


Re: [PATCH] net: ethernet: ti: cpsw: fix packet leaking in dual_mac mode

2018-05-17 Thread Naresh Kamboju
On 2 May 2018 at 20:38, David Miller  wrote:
> From: Grygorii Strashko 
> Date: Tue, 1 May 2018 12:41:22 -0500

>> Signed-off-by: Grygorii Strashko 
>
> Applied and queued up for -stable, thank you.

4.4 stable-rc build failed for arm32.
MACHINE=am57xx-evm

Build error log:

drivers/net/ethernet/ti/cpsw.c:
 In function 'cpsw_add_dual_emac_def_ale_entries':
drivers/net/ethernet/ti/cpsw.c:1112:23:
 error: 'cpsw' undeclared (first use in this function)
   cpsw_ale_control_set(cpsw->ale, slave_port,
^~~~
drivers/net/ethernet/ti/cpsw.c:1112:23: note:
 each undeclared identifier is reported only once for each function it appears
 in
scripts/Makefile.build:269: recipe for target 'drivers/net/ethernet/ti/cpsw.o'
 failed
 make[6]: *** [drivers/net/ethernet/ti/cpsw.o] Error 1
scripts/Makefile.build:476: recipe for target 'drivers/net/ethernet/ti' failed
 make[5]: *** [drivers/net/ethernet/ti] Error 2


Complete log link:
https://ci.linaro.org/job/openembedded-lkft-linux-stable-rc-4.4/DISTRO=rpb,MACHINE=am57xx-evm,label=docker-lkft/205/console


Re: selftests: net: reuseport_bpf failed intermittently

2018-02-08 Thread Naresh Kamboju
Hi Daniel,

On 8 February 2018 at 18:07, Daniel Borkmann <dan...@iogearbox.net> wrote:
> On 02/08/2018 12:41 PM, Naresh Kamboju wrote:
>> selftests/net/reuseport_bpf FAILED in full run on x86_64 and the
>> independent test execution resulted as PASS.
>>
>> Test failed output log:
>> -
>> Testing too many filters...
>> Testing filters on non-SO_REUSEPORT socket...
>> ./reuseport_bpf : ebpf error: Operation not permitted
>>
>> One more experiment,
>> The same test case "reuseport_bpf" run 10 times in a row.
>> The first run pass and other runs failed.
>>
>> Running tests for 10 times
>> + cd /opt/kselftests/mainline/net
>> + ./reuseport_bpf
> [...]
>>  IPv6 TCP w/ mapped IPv4 
>> Testing EBPF mod 10...
>> Reprograming, testing mod 5...
>> Testing CBPF mod 10...
>> Reprograming, testing mod 5...
>> Testing filter add without bind...
>> SUCCESS
>> + echo PASS
>> PASS
>> + ./reuseport_bpf
>>  IPv4 UDP 
>> Testing EBPF mod 10...
>> Reprograming, testing mod 5...
>> ./reuseport_bpf: ebpf error. log:
>> 0: (bf) r6 = r1
>> 1: (20) r0 = *(u32 *)skb[0]
>> 2: (97) r0 %= 10
>> 3: (95) exit
>> processed 4 insns
>> : Operation not permitted
>> + echo FAIL
>> FAIL
>> + ./reuseport_bpf
>>  IPv4 UDP 
>> Testing EBPF mod 10...
>> Reprograming, testing mod 5...
>> ./reuseport_bpf: ebpf error. log:
>> 0: (bf) r6 = r1
>> 1: (20) r0 = *(u32 *)skb[0]
>> 2: (97) r0 %= 10
>> 3: (95) exit
>> processed 4 insns
>> : Operation not permitted
>> + echo FAIL
>> FAIL
>> + ./reuseport_bpf
>>  IPv4 UDP 
>> Testing EBPF mod 10...
>> Reprograming, testing mod 5...
>> Testing EBPF mod 20...
>> Reprograming, testing mod 10...
>> Testing CBPF mod 10...
>> Reprograming, testing mod 5...
>> Testing CBPF mod 20...
>> Reprograming, testing mod 10...
>> Testing too many filters...
>> Testing filters on non-SO_REUSEPORT socket...
>>  IPv6 UDP 
>> Testing EBPF mod 10...
>> Reprograming, testing mod 5...
>> Testing EBPF mod 20...
>> Reprograming, testing mod 10...
>> Testing CBPF mod 10...
>> Reprograming, testing mod 5...
>> Testing CBPF mod 20...
>> Reprograming, testing mod 10...
>> Testing too many filters...
>> Testing filters on non-SO_REUSEPORT socket...
>>  IPv6 UDP w/ mapped IPv4 
>> Testing EBPF mod 20...
>> Reprograming, testing mod 10...
>> Testing EBPF mod 10...
>> Reprograming, testing mod 5...
>> Testing CBPF mod 10...
>> Reprograming, testing mod 5...
>> Testing CBPF mod 20...
>> Reprograming, testing mod 10...
>>  IPv4 TCP 
>> Testing EBPF mod 10...
>> ./reuseport_bpf: failed to bind send socket: Address already in use
>> + echo FAIL
> [...]
>>
>> Please refer this bug link for more details
>> https://bugs.linaro.org/show_bug.cgi?id=3502
>>
>> We are using x86_64 machine and the rootfs is mounted on NFS.
>> Please guide me in solving this test case failure.
>
> [ +Alexei ]
>
> Below should fix these two issues. (For checking the bpf selftests, we should
> probably adapt similar scheme with ctor/dtor to act more graceful.)
>
>  tools/testing/selftests/net/reuseport_bpf.c | 21 -
>  1 file changed, 20 insertions(+), 1 deletion(-)

Thanks for the quick response and patch.
I will test this patch and share logs.

>
> diff --git a/tools/testing/selftests/net/reuseport_bpf.c 
> b/tools/testing/selftests/net/reuseport_bpf.c
> index 4a82174..cad14cd 100644
> --- a/tools/testing/selftests/net/reuseport_bpf.c
> +++ b/tools/testing/selftests/net/reuseport_bpf.c
> @@ -21,6 +21,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>
>  #ifndef ARRAY_SIZE
> @@ -190,11 +191,14 @@ static void send_from(struct test_params p, uint16_t 
> sport, char *buf,
> struct sockaddr * const saddr = new_any_sockaddr(p.send_family, 
> sport);
> struct sockaddr * const daddr =
> new_loopback_sockaddr(p.send_family, p.recv_port);
> -   const int fd = socket(p.send_family, p.protocol, 0);
> +   const int fd = socket(p.send_family, p.protocol, 0), one = 1;
>
> if (fd < 0)
> error(1, errno, "failed to create send socket");
>
> +   if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, , sizeof(one)))
> +   error(1, errno, "failed to set reuseaddr");
> +
> if (bind(fd, saddr, sockaddr_size()))
> error(1, errno, "failed to bind send socket");
>
> @@ -433,6 +437,21 @@ void enable_fastopen(void)
> }
>  }
>
> +static struct rlimit rlim_old, rlim_new;
> +
> +static  __attribute__((constructor)) void main_ctor(void)
> +{
> +   getrlimit(RLIMIT_MEMLOCK, _old);
> +   rlim_new.rlim_cur = rlim_old.rlim_cur + (1UL << 20);
> +   rlim_new.rlim_max = rlim_old.rlim_max + (1UL << 20);
> +   setrlimit(RLIMIT_MEMLOCK, _new);
> +}
> +
> +static __attribute__((destructor)) void main_dtor(void)
> +{
> +   setrlimit(RLIMIT_MEMLOCK, _old);
> +}
> +
>  int main(void)
>  {
> fprintf(stderr, " IPv4 UDP \n");
> --
> 2.9.5
>

- Naresh


selftests: net: reuseport_bpf failed intermittently

2018-02-08 Thread Naresh Kamboju
..
Testing CBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 20...
Reprograming, testing mod 10...
Testing too many filters...
Testing filters on non-SO_REUSEPORT socket...
 IPv6 UDP w/ mapped IPv4 
Testing EBPF mod 20...
Reprograming, testing mod 10...
Testing EBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 20...
Reprograming, testing mod 10...
 IPv4 TCP 
Testing EBPF mod 10...
./reuseport_bpf: failed to bind send socket: Address already in use
+ echo FAIL
FAIL
+ ./reuseport_bpf
 IPv4 UDP 
Testing EBPF mod 10...
Reprograming, testing mod 5...
Testing EBPF mod 20...
Reprograming, testing mod 10...
Testing CBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 20...
Reprograming, testing mod 10...
Testing too many filters...
Testing filters on non-SO_REUSEPORT socket...
 IPv6 UDP 
Testing EBPF mod 10...
Reprograming, testing mod 5...
Testing EBPF mod 20...
Reprograming, testing mod 10...
Testing CBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 20...
Reprograming, testing mod 10...
Testing too many filters...
Testing filters on non-SO_REUSEPORT socket...
 IPv6 UDP w/ mapped IPv4 
Testing EBPF mod 20...
Reprograming, testing mod 10...
Testing EBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 20...
Reprograming, testing mod 10...
 IPv4 TCP 
Testing EBPF mod 10...
./reuseport_bpf: failed to bind send socket: Address already in use
+ echo FAIL
FAIL
+ ./reuseport_bpf
 IPv4 UDP 
Testing EBPF mod 10...
Reprograming, testing mod 5...
Testing EBPF mod 20...
Reprograming, testing mod 10...
Testing CBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 20...
Reprograming, testing mod 10...
Testing too many filters...
Testing filters on non-SO_REUSEPORT socket...
 IPv6 UDP 
Testing EBPF mod 10...
Reprograming, testing mod 5...
Testing EBPF mod 20...
Reprograming, testing mod 10...
Testing CBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 20...
Reprograming, testing mod 10...
Testing too many filters...
Testing filters on non-SO_REUSEPORT socket...
 IPv6 UDP w/ mapped IPv4 
Testing EBPF mod 20...
Reprograming, testing mod 10...
Testing EBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 10...
Reprograming, testing mod 5...
Testing CBPF mod 20...
Reprograming, testing mod 10...
 IPv4 TCP 
Testing EBPF mod 10...
./reuseport_bpf: failed to bind send socket: Address already in use
+ echo FAIL
FAIL

Please refer this bug link for more details
https://bugs.linaro.org/show_bug.cgi?id=3502

We are using x86_64 machine and the rootfs is mounted on NFS.
Please guide me in solving this test case failure.

Best regards
Naresh Kamboju


Re: [PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod

2018-02-07 Thread Naresh Kamboju
Hi Daniel,

On 7 February 2018 at 19:02, Daniel Borkmann <dan...@iogearbox.net> wrote:
> Hi Naresh,
>
> On 02/06/2018 10:07 PM, Naresh Kamboju wrote:
>> test_kmod.sh reported false failure when module not present.
>> Check test_bpf.ko is present in the path before loading it.
>>
>> Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
>> "modprobe test_bpf"
>>
>> Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
>
> Thanks for looking into this! Could we have a way to be able to
> support both? Say, when test_bpf.ko from SRC_TREE is not present,
> we try with modprobe -q fallback? I would still like to support
> the case where you can make local changes and add new tests to
> test_bpf.c, recompile and then just rerun the test_kmod.sh w/o
> having to install it first.

Thanks for the review comments.
I have sent patch v2 with your comments addressed.

- Naresh

>
> Thanks,
> Daniel
>
>>  tools/testing/selftests/bpf/test_kmod.sh | 11 +++
>>  1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/test_kmod.sh 
>> b/tools/testing/selftests/bpf/test_kmod.sh
>> index ed4774d..54177b1 100755
>> --- a/tools/testing/selftests/bpf/test_kmod.sh
>> +++ b/tools/testing/selftests/bpf/test_kmod.sh
>> @@ -1,8 +1,6 @@
>>  #!/bin/sh
>>  # SPDX-License-Identifier: GPL-2.0
>>
>> -SRC_TREE=../../../../
>> -
>>  test_run()
>>  {
>>   sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
>> @@ -10,8 +8,13 @@ test_run()
>>
>>   echo "[ JIT enabled:$1 hardened:$2 ]"
>>   dmesg -C
>> - insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
>> - if [ $? -ne 0 ]; then
>> + # Use modprobe dry run to check for missing test_bpf module
>> + if ! /sbin/modprobe -q -n test_bpf; then
>> + echo "test_bpf: [SKIP]"
>> + elif /sbin/modprobe -q test_bpf; then
>> + echo "test_bpf: ok"
>> + else
>> + echo "test_bpf: [FAIL]"
>>   rc=1
>>   fi
>>   rmmod  test_bpf 2> /dev/null
>>
>


[PATCH v2] selftests: bpf: test_kmod.sh: check the module path before insmod

2018-02-07 Thread Naresh Kamboju
test_kmod.sh reported false failure when module not present.
Check test_bpf.ko is present in the path before loading it.

Two cases to be addressed here,
In the development process of test_bpf.c unit testing will be done by
developers by using "insmod $SRC_TREE/lib/test_bpf.ko"

On the other hand testers run full tests by installing modules on device
under test (DUT) and followed by modprobe to insert the modules accordingly.

Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
---
 tools/testing/selftests/bpf/test_kmod.sh | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_kmod.sh 
b/tools/testing/selftests/bpf/test_kmod.sh
index ed4774d..35669cc 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -10,9 +10,21 @@ test_run()
 
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
-   insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
-   if [ $? -ne 0 ]; then
-   rc=1
+   if [ -f ${SRC_TREE}/lib/test_bpf.ko ]; then
+   insmod ${SRC_TREE}/lib/test_bpf.ko 2> /dev/null
+   if [ $? -ne 0 ]; then
+   rc=1
+   fi
+   else
+   # Use modprobe dry run to check for missing test_bpf module
+   if ! /sbin/modprobe -q -n test_bpf; then
+   echo "test_bpf: [SKIP]"
+   elif /sbin/modprobe -q test_bpf; then
+   echo "test_bpf: ok"
+   else
+   echo "test_bpf: [FAIL]"
+   rc=1
+   fi
fi
rmmod  test_bpf 2> /dev/null
dmesg | grep FAIL
-- 
2.7.4



[PATCH] selftests: bpf: test_kmod.sh: check the module path before insmod

2018-02-06 Thread Naresh Kamboju
test_kmod.sh reported false failure when module not present.
Check test_bpf.ko is present in the path before loading it.

Stop using "insmod $SRC_TREE/lib/test_bpf.ko" instead use
"modprobe test_bpf"

Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
---
 tools/testing/selftests/bpf/test_kmod.sh | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_kmod.sh 
b/tools/testing/selftests/bpf/test_kmod.sh
index ed4774d..54177b1 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -1,8 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 
-SRC_TREE=../../../../
-
 test_run()
 {
sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null
@@ -10,8 +8,13 @@ test_run()
 
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
-   insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
-   if [ $? -ne 0 ]; then
+   # Use modprobe dry run to check for missing test_bpf module
+   if ! /sbin/modprobe -q -n test_bpf; then
+   echo "test_bpf: [SKIP]"
+   elif /sbin/modprobe -q test_bpf; then
+   echo "test_bpf: ok"
+   else
+   echo "test_bpf: [FAIL]"
rc=1
fi
rmmod  test_bpf 2> /dev/null
-- 
2.7.4



[PATCH] selftests: net: Adding config fragment CONFIG_NUMA=y

2017-12-19 Thread Naresh Kamboju
kernel config fragement CONFIG_NUMA=y is need for reuseport_bpf_numa.

Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
---
 tools/testing/selftests/net/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/net/config 
b/tools/testing/selftests/net/config
index e57b4ac..7177bea 100644
--- a/tools/testing/selftests/net/config
+++ b/tools/testing/selftests/net/config
@@ -1,3 +1,4 @@
 CONFIG_USER_NS=y
 CONFIG_BPF_SYSCALL=y
 CONFIG_TEST_BPF=m
+CONFIG_NUMA=y
-- 
2.7.4



selftests: net: config: need extra kernel config fragments ?

2017-12-12 Thread Naresh Kamboju
Hi,

I am planning to update selftests/net/config.

Before submitting a patch upstream i would like to get your opinion,
Test cases added to selftests/net
 - do "reuseport_bpf_numa.c" need CONFIG_NUMA=y ?
 - do "reuseport_bpf_cpu.c" need CONFIG_USE_PERCPU_NUMA_NODE_ID=y ?

Thank you in advance.

Best regards
Naresh Kamboju


[PATCH] selftests: bpf: Adding config fragment CONFIG_CGROUP_BPF=y

2017-12-11 Thread Naresh Kamboju
CONFIG_CGROUP_BPF=y is required for test_dev_cgroup test case.

Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
---
 tools/testing/selftests/bpf/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/config 
b/tools/testing/selftests/bpf/config
index 52d53ed..9d48973 100644
--- a/tools/testing/selftests/bpf/config
+++ b/tools/testing/selftests/bpf/config
@@ -3,3 +3,4 @@ CONFIG_BPF_SYSCALL=y
 CONFIG_NET_CLS_BPF=m
 CONFIG_BPF_EVENTS=y
 CONFIG_TEST_BPF=m
+CONFIG_CGROUP_BPF=y
-- 
2.7.4



[PATCH] selftests: net: Adding config fragment CONFIG_CGROUP_BPF=y

2017-12-07 Thread Naresh Kamboju
CONFIG_CGROUP_BPF=y is required for test_dev_cgroup test case.

Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
---
 tools/testing/selftests/net/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/net/config 
b/tools/testing/selftests/net/config
index e57b4ac..02301c6 100644
--- a/tools/testing/selftests/net/config
+++ b/tools/testing/selftests/net/config
@@ -1,3 +1,4 @@
 CONFIG_USER_NS=y
 CONFIG_BPF_SYSCALL=y
 CONFIG_TEST_BPF=m
+CONFIG_CGROUP_BPF=y
-- 
2.7.4



[PATCH v3 2/2] selftests: bpf: test_kmod.sh: use modprobe on target device

2017-11-07 Thread naresh . kamboju
From: Naresh Kamboju <naresh.kamb...@linaro.org>

On ARM and ARM64 devices kernel source tree is not available so
insmod "$SRC_TREE/lib/test_bpf.ko" is not working.

On these target devices the test_bpf.ko is installed under
/lib/modules/`uname -r`/kernel/lib/
so use modprobe dry run to check for missing test_bpf.ko module and
insert for testing.

Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
---
 tools/testing/selftests/bpf/test_kmod.sh | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/tools/testing/selftests/bpf/test_kmod.sh 
b/tools/testing/selftests/bpf/test_kmod.sh
index 2e5a1049e2f2..4757ca7d163c 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -14,6 +14,16 @@ test_run()
if [ $? -ne 0 ]; then
rc=1
fi
+   else
+   # Use modprobe dry run to check for missing test_bpf module
+   if ! /sbin/modprobe -q -n test_bpf; then
+   echo "test_bpf: [SKIP]"
+   elif /sbin/modprobe -q test_bpf; then
+   echo "test_bpf: ok"
+   else
+   echo "test_bpf: [FAIL]"
+   rc=1
+   fi
fi
rmmod  test_bpf 2> /dev/null
dmesg | grep FAIL
-- 
2.14.2



[PATCH v3 1/2] selftests: bpf: test_kmod.sh: check the module path before insmod

2017-11-07 Thread naresh . kamboju
From: Naresh Kamboju <naresh.kamb...@linaro.org>

test_kmod.sh reported false failure when module not present.
Instead check test_bpf.ko is present in the path before loading it.

Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
---
 tools/testing/selftests/bpf/test_kmod.sh | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_kmod.sh 
b/tools/testing/selftests/bpf/test_kmod.sh
index 6d58cca8e235..2e5a1049e2f2 100755
--- a/tools/testing/selftests/bpf/test_kmod.sh
+++ b/tools/testing/selftests/bpf/test_kmod.sh
@@ -9,9 +9,11 @@ test_run()
 
echo "[ JIT enabled:$1 hardened:$2 ]"
dmesg -C
-   insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
-   if [ $? -ne 0 ]; then
-   rc=1
+   if [ -f ${SRC_TREE}/lib/test_bpf.ko ]; then
+   insmod ${SRC_TREE}/lib/test_bpf.ko 2> /dev/null
+   if [ $? -ne 0 ]; then
+   rc=1
+   fi
fi
rmmod  test_bpf 2> /dev/null
dmesg | grep FAIL
-- 
2.14.2



Re: [PATCH v2 1/2] selftests: bpf: test_kmod.sh: check if module is present in the path before insert

2017-11-06 Thread Naresh Kamboju
On 7 September 2017 at 14:46, Daniel Borkmann <dan...@iogearbox.net> wrote:
> On 09/07/2017 10:19 AM, naresh.kamb...@linaro.org wrote:
>>
>> From: Naresh Kamboju <naresh.kamb...@linaro.org>
>>
>> The test script works when kernel source and build module test_bpf.ko
>> present on the machine. This patch will check if module is present in
>> the path.
>>
>> Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
>
>
> Looks good, what changed between v1 and v2? Didn't get the cover
> letter in case there was one. ;)

No change for 1/2 to v2 1/2. The only change was to v2 2/2.

>
> Which tree are you targeting? There are usually a lot of changes
> in BPF selftests going the usual route via net and net-next tree
> as we often require to put test cases along the BPF patches. Given
> the merge window now and given one can regard it as a fix, it's
> net tree. I'm also ok if Shuah wants to pick it up this window as
> test_kmod.sh hasn't been changed in quite a while, so no merge
> conflicts expected.

I did not see any conflict for this file (selftests/bpf/test_kmod.sh)

>
> Anyway, for the patch:
>
> Acked-by: Daniel Borkmann <dan...@iogearbox.net>
>
> Thanks!

Thank you.

- Naresh
>
>
>> ---
>>   tools/testing/selftests/bpf/test_kmod.sh | 8 +---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/test_kmod.sh
>> b/tools/testing/selftests/bpf/test_kmod.sh
>> index 6d58cca8e235..a53eb1cb54ef 100755
>> --- a/tools/testing/selftests/bpf/test_kmod.sh
>> +++ b/tools/testing/selftests/bpf/test_kmod.sh
>> @@ -9,9 +9,11 @@ test_run()
>>
>> echo "[ JIT enabled:$1 hardened:$2 ]"
>> dmesg -C
>> -   insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
>> -   if [ $? -ne 0 ]; then
>> -   rc=1
>> +   if [ -f $SRC_TREE/lib/test_bpf.ko ]; then
>> +   insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null
>> +   if [ $? -ne 0 ]; then
>> +   rc=1
>> +   fi
>> fi
>> rmmod  test_bpf 2> /dev/null
>> dmesg | grep FAIL
>>
>


Re: [PATCH v2 2/2] selftests: bpf: test_kmod.sh: use modprobe on target device

2017-11-06 Thread Naresh Kamboju
On 7 September 2017 at 14:50, Daniel Borkmann <dan...@iogearbox.net> wrote:
> On 09/07/2017 10:19 AM, naresh.kamb...@linaro.org wrote:
>>
>> From: Naresh Kamboju <naresh.kamb...@linaro.org>
>>
>> on ARM and ARM64 devices kernel source tree is not available so
>> insmod "$SRC_TREE/lib/test_bpf.ko" is not working.
>>
>> on these target devices the test_bpf.ko is installed under
>> /lib/modules/`uname -r`/kernel/lib/
>> so use modprobe dry run to check for missing test_bpf.ko module and
>> insert for testing.
>>
>> Signed-off-by: Naresh Kamboju <naresh.kamb...@linaro.org>
>
>
> Acked-by: Daniel Borkmann <dan...@iogearbox.net>
>
> One really small nit that could probably be fixed up along the
> way when applying:
>

Sorry for that.

>> ---
>>   tools/testing/selftests/bpf/test_kmod.sh | 10 ++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/tools/testing/selftests/bpf/test_kmod.sh
>> b/tools/testing/selftests/bpf/test_kmod.sh
>> index a53eb1cb54ef..eab9a970d742 100755
>> --- a/tools/testing/selftests/bpf/test_kmod.sh
>> +++ b/tools/testing/selftests/bpf/test_kmod.sh
>> @@ -14,6 +14,16 @@ test_run()
>> if [ $? -ne 0 ]; then
>> rc=1
>> fi
>> +else
>
>
> Looks like a whitespace slipped in right before the "else",
> so should be removed to only habe the tab indent.

Would it be a good idea to send v3 patch with right indent ?

- Naresh

>
>
>> +   # Use modprobe dry run to check for missing test_bpf
>> module
>> +   if ! /sbin/modprobe -q -n test_bpf; then
>> +   echo "test_bpf: [SKIP]"
>> +   elif /sbin/modprobe -q test_bpf; then
>> +   echo "test_bpf: ok"
>> +   else
>> +   echo "test_bpf: [FAIL]"
>> +   rc=1
>> +   fi
>> fi
>> rmmod  test_bpf 2> /dev/null
>> dmesg | grep FAIL
>>
>


wlcore: DEADLOCK: WARNING: possible circular locking dependency detected

2017-05-18 Thread Naresh Kamboju
361]
[   76.369361]  *** DEADLOCK ***
[   76.369361]
[   76.375304] 1 lock held by irq/56-wl18xx/2354:
[   76.379753]  #0:  (>mutex){+.+.+.}, at: []
wlcore_irq+0xdc/0x1a0 [wlcore]
[   76.388547]
[   76.388547] stack backtrace:
[   76.392922] CPU: 4 PID: 2354 Comm: irq/56-wl18xx Not tainted
4.12.0-rc1-next-20170515 #1
[   76.401032] Hardware name: HiKey Development Board (DT)
[   76.406267] Call trace:
[   76.408720] [] dump_backtrace+0x0/0x240
[   76.414131] [] show_stack+0x14/0x20
[   76.419195] [] dump_stack+0xbc/0xf8
[   76.424258] [] print_circular_bug+0x1f4/0x2e0
[   76.430190] [] __lock_acquire+0x17dc/0x1928
[   76.435947] [] lock_acquire+0xc8/0x290
[   76.441272] [] __mutex_lock+0x78/0x8a8
[   76.446595] [] mutex_lock_nested+0x1c/0x28
[   76.452267] [] rtnl_lock+0x18/0x20
[   76.457402] []
cfg80211_sched_scan_results+0x60/0x230 [cfg80211]
[   76.465253] []
ieee80211_sched_scan_results+0x5c/0x1e0 [mac80211]
[   76.472994] []
wlcore_scan_sched_scan_results+0x24/0x60 [wlcore]
[   76.480624] []
wl18xx_process_mailbox_events+0x60/0x468 [wl18xx]
[   76.488278] [] wl1271_event_handle+0xc4/0x160 [wlcore]
[   76.495056] [] wlcore_irq_locked+0x4e0/0x660 [wlcore]
[   76.501747] [] wlcore_irq+0xe4/0x1a0 [wlcore]
[   76.507682] [] irq_thread_fn+0x28/0x68
[   76.513005] [] irq_thread+0x158/0x1f8
[   76.518242] [] kthread+0x108/0x138
[   76.523217] [] ret_from_fork+0x10/0x40

Best regards
Naresh Kamboju