vlib: allocating buffers on thread-x and freeing them on thread-y causes 17/10317/1
authorSteven <[email protected]>
Tue, 30 Jan 2018 04:09:09 +0000 (20:09 -0800)
committerSteven <[email protected]>
Tue, 30 Jan 2018 04:20:47 +0000 (20:20 -0800)
commita7effa1b072463f12305a474f082aeaffb7ada4b
tree6db4b05344fbdb42bf642ac1f045622739a7ef1b
parent92b15bcea4c6c5e62415a8207463eb9a897630c6
vlib: allocating buffers on thread-x and freeing them on thread-y causes
a crash on debug image (VPP-1151)

In debug image, there is extra code to validate the buffer when it is
freed. It uses the hash table to lookup the buffer index with spinlock
to prevent contention. However, there is one spinlock for each worker
thread. So allocating the buffer on thread-x and freeing the same buffer
on thread-y causes the validation to fail on thread-y. The fix is to
have only one spinlock, stored in vlib_global_main.

Change-Id: Ic383846cefe84a3e262255afcf82276742f0f62e
Signed-off-by: Steven <[email protected]>
src/plugins/ixge/ixge.c
src/vlib/buffer.c
src/vlib/buffer_funcs.h
src/vnet/replication.c