147 Commits

Author SHA1 Message Date
Nathan Skrzypczak
a30d969297 session: fix msg freeing on error
Type: fix

Change-Id: I0807f84737d5e98e69e9ed27a1de6813b2ddd138
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
(cherry picked from commit 1afa7afffad6e296a97556aa4c9482f4cd544074)
2019-09-30 15:32:48 +00:00
Florin Coras
154e4a6cb7 svm: fix fifo hdr freelist allocation
Type: fix

Change-Id: Ia362ad821db1fd506e973e1844cc3ec74703cc17
Signed-off-by: Florin Coras <fcoras@cisco.com>
(cherry picked from commit 73cad33b56ffc08943e9c0d73ecb14466558baae)
2019-09-27 09:36:42 +00:00
Guanghua Zhang
bb83b16a3c svm: fix svmtool and svmdbtool segment fault.
Type: fix
Ticket: VPP-1741

Signed-off-by: Guanghua Zhang <ghzhang@fiberhome.com>
Change-Id: Ifd3abaa5ec912378dbc7b73c4863aad26777dd7e
(cherry picked from commit 60f16c22b44625d517830b4266a225d3abaccefc)
2019-08-14 15:10:31 +00:00
Florin Coras
58e95bc2cd svm: fix fifo max writeable chunk computation
Type:fix

Change-Id: I60fdd7651a3d3fac505e7aec7a41f9d096022895
Signed-off-by: Florin Coras <fcoras@cisco.com>
(cherry picked from commit fcd26a039409e2697a6797e74b0c45544503e853)
2019-08-09 13:53:03 +00:00
Florin Coras
0a6562c780 svm: fix fifo growth on dequeue with drop
Type:fix

Change-Id: I39c339abf1b51105ef1bcf3d6f0f4f6ded54f32d
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-08-05 10:07:09 -07:00
jaszha03
f25e7cfa5c vppinfra: refactor use of CLIB_MEMORY_BARRIER ()
All instances of test_and_set locks used the following sequence
to release the locks:

CLIB_MEMORY_BARRIER ();
p->lock = 0; // p is a generic struct with a TAS lock

Use clib_atomic_release to generate more efficient assembly code.

Type: refactor

Change-Id: Idca3a38b1cf43578108bdd1afe83b6ebc17a4c68
Signed-off-by: Jason Zhang <jason.zhang2@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
2019-07-30 16:22:03 +00:00
jaszha03
0455c435af vppinfra: conformed spinlocks to use CLIB_PAUSE
Modified test-and-set spin locks to call CLIB_PAUSE () when spinning
for code consistency. Decreases the memory bandwidth consumed.

Type: fix

Change-Id: I1cca4f87f44f23f257c7a35466cd2e7767072f51
Signed-off-by: Jason Zhang <jason.zhang2@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
2019-07-30 11:46:19 +00:00
Florin Coras
2b5fed8696 session: fix vpp to app msg generation
Type:fix

Freeing mq messages in vpp (producer), if enqueueing fails, invalidates
consumer assumption that messages can be freed without a lock.

Change-Id: I748a33b8846597bdad865945d8e899346d482434
Signed-off-by: Florin Coras <fcoras@cisco.com>
Signed-off-by: Tal Saiag <tal.saiag@gmail.com>
2019-07-29 20:46:46 +00:00
Benoît Ganne
0af49a8fc9 svm: handles heap dlmalloc allocation failure
Type: fix
Fixes: 6a5adc3695

Change-Id: I21091fc2938cababeb28bacf7c5e457a05ab6272
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-07-12 16:21:03 +00:00
Florin Coras
eaacce4753 svm: fix multi-chunk fifo alloc and add more tests
Type: fix

- make sure that chunks and the rbtree are initialized if fifo segment
allocates multiple chunks for the fifo.
- ensure head/tail chunks are updated on all enqueue/dequeue events,
including when dropping data.
- more unit tests

Also fixes dequeue drop updates of head chunk.

Change-Id: I77f3550bc4e8b4e077f80ea87fe82b83ed013aeb
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-07-03 11:26:36 +00:00
Florin Coras
6898e5cb89 svm: fix shm segment delete
Type:fix

Change-Id: Ia8f3496bf24a7dbe0a295b038aa6dfa24f034989
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-07-02 19:45:07 +00:00
Florin Coras
2d379d8cc7 svm: rename fifo tx notifications to reflect use
Type: refactor

Change-Id: I651db44acdcb666a9c63e1037352cf88c68795b5
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-29 00:30:41 +00:00
Nathan Skrzypczak
e82a7ade8a quic : Use TX event for app read notification
Type: feature

Change-Id: I1846cdeb35f079249f66a0351aa244c540923a43
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2019-06-28 19:28:17 +00:00
Florin Coras
1c91c77307 svm: fix fifo segment free chunk bytes accounting
Type:fix

Change-Id: Icab89337eb3dbdc93d0fb453cfd34090026072b7
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-26 15:29:45 +00:00
Florin Coras
8eb3e07dea svm: make sure chunk search does not return tnil
Type:fix

Change-Id: I8405bf8d93b4468c54f4f3c5dcd21ef91a6b1048
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-25 14:29:22 +00:00
Nathan Skrzypczak
b4c677526b session: full lock on session_send_evt_to_thread
Type: fix

This was causing issues in QUIC when an app client & the protocol
app compete for the worker msg_queue. Might not be ideal performance-
wise.

Change-Id: I629892253d5b5d968f31ad1d56f18463e143d6b4
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2019-06-24 23:35:28 +00:00
Lijian.Zhang
b6d61e347a session: fix memory out of bound issue
Ring data space is following ring vec_header_t and ring elements immediately.
Add verification code in session_test.

Type: fix

Change-Id: I0bfa096a9f459128a588821d99b5cdb4f10ede38
Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com>
Reviewed-by: Sirshak Das <Sirshak.Das@arm.com>
2019-06-18 14:34:13 +00:00
Florin Coras
f0b68a55a6 ssvm: disable private segment expand
Change-Id: I893621d9a6520c6e24026a9bbaf44e9e69f60bcb
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-11 00:24:28 +00:00
Florin Coras
5368bb016f svm: improve fifo segment show
Type: refactor

Change-Id: I6933205cfb04bc31cabe6e3b1a8044cace93f84c
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-06-09 09:25:24 -07:00
Vratko Polak
a29d18ae6b svm_queue_timedwait_inline: lock after wait
This fixes a typo introduced in https://gerrit.fd.io/r/18198

Change-Id: I634a06be95154d3e1c5e5711ea69f19c9c4cca44
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-05-21 17:02:40 +00:00
Ping Yu
a474894a4a consolidate all mutux opertion
replace all pthread_mutex_lock/unlock to be svm_queue_lock/unlock
So there all operation is based on defined mutux, and it can help us
to debug or replace mutux locking method

Change-Id: I9aeeb03bbbbf3d7a824c06a535e5d6a6b463b42c
Signed-off-by: Ping Yu <ping.yu@intel.com>
2019-05-20 09:28:10 +00:00
Florin Coras
f9d4ab4272 svm: improve fifo segment prealloc support
- track fifo segment free and chunk freelist memory
- improve fifo alloc. If there are enough chunks to satisfy a fifo
  allocation request but not enough free memory, allocate a multi-chunk
  fifo
- add apis to preallocate chunks and fifo headers
- more tests

Change-Id: If18dba7ab856272c9f565d36ac36365139793e0b
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-14 18:40:20 +00:00
Florin Coras
404b8a36e7 session: segment manager fixes
- fix segment size rounding for 4GB segments
- fix initialization of first segment size
- cleanup fifo segment info retrieval

Change-Id: I5ebf20f71ea797087653e7e76fa2e37b2686ec40
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-09 20:36:14 +00:00
Florin Coras
cefd5d8806 svm: decouple fifo and default chunk allocation
Default chunk is no longer embedded into the fifo and on free is
returned to its respective chunk list.

Change-Id: Ifc5d214eaa6eca44356eb79dd75650fb8569113f
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-07 20:33:44 +00:00
Florin Coras
344ce42778 session/svm: apis for fifo shrinking
Change-Id: Ie519683bb90aae6fb95f2a09e251cded1890ed41
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-03 20:27:45 +00:00
Florin Coras
a7570b0378 svm: basic support for fifo shrinking
As opposed to growing, this is not a bulk operation, instead dependent
on how the producer/consumer advance head and tail, the fifo will shrink
in one or multiple steps.

Only once the fifo's nitems and size are reduced to their appropriate
values, equal or larger to what was requested, can the fifo chunks be
collected by the owner. Chunk collection must be done with the segment
heap pushed.

Change-Id: Iae407ccf48d85320aa3c1e0304df56c5972c88c1
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-03 20:20:42 +00:00
Florin Coras
29a59c3ae1 svm: store normalized head/tail for fifo
If head/tail are stored as "absolute" values that are normalized to [0,
fifo_size] interval, when fifo is shrunk/grown the consumer and producer
have to independently update to the new fifo size and fix head and tail,
respectively.

If the head and tail are stored as normalized values, under the right
conditions, they don't need to be fixed when fifo size changes.

This reverts one of the changes in gerrit 18223.

Change-Id: I55a908828afe90925cf7c20186a940b25e5805f9
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-03 14:34:46 +00:00
Benoît Ganne
eecdf93aea svm: remove dead code triggering overflow
split_point is incremented twice per iteration whereas we only check for
*split_point != '\0' at the beginning of the iteration.
This code seems dead so remove it altogether.

Change-Id: Iabaf26cd5c0c8f747e267bcff044540a2376d3f6
Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-05-01 18:11:10 +00:00
Florin Coras
87b15cebda svm: more fifo refactor/cleanup
Change-Id: Ie76c69641c8598164d0d00fd498018037258fd86
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-30 16:59:49 +00:00
Florin Coras
de146e5d5f svm: fix fifo tail/head/ooo logic for u32 wrap
These were introduced with the switch to unbound tail/head size, so they
only affect master. Added unit tests to avoid future surprises.

Change-Id: I83b6c9efbe31d8092ba59b8e2ed46f4da97f35db
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-27 20:05:06 +00:00
Florin Coras
b095a3cd22 svm: fifo segment support for chunk allocation
Change-Id: Ie96706b4d8bcb32d2d5f065bc765f95f4e9369e7
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-26 10:23:38 +00:00
Florin Coras
88001c64e9 session: cleanup segment manager and fifo segment
Change-Id: I984f347fb465c0c405cef668d8690457e81788e2
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-25 18:05:16 +00:00
Florin Coras
4375fa312e svm: fifo ooo reads/writes with multiple chunks
Change-Id: If23a04623a7138c9f6c98ee9ecfa587396618a60
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-24 11:31:55 +00:00
Florin Coras
d35d423295 svm: move mq test to ut plugin
Change-Id: Ic4e882b784e5773198e55bd97b1bbd3d6dda888a
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-24 11:31:32 +00:00
Florin Coras
52ef4c584e svm: move fifo tests to ut plugin
Change-Id: I638facf6e2128334c3d1a5a8494f378505831e1b
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-24 11:28:45 +00:00
Florin Coras
99ad2fc3e4 svm: reorganize fifo march code
- make only the chunk copying (memcpy) code march aware
- cleanup dependencies

Change-Id: I369378264cacfcdaf0823353b957876554eaa17c
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-20 23:25:22 +00:00
Florin Coras
2309e7a481 svm: support addition of chunks to fifos
Change-Id: Ia56cad89b85b7a99ab4bfb85318a45a71381fb53
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-19 15:15:39 +00:00
Florin Coras
0a84680674 svm: allow indirect fifo data chunks
Fifos can use multiple memory chunks for simple read/write operations.
Adding/removing chunks after assignment not yet supported.

Change-Id: I2aceab6aea78059d74e0d3a9993c40d5196d077b
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-18 13:16:18 +00:00
Sirshak Das
28aa539f7d svm_fifo rework to avoid contention on cursize
Problems Addressed:
- Contention of cursize by producer and consumer.
- Reduce the no of modulo operations.

Changes:
- Synchronization between producer and consumer changed from cursize
  to head and tail indexes
  Implications: reduces the usable size of fifo by 1.
- Using weaker memory ordering C++11 atomics to access head and tail
  based on producer and consumer role.
- Head and tail indexes are unsigned 32 bit integers. Additions and
  subtraction on them are implicit 32 bit Modulo operation.
- Adding weaker memory ordering variants of max_enq, max_deq, is_empty
  and is_full Using them appropriately in all places.

Perfomance improvement (iperf3 via Hoststack):

iperf3 Server: Marvell ThunderX2(AArch64) - iperf3 Client: Skylake(x86)
   ~6%(256 rxd/txd) - ~11%(2048 rxd/txd)

Change-Id: I1d484e000e437430fdd5a819657d1c6b62443018
Signed-off-by: Sirshak Das <sirshak.das@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2019-04-16 19:33:21 +00:00
Florin Coras
c5df8c71cc host stack: update stale copyright
Change-Id: I33cd6e44d126c73c1f4c16b2041ea607b4d7f39f
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-08 20:29:16 +00:00
Florin Coras
02ad5bc0a8 session: allow more fifos in preallocated segments
Change-Id: I335c092a8965c5dbec58603e9f5063dc8e3fc3ed
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-04-03 08:19:53 +00:00
Florin Coras
881d13ede7 svm/atomics: add clib_atomic_swap_rel_n
Change-Id: Iea2c173000570043beafef58ca923463ce76d872
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-22 17:30:17 +00:00
Florin Coras
4b76112dc4 session/fifo: make event unset atomic
Ensures that fifo cursize loads cannot be speculated to before the event
unset.

Change-Id: Ia7c20c510d58f26a8e9b82d3982c6d4143a3a4d6
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-21 13:56:02 -07:00
Florin Coras
176bcb28d8 svm mq: add unit test
Change-Id: I2f1fa15a99163b9c105707484503dc9502265c52
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-12 19:29:36 +00:00
Florin Coras
f8bdc6ef49 svm: avoid heap push/pop on fifo free
Change-Id: Id6a7698da0c7b43313554d736c4df60b820beb80
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-04 11:15:59 +00:00
Florin Coras
0964985cdd svm: fix mem ordering for enqueue nocopy
Change-Id: Ibc852f88747125a895415570349975d3b379a6f4
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-02-21 12:26:51 +00:00
Florin Coras
0ef8ef2b47 vls: multi-process and multi-threaded apps improvements
- More fine tuning for multi-process applications.
- Experimental support for multi-thread apps. This is meant for app
  whose threads are not vcl workers and the sessions are shared between
  them.

Change-Id: Ie07651da5f2cdcf39f5dead5431f50ad39cf3f74
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-29 16:36:06 +00:00
Florin Coras
72b04288d9 vcl/session: replicate events for shared sessions
Change-Id: I7fb5402d4a530b5f2ffd9bb5787632099f4b4189
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-17 20:31:39 +00:00
Florin Coras
1bcad5cdb7 session/vcl: improve fifo tx notifications
Change-Id: Ied476c417c8ba5b4d7c615125c36eecd9ca64fbc
Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-10 21:01:05 +00:00
David Johnson
d9818dd68c Fixes for buliding for 32bit targets:
* u32/u64/uword mismatches
  * pointer-to-int fixes
  * printf formatting issues
  * issues with incorrect "ULL" and related suffixes
  * structure alignment and padding issues

Change-Id: I70b989007758755fe8211c074f651150680f60b4
Signed-off-by: David Johnson <davijoh3@cisco.com>
2019-01-02 10:55:55 -05:00