ttcn3: fix potential deadlock

* fix a few races detected with TSAN in SR proc of the DUT
* fix deadlock caused by sync_queue_size set to 1
This commit is contained in:
Andre Puschmann 2021-07-13 08:55:24 +02:00
parent e0d9afc342
commit c7d29f4af1
4 changed files with 7 additions and 7 deletions

View File

@ -119,8 +119,8 @@ private:
int prach_tti_tx = -1;
int sr_tx_tti = -1;
bool sr_pending = false;
std::atomic<int32_t> sr_tx_tti = {-1};
std::atomic<bool> sr_pending = {false};
std::mutex phy_mutex;

View File

@ -276,7 +276,7 @@ private:
std::vector<unique_syssim_cell_t> cells;
int32_t pcell_idx = -1;
// Main mutex to protect access from syssim's main thread (epoll handlers) and calls from UE's stack thread
// Main mutex to protect access from syssim's main thread (epoll handlers) and calls from UE's stack thread
std::mutex syssim_mutex;
// Internal function

View File

@ -105,7 +105,7 @@ all_args_t parse_args(ttcn3_dut_args_t* args, int argc, char* argv[])
all_args.stack.log.gw_hex_limit = args->log_hex_level;
all_args.stack.log.usim_hex_limit = args->log_hex_level;
all_args.stack.sync_queue_size = 1;
all_args.stack.sync_queue_size = MULTIQUEUE_DEFAULT_CAPACITY;
return all_args;
}

View File

@ -248,8 +248,8 @@ void ttcn3_syssim::new_tti_indication(uint64_t res)
// DL/UL processing if UE has selected cell
dl_rnti = ue->get_dl_sched_rnti(tti);
if (SRSRAN_RNTI_ISSI(dl_rnti)) {
// deliver SIBs one after another
if (SRSRAN_RNTI_ISSI(dl_rnti) && (tti % 2 == 0)) {
// deliver SIBs one after another in every other TTI
mac_interface_phy_lte::mac_grant_dl_t dl_grant = {};
dl_grant.tti = tti;
dl_grant.pid = get_pid(tti);
@ -257,7 +257,7 @@ void ttcn3_syssim::new_tti_indication(uint64_t res)
dl_grant.tb[0].tbs = cells[pcell_idx]->sibs[cells[pcell_idx]->sib_idx]->N_bytes;
dl_grant.tb[0].ndi = get_ndi_for_new_dl_tx(tti);
ue->new_tb(dl_grant, cells[pcell_idx]->sibs[cells[pcell_idx]->sib_idx]->msg);
logger.info("Delivered SIB%d for pcell_idx=%d", cells[pcell_idx]->sib_idx, pcell_idx);
logger.info("Delivered SIB%d for pcell_idx=%d", cells[pcell_idx]->sib_idx + 1, pcell_idx);
cells[pcell_idx]->sib_idx = (cells[pcell_idx]->sib_idx + 1) % cells[pcell_idx]->sibs.size();
} else if (SRSRAN_RNTI_ISRAR(dl_rnti)) {
if (prach_tti != -1) {