I didn't get around to reporting it, but I did run into that same crash
when I did not disable GRO (Generic Receive Offload) on the interfaces
being used with linux-generic (e.g., ethtool -K eth1 gro off) . With
GRO, the OS will combine frames into larger frames before passing them
off to the AF_PACKET application, which causes the resulting frame to be
larger than the buffer it is blindly written into. Eventually this
memory corruption causes a crash, especially quickly with bidirectional
TCP traffic. I had this patch sitting in my tree, but I don't know
whether the desired behavior would be to drop those frames or truncate them:
diff --git a/platform/linux-generic/odp_packet_socket.c
b/platform/linux-generic/odp_packet_socket.c
index 68983eb..c17aff9 100644
--- a/platform/linux-generic/odp_packet_socket.c
+++ b/platform/linux-generic/odp_packet_socket.c
@@ -606,6 +606,13 @@ static inline unsigned pkt_mmap_v2_rx(int sock,
struct ring *ring,
if (odp_unlikely(pkt_table[i] ==
ODP_PACKET_INVALID))
break;
+ if (odp_unlikely(pkt_len + frame_offset >
odp_buffer_size(pkt_table[i])))
+ {
+ printf("Truncating %u-byte packet to fit
into a %zu-byte buffer (frame offset = %zu)\n",
+ pkt_len,
odp_buffer_size(pkt_table[i]), frame_offset);
+ pkt_len = odp_buffer_size(pkt_table[i])
- frame_offset;
+ }
+
l2_hdr = odp_packet_addr(pkt_table[i])
+ frame_offset;
memcpy(l2_hdr, pkt_buf, pkt_len);
On 12/02/2014 10:40 PM, Santosh Shukla wrote:
Sorry for no response, I am busy with no_hz_full.
I did saw such crashes but addressed by my own in past. I thought I
was related to my setup and pressing time line to demo work in past so
ignored. Since you too able emulate it therefore file a bug per mike
suggested link, assign to me and I'll respond per my bandwidth.
Thanks.
On 3 December 2014 at 04:19, Mike Holmes <[email protected]
<mailto:[email protected]>> wrote:
Thanks Shmulik
Hopefully Santosh gets some cycles to look, there is a lot moving
right now which does not help.
Worst case can you log it as a bug
https://bugs.linaro.org/enter_bug.cgi?product=OpenDataPlane
On 2 December 2014 at 05:45, Shmulik Ladkani
<[email protected] <mailto:[email protected]>> wrote:
Hi,
I'm having various SIGSEGV crashes in odp_l2fwd during a tcp
transfer
between 2 interfaces.
Running on Linux x86 32bit (3.11); Clean ODP at 1c6711ed1d
(Nov 27).
# odp_l2fwd -i veth0,veth1 -m 1
An example backtrace:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb62a5b40 (LWP 22634)]
odp_packet_init (pkt=3288626) at odp_packet.c:32
32 memset(start, 0, len);
(gdb) bt
#0 odp_packet_init (pkt=3288626) at odp_packet.c:32
#1 0x0804df0f in odph_packet_alloc (pool_id=2) at
../../helper/include/odph_packet.h:58
#2 pkt_mmap_v2_rx (sock=<optimized out>, if_mac=0xb7fd22d4
"\002\217^\202u\252", frame_offset=2, pool=2, len=8,
pkt_table=0xb62a5180, ring=0xb7fd2240)
at odp_packet_socket.c:573
#3 recv_pkt_sock_mmap (pkt_sock=0xb7fd2240,
pkt_table=0xb62a5180, len=8) at odp_packet_socket.c:893
#4 0x0804c8c5 in odp_pktio_recv (id=2, pkt_table=0xb62a5180,
len=8) at odp_packet_io.c:276
#5 0x0804cd20 in pktin_deq_multi (qentry=0xb7bed940,
buf_hdr=0xb62a51f0, num=4) at odp_packet_io.c:471
#6 0x0804ea1f in odp_queue_deq_multi (handle=98,
buf=0xb62a5b1c, num=4) at odp_queue.c:422
#7 0x0804efe7 in schedule (max_deq=4, max_num=1,
out_buf=0xb62a529c, out_queue=0x0) at odp_schedule.c:296
#8 schedule_loop (out_queue=out_queue@entry=0x0,
wait=<optimized out>, out_buf=0xb62a529c, max_num=1,
max_deq=4) at odp_schedule.c:349
#9 0x0804f1a5 in odp_schedule (out_queue=0x0, wait=0) at
odp_schedule.c:382
#10 0x08049d7e in pktio_queue_thread (arg=0x16) at odp_l2fwd.c:224
#11 0xb7dd2efb in start_thread (arg=0xb62a5b40) at
pthread_create.c:309
#12 0xb7d0adfe in clone () at
../sysdeps/unix/sysv/linux/i386/clone.S:129
When running in "basic" receive mode
(ODP_PKTIO_DISABLE_SOCKET_MMSG=y
ODP_PKTIO_DISABLE_SOCKET_MMAP=y) no crashes observed.
Is this familiar?
Regards,
Shmulik
_______________________________________________
lng-odp mailing list
[email protected] <mailto:[email protected]>
http://lists.linaro.org/mailman/listinfo/lng-odp
--
*Mike Holmes*
Linaro Sr Technical Manager
LNG - ODP
_______________________________________________
lng-odp mailing list
[email protected] <mailto:[email protected]>
http://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp