aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_locked.c
AgeCommit message (Collapse)AuthorFilesLines
2021-07-29vcl: move vls pool lock to process local stateFlorin Coras1-6/+7
We only support one vls worker per process and therefore should not share lock between processes. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I57bb536cf3bf04e8de031b07cb885f80b4fa03c9
2021-07-29vcl: vls cleanup and more docsFlorin Coras1-101/+167
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: If32dd21842b99e176db1d4eb9f6c6a51fbff1bfe
2021-07-27vcl: fix some risk after fork()liuyacan1-9/+17
1.Not only the session in state VCL_STATE_LISTEN_NO_MQ has no queue. Session in CLOSED also didn't. 2.Refresh vls->wrk_index in child process, or this value will become invalid if parent exit. 3.Set vlsh->vls_wrk_index once vls_worker_alloc() is called, then vls_get_worker_index() can be simplified. Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: If4f5e134915eafd74ce38f585d65ce8836b2e553
2021-07-25vcl: fix shutdown deadlock issueliuyacan1-1/+1
Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I4974815ecb0e3bff01af983f086ca15d77fd6fb4
2021-07-14vcl:fix segfault when unshare NO_MQ sessionliuyacan1-1/+2
Session in LISTEN_NO_MQ state has no vpp_evt_q.This would cause a segfault when vcl try to send msg to vpp. Type: fix Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I0d21831dbed148cd1b0ca7c083aeeef9e813ef2f
2021-06-29vcl: Don't use app_socket_api to notify VPP in parent when child exitedwanghanlin1-1/+5
Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: Icd2fc3cc2d0a0a6060abfb262044cf9e09ab4ba2
2021-06-22vcl: validate vep handle when copying sessions on forkwanghanlin1-0/+31
When copying sessions from parent on fork, we should validate vep handle in order to EPOLL_CTL_DEL in vcl_session_cleanup correctly when child exit. Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: I7696ecd898460c9a296d2800e46c7140e2218ed7
2021-06-22vcl: move child wrk cleanup from sighandler to vls_epoll_waitwanghanlin1-1/+42
Main process may enter sighandler with a lock, such as lock in localtime or in mspace_free, and child wrk cleanup may try to get such locks and cause deadlock. The patch move cleanup to vls_epoll_wait to wait app's next call. Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: I9b208038a0f49b0ace44684189234aeac9d94730
2021-06-16vcl: fix fifo sharingFlorin Coras1-2/+1
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Iec1fe8315a057214901250d5fb06d1c1e33dda46
2021-06-14vcl: improve shutdown()liuyacan1-2/+2
This commit does following: - Change the behavior of shutdown() with SHUT_RDWR flag. - Check SHUT_RD flag when read() - Change the errno when write() after SHUT_WR - Remove unused code All the above modification passed the packetdrill test. Type: improvement Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I0c81f52e563562e58580d70976526b898e65e915
2021-05-12session: support half-close connectionliuyacan1-0/+18
Some app(e.g. Envoy) may call shutdown() instead of close() when draining connection. Type: improvement Signed-off-by: liuyacan <liuyacan@corp.netease.com> Change-Id: I9543b9ca3caa87b10b134fd1fc4019124e41e4d2
2021-03-28vcl: fix only first epoll listen session be registerednandfan1-14/+2
If configure listen port more than 1 with epoll in nginx, only first listen port can be registered successed in nginx worker process. Type: fix Signed-off-by: nandfan <fanyufei521@outlook.com> Change-Id: Iec2e058ee972a2cd5b2d1d7d20d373dc17084ce1
2021-02-22vcl: fix vls_intercept_sigchld_handler be called recursivelynandfan1-0/+5
The old_sa is rewrite with vls_intercept_sigchld_handler when parent process fork child second time, parent process will call vls_intercept_sigchld_handler recursively when received child signal. Type: fix Signed-off-by: nandfan <fanyufei521@outlook.com> Change-Id: Ia58a254d58058489aa2d91b76a3b3cab1e38f802
2021-01-12vcl: fix session_handle_to_vlsh_table update after session migratewanghanlin1-7/+48
Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: I6698749163b0ed38093d8439e94b18b6841dc6ce
2021-01-11vcl: fix deadlock in rpcwanghanlin1-71/+133
Worker thread A send rpc to worker thread B with vls_table_lock when worker thread B try to lock vls_table_lock, so unlock it temporarily. Add worker_rpc_lock to synchronize rpc message among workers to prevent waiting for each other deadly. Add timeout for rpc response to prevent hanging when VPP exit/crash. Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: I675f1fe76673ede09107f6eeaaa0eda8bbfc6e61
2020-12-14misc: refactor clib_bitmap_foreach macroDamjan Marion1-2/+2
Type: refactor Change-Id: I077110e1a422722e20aa546a6f3224c06ab0cde5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-14misc: move to new pool_foreach macrosDamjan Marion1-4/+4
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-11vcl: fix crash problem for invalidation of vls_table_lockwanghanlin1-6/+5
Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: I0649f4d5adb5fa5b407431ea23982f2ad87fb657
2020-11-19vcl: stop tracking vpp event queues and thread indexFlorin Coras1-1/+0
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Icbee02a39650bc792532adc714bcf4f47f3fbe59
2020-10-20vcl: more session struct cleanupFlorin Coras1-1/+1
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I8e466e789c860caaa55f67095a57fc6ab670f32b
2020-10-20vcl: convert vep variables into flagsFlorin Coras1-2/+3
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ief017abc4879bc928746d9f5b9d2cfe04da89bd3
2020-10-15vcl: refactor session state enumFlorin Coras1-10/+10
Only allow one state instead of using flags. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I08ffccbf8c3f6e2f61533996bb36c799cbc931e7
2020-09-14vcl: cleanup bapi and wrk registrationFlorin Coras1-20/+6
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I0391db5c3ad038265cb8ebf9de02925653e35959
2020-08-26vcl: fix duplicated key of session_index_to_vlsh_table in multiplehanlin1-11/+21
threads vcl workers scenario Type: fix In multiple threads vcl workers scenario, multiple vcl workes can create sessions with same index. Because only one vls worker created, key of session_index_to_vlsh_table is duplicated. Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: I7e1f5bc471adc5378194452aef85e611f5d0df1d
2020-08-12vcl: mt detection and cleanupFlorin Coras1-60/+100
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I521c110fd4d7445bd585c96d4c768f16a0a7d3b8
2020-08-12vcl: support multi-threads with session migrationhanlin1-16/+229
Currently, mutlti-threads only support one dispatch thread and multiple worker threads, eventually only dispatch thread is a vcl worker and can interact with epoll. This patch will register all threads as vcl worker, and then each thread can interact with epoll now. Moreover, session migration also supported, such as socket created in thread A and used (bind, connect and etc.) in thread B. Type: feature Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: Iab0b43a33466968c1423d7d20faf1460c8589d91
2020-08-11vcl: support inter worker rpcFlorin Coras1-30/+113
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I664cd14c84fc5cf2ffe61efce99c95219b44fad7
2020-05-20vcl: nest vcl_mq_epfd to support epoll_wait without high CPU usagehanlin1-0/+6
Now, libc epfd and vls epfd are independent and can only epoll_wait independently without timeout, then app calling epoll_wait will occupy high CPU. So we nest vcl_mq_epfd into libc epfd when using eventfd with VPP, and then we can only epoll_wait libc epfd with specified timeout. Type: feature Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: I6b6e0f501c769e186714bfbc187cfaed2533b4c2 Signed-off-by: hanlin <hanlin_wang@163.com>
2020-03-07vcl: fix coverity warningFlorin Coras1-2/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I35fba8f17bdd6e2f5612358608ff6c13f4b431fe
2020-03-06vcl: refactor vls to minimize lock usageFlorin Coras1-104/+416
Type: refactor - per vls worker private pool of sessions - deep copy of vls worker data structures on fork - maintain a global, i.e., heap allocated, and lock protected pool of elements that track sessions that are shared between workers (due to forking). Credit for uncovering the issue goes to Intel team contributing code to VSAP (Ping, Yuwei, Shujun, Guoao). Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Id7d8bb06ecd7b03e4134f1cae23e740cf4634649
2019-08-27session: move ctrl messages from bapi to mqFlorin Coras1-1/+1
Type:refactor Moves connect, disconnect, bind, unbind and app detach to message queue from binary api. Simplifies app/vcl interaction with the session layer since all session control messages are now handled over the mq. Add/del segment messages require internal C api changes which affect all builtin applications. They'll be moved in a different patch and might not be back portable to 19.08. Change-Id: I93f6d18e551b024effa75d47f5ff25f23ba8aff5 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-05-09vls: relax copy on fork locksFlorin Coras1-2/+2
Change-Id: I08cb7180364a5ef8444c9895c6d4f4842661b2a7 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-29vls: add pthread check on vls_attrFlorin Coras1-1/+7
Change-Id: I455d108dfe52d45d040167fecb37b33e9d630c3c Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-03-08session/tcp/vcl: fixes and optimizationsFlorin Coras1-0/+3
Change-Id: Idc7dfe743399dd8dee0f6b3ec83f194f3fca580b Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-02-22session/vcl: fix coverity warningsFlorin Coras1-0/+1
Change-Id: I9b0e6d65255e516cf5bf18757d4769176ef76e92 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-30vls: support passive listenersFlorin Coras1-70/+236
If an application worker calls listen on a session, vpp registers the worker to the listener's work load balance group and, as new connections are accepted, it may potentially push accept notifications to it. There are however applications, like nginx, that on some workers may never accept new connections on a session they've started listening on. To avoid accumulating accept events on such workers, this patch adds support for passive listeners. That is, workers that have started listening on a session but then never call accept or epoll/select on that listener. Change-Id: I007e6dcb54fc88a0e3aab3c6e2a3d1ef135cbd58 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-29vls: multi-process and multi-threaded apps improvementsFlorin Coras1-39/+254
- 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-18vcl: move forking logic to vlsFlorin Coras1-6/+236
Change-Id: I721542aca139d7908a4f917629856f82cae79962 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-01-07vcl/ldp: add locked sessions shim layerFlorin Coras1-0/+457
Moves LDP logic that allows sharing of sessions between multi-process app workers into a separate VCL shim layer. Also refactors LDP to use the new layer. Change-Id: I8198b51eae7d099a8c486e36b29e3a0cb8cee8e9 Signed-off-by: Florin Coras <fcoras@cisco.com>