Hi Neale, Some of classify related functions are defined from 2 places (src/vat/api_format.c vs. src/vnet/classify/vnet_classify.c). On my local setup I noticed that unformat_classify_match is used in api_format.c which caused VPP crash with OOM when I test classify with VPP CLI.
~~~ #3 0x00002aaaacbd425e in os_out_of_memory () at /scratch/jonshin/FDIO/vpp/build-data/../src/vppinfra/unix-misc.c:219 #4 0x00002aaaacbb6633 in clib_mem_alloc_aligned_at_offset (size=46984704388, align=16, align_offset=4, os_out_of_memory_on_failure=1) at /scratch/jonshin/FDIO/vpp/build-data/../src/vppinfra/mem.h:102 #5 0x00002aaaacbb6a6d in vec_resize_allocate_memory (v=0x2aaaaf05646c, length_increment=46984704372, data_bytes=46984704388, header_bytes=4, data_align=16) at /scratch/jonshin/FDIO/vpp/build-data/../src/vppinfra/vec.c:84 #6 0x0000000000454c9a in _vec_resize (v=0x2aaaaf05646c, length_increment=46984704372, data_bytes=46984704384, header_bytes=0, data_align=16) at /scratch/jonshin/FDIO/vpp/build-data/../src/vppinfra/vec.h:142 #7 0x000000000048953f in unformat_classify_match (input=0x2aaaaf081ec0, args=0x2aaaaf0819d0) at /scratch/jonshin/FDIO/vpp/build-data/../src/vpp/api/api_format.c:9839 #8 0x00002aaaacbaf88a in do_percent (input=0x2aaaaf081ec0, va=0x2aaaaf0819d0, f=0x2aaaabfe6079 "") at /scratch/jonshin/FDIO/vpp/build-data/../src/vppinfra/unformat.c:792 #9 0x00002aaaacbafc94 in va_unformat (input=0x2aaaaf081ec0, fmt=0x2aaaabfe6071 "match %U", va=0x2aaaaf0819d0) at /scratch/jonshin/FDIO/vpp/build-data/../src/vppinfra/unformat.c:939 #10 0x00002aaaacbafe3c in unformat (input=0x2aaaaf081ec0, fmt=0x2aaaabfe6071 "match %U") at /scratch/jonshin/FDIO/vpp/build-data/../src/vppinfra/unformat.c:976 #11 0x00002aaaab68058b in classify_session_command_fn (vm=0x2aaaab408360 <vlib_global_main>, input=0x2aaaaf081ec0, cmd=0x2aaaaf064e7c) at /scratch/jonshin/FDIO/vpp/build-data/../src/vnet/classify/vnet_classify.c:2084 ~~~ classify_session_command_fn in vnet_classify.c pass ‘cm, &match, table_index’ parameters as argument expecting unformat_classify_match() is called inside vnet_classify.c file. … if (unformat (input, "match %U", unformat_classify_match, cm, &match, table_index)) But the same named function is called in api_format.c which requires different parameters as argument list. This results in VPP crash with OOM. Can this be fixed as part of your gerrit commit? Ex) use different function name or define static… in api_format.c or any other ways… Any thoughts would appreciated. Regards, Steve From: <vpp-dev-boun...@lists.fd.io> on behalf of William McCall <william.mcc...@gmail.com> Date: Monday, February 20, 2017 at 2:35 PM To: "Neale Ranns (nranns)" <nra...@cisco.com> Cc: Siamak Abdollahzade <siamak_abdollahz...@yahoo.com>, "Andrew Yourtchenko (ayourtch)" <ayour...@cisco.com>, "Ole Troan (otroan)" <otr...@cisco.com>, "vpp-dev@lists.fd.io" <vpp-dev@lists.fd.io> Subject: Re: [vpp-dev] problem in classify command in vpp ahhh that makes more sense :) thanks! On Mon, Feb 20, 2017 at 5:35 PM, Neale Ranns (nranns) <nra...@cisco.com<mailto:nra...@cisco.com>> wrote: Hi William, One of those it’s easy if you know what to look for bugs, otherwise a real headache to find. But a one line fix, so I might as well … https://gerrit.fd.io/r/#/c/5440/ /neale From: <vpp-dev-boun...@lists.fd.io<mailto:vpp-dev-boun...@lists.fd.io>> on behalf of William McCall <william.mcc...@gmail.com<mailto:william.mcc...@gmail.com>> Date: Monday, 20 February 2017 at 15:36 To: "Dave Barach (dbarach)" <dbar...@cisco.com<mailto:dbar...@cisco.com>> Cc: Siamak Abdollahzade <siamak_abdollahz...@yahoo.com<mailto:siamak_abdollahz...@yahoo.com>>, "Andrew Yourtchenko (ayourtch)" <ayour...@cisco.com<mailto:ayour...@cisco.com>>, "Ole Troan (otroan)" <otr...@cisco.com<mailto:otr...@cisco.com>>, "vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>" <vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>> Subject: Re: [vpp-dev] problem in classify command in vpp hmm.. i thought I did with "make debug" and thought the same thing too (sorta hoping for an easier fix where my talents could be more useful)... alas, i SI'ed through the vnet_classify_new_table function and got here and validated all the steps in the macro to yield this bad result (plus matched the asm piece-for-piece with the macro code). Am I missing something in building/using the debug image? I'm very unfamiliar with the pool allocation mechanisms.. maybe there is something I could watch/read that would explain/help me debug it better? naturally, the mask pointer definitely looks off, but haven't gotten to any dereference of it in the debugger (yet). On Mon, Feb 20, 2017 at 1:45 PM, Dave Barach (dbarach) <dbar...@cisco.com<mailto:dbar...@cisco.com>> wrote: Try it with a debug image. Mask==0x1 => SIGSEGV, with probability 1. Thanks… Dave From: vpp-dev-boun...@lists.fd.io<mailto:vpp-dev-boun...@lists.fd.io> [mailto:vpp-dev-boun...@lists.fd.io<mailto:vpp-dev-boun...@lists.fd.io>] On Behalf Of William McCall Sent: Monday, February 20, 2017 7:58 AM To: Ni, Hongjun <hongjun...@intel.com<mailto:hongjun...@intel.com>> Cc: Siamak Abdollahzade <siamak_abdollahz...@yahoo.com<mailto:siamak_abdollahz...@yahoo.com>>; Andrew Yourtchenko (ayourtch) <ayour...@cisco.com<mailto:ayour...@cisco.com>>; Ole Troan (otroan) <otr...@cisco.com<mailto:otr...@cisco.com>>; vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> Subject: Re: [vpp-dev] problem in classify command in vpp looks like it is getting hung up in pool_get_aligned macro right here.. guessing due to something that was supposed to be done earlier: if (P) \ _pool_var (l) = vec_len (_pool_var (p)->free_indices); Hopefully helpful debugging info: Thread 1 "vpp_main" received signal SIGSEGV, Segmentation fault. 0x00007ffff66598dc in vnet_classify_new_table (cm=0x7ffff7608500 <vnet_classify_main>, mask=0x1 <error: Cannot access memory at address 0x1>, nbuckets=2, memory_size=2097152, skip_n_vectors=1, match_n_vectors=1) at /home/comm3c/vpp2/build-data/../src/vnet/classify/vnet_classify.c:118 118 pool_get_aligned (cm->tables, t, CLIB_CACHE_LINE_BYTES); 0x00007ffff665989c <vnet_classify_new_table+91>: 48 8b 45 88 mov -0x78(%rbp),%rax -0x78(%rbp) is cm->tables aka P in the macro 0x00007ffff66598a0 <vnet_classify_new_table+95>: 48 8b 00 mov (%rax),%rax 0x00007ffff66598a3 <vnet_classify_new_table+98>: 48 89 c7 mov %rax,%rdi 0x00007ffff66598a6 <vnet_classify_new_table+101>: e8 77 ec ff ff callq 0x7ffff6658522 <pool_header> 0x00007ffff66598ab <vnet_classify_new_table+106>: 48 89 45 a0 mov %rax,-0x60(%rbp) -0x60(%rbp) is _pool_p, a pool header. Set pool_l = 0 0x00007ffff66598af <vnet_classify_new_table+110>: 48 c7 45 98 00 00 00 00 movq $0x0,-0x68(%rbp) Check if P (cm->tables) exists: 0x00007ffff66598b7 <vnet_classify_new_table+118>: 48 8b 45 88 mov -0x78(%rbp),%rax 0x00007ffff66598bb <vnet_classify_new_table+122>: 48 8b 00 mov (%rax),%rax 0x00007ffff66598be <vnet_classify_new_table+125>: 48 85 c0 test %rax,%rax 0x00007ffff66598c1 <vnet_classify_new_table+128>: 74 28 je 0x7ffff66598eb <vnet_classify_new_table+170> Check if _pool_p free indicies either indices or 0. Relevant portion vppinfra/vec_bootstrap.h:142:#define vec_len(v) ((v) ? _vec_len(v) : 0) vppinfra/vec_bootstrap.h:134:#define _vec_len(v) (_vec_find(v)->len) vppinfra/vec_bootstrap.h:73:#define _vec_find(v) ((vec_header_t *) (v) - 1) 0x00007ffff66598c3 <vnet_classify_new_table+130>: 48 8b 45 a0 mov -0x60(%rbp),%rax 0x00007ffff66598c7 <vnet_classify_new_table+134>: 48 8b 40 08 mov 0x8(%rax),%rax 0x00007ffff66598cb <vnet_classify_new_table+138>: 48 85 c0 test %rax,%rax 0x00007ffff66598ce <vnet_classify_new_table+141>: 74 12 je 0x7ffff66598e2 <vnet_classify_new_table+161> Subtract 4 from pointer ((vec_header_t *) (v) - 1 ) from pool_l. 0x00007ffff66598d0 <vnet_classify_new_table+143>: 48 8b 45 a0 mov -0x60(%rbp),%rax 0x00007ffff66598d4 <vnet_classify_new_table+147>: 48 8b 40 08 mov 0x8(%rax),%rax 0x00007ffff66598d8 <vnet_classify_new_table+151>: 48 83 e8 04 sub $0x4,%rax Dies here trying to mov address 0x9fffffffc to EAX => 0x00007ffff66598dc <vnet_classify_new_table+155>: 8b 00 mov (%rax),%eax Included for context: 0x00007ffff66598de <vnet_classify_new_table+157>: 89 c0 mov %eax,%eax 0x00007ffff66598e0 <vnet_classify_new_table+159>: eb 05 jmp 0x7ffff66598e7 <vnet_classify_new_table+166> 0x00007ffff66598e2 <vnet_classify_new_table+161>: b8 00 00 00 00 mov $0x0,%eax 0x00007ffff66598e7 <vnet_classify_new_table+166>: 48 89 45 98 mov %rax,-0x68(%rbp) 0x00007ffff66598eb <vnet_classify_new_table+170>: 48 83 7d 98 00 cmpq $0x0,-0x68(%rbp) 0x00007ffff66598f0 <vnet_classify_new_table+175>: 74 7c je 0x7ffff665996e <vnet_classify_new_table+301> (gdb) info registers rax 0x9fffffffc 42949672956 rbx 0x1 1 rcx 0x0 0 rdx 0xffffffffffffffe8 -24 rsi 0x8 8 rdi 0x14 20 rbp 0x7fffb5ddfa70 0x7fffb5ddfa70 (gdb) x/2x 0x7fffb5ddfa70-0x60 0x7fffb5ddfa10: 0xb4bae750 0x00007fff (gdb) print _pool_p $25 = (pool_header_t *) 0x7fffb4bae750 (gdb) x/2x (0x7fffb4bae758) ->_pool_p + 8 0x7fffb4bae758: 0x00000000 0x0000000a and 0xA00000000 - 0x4 = 0x9fffffffc On Fri, Feb 17, 2017 at 7:12 AM, Ni, Hongjun <hongjun...@intel.com<mailto:hongjun...@intel.com>> wrote: Hey, I met the same issue when I using latest VPP code. In VPP 17.01, CLI command “classify table mask l3 ip4 proto” works well. Below is the error and bt log: Could someone take a look at it? Thanks a lot. DBGvpp# classify table match 1 mask l3 ip4 proto Thread 1 "vpp_main" received signal SIGSEGV, Segmentation fault. 0x00007ffff68e67b4 in vnet_classify_new_table (cm=0x7ffff7608320 <vnet_classify_main>, mask=0x1 <error: Cannot access\ memory at address 0x1>, nbuckets=2, memory_size=2097152, skip_n_vectors=1, match_n_vectors=1) at /root/vpp/build-data/../src/vnet/classify/vnet_classify.c:118 (gdb) bt #0 0x00007ffff68e67b4 in vnet_classify_new_table (cm=0x7ffff7608320 <vnet_classify_main>, mask=0x1 <error: Cannot ac\ cess memory at address 0x1>, nbuckets=2, memory_size=2097152, skip_n_vectors=1, match_n_vectors=1) at /root/vpp/build-data/../src/vnet/classify/vnet_classify.c:118 #1 0x00007ffff68e98ad in vnet_classify_add_del_table (cm=0x7ffff7608320 <vnet_classify_main>, mask=0x1 <error: Canno\ t access memory at address 0x1>, nbuckets=2, memory_size=2097152, skip=1, match=1, next_table_index=4294967295, miss_next_index=4294967295, table_index=0x7fffb6089b70, current_data_flag=0 '\000', current_data_offset=0, is_add\ =1, del_chain=0) at /root/vpp/build-data/../src/vnet/classify/vnet_classify.c:675 #2 0x00007ffff68ec6cd in classify_table_command_fn (vm=0x7ffff7999340 <vlib_global_main>, input=0x7fffb6089ef0, cmd=\ 0x7fffb6060e30) at /root/vpp/build-data/../src/vnet/classify/vnet_classify.c:1461 #3 0x00007ffff76ccb08 in vlib_cli_dispatch_sub_commands (vm=0x7ffff7999340 <vlib_global_main>, cm=0x7ffff79995a8 <vl\ ib_global_main+616>, input=0x7fffb6089ef0, parent_command_index=393) at /root/vpp/build-data/../src/vlib/cli.c:484 #4 0x00007ffff76cca16 in vlib_cli_dispatch_sub_commands (vm=0x7ffff7999340 <vlib_global_main>, cm=0x7ffff79995a8 <vl\ ib_global_main+616>, input=0x7fffb6089ef0, parent_command_index=0) at /root/vpp/build-data/../src/vlib/cli.c:462 #5 0x00007ffff76ccded in vlib_cli_input (vm=0x7ffff7999340 <vlib_global_main>, input=0x7fffb6089ef0, function=0x7fff\ f7755b97 <unix_vlib_cli_output>, function_arg=0) at /root/vpp/build-data/../src/vlib/cli.c:558 #6 0x00007ffff775a3b7 in unix_cli_process_input (cm=0x7ffff79991a0 <unix_cli_main>, cli_file_index=0) at /root/vpp/b\ uild-data/../src/vlib/unix/cli.c:2033 #7 0x00007ffff775ae1e in unix_cli_process (vm=0x7ffff7999340 <vlib_global_main>, rt=0x7fffb6079000, f=0x0) at /root/\ vpp/build-data/../src/vlib/unix/cli.c:2130 #8 0x00007ffff76f3aa3 in vlib_process_bootstrap (_a=140736230333104) at /root/vpp/build-data/../src/vlib/main.c:1218 #9 0x00007ffff5fd2668 in clib_calljmp () at /root/vpp/build-data/../src/vppinfra/longjmp.S:110 #10 0x00007fffb5041a80 in ?? () #11 0x00007ffff76f3bce in vlib_process_startup (vm=0x7fffffffe260, p=0x406220 <_start>, f=0x7ffff7999340 <vlib_global\ _main>) at /root/vpp/build-data/../src/vlib/main.c:1240 Backtrace stopped: previous frame inner to this frame (corrupt stack?) Thanks, Hongjun From: vpp-dev-boun...@lists.fd.io<mailto:vpp-dev-boun...@lists.fd.io> [mailto:vpp-dev-boun...@lists.fd.io<mailto:vpp-dev-boun...@lists.fd.io>] On Behalf Of Siamak Abdollahzade via vpp-dev Sent: Wednesday, February 15, 2017 2:57 PM To: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> Subject: [vpp-dev] problem in classify command in vpp Hi all. I am new in VPP and I'm trying to use classify command to filter specific traffic. I've followed [vpp-dev] Question: Classification with hex mask<https://lists.fd.io/pipermail/vpp-dev/2016-June/001408.html>. At first, I entered this command: vpp# classify table mask l3 ip4 src dst proto the result was: classify table: match count required I've done some research around this error, but I couldn't find anything helpful. So, I was wondering if there is a manual for this command? or can you tell me what the problem is? I also tried to enter an integer number as match and I got this error: exec error: Misc thanks. [vpp-dev] Question: Classification with hex mask _______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> https://lists.fd.io/mailman/listinfo/vpp-dev -- William McCall -- William McCall -- William McCall
_______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev