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
master
Andre Puschmann 3 years ago
parent e0d9afc342
commit c7d29f4af1

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

@ -276,7 +276,7 @@ private:
std::vector<unique_syssim_cell_t> cells; std::vector<unique_syssim_cell_t> cells;
int32_t pcell_idx = -1; 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; std::mutex syssim_mutex;
// Internal function // Internal function

@ -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.gw_hex_limit = args->log_hex_level;
all_args.stack.log.usim_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; return all_args;
} }

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

Loading…
Cancel
Save