Fix deadlock caused by update_measurements calling in_sync (#1760)

This commit is contained in:
Ismael Gomez 2020-09-22 18:25:12 +02:00 committed by GitHub
parent eb370642ab
commit 399b986d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 120 additions and 111 deletions

View File

@ -619,6 +619,8 @@ void phy_common::update_measurements(uint32_t
float tx_crs_power,
std::vector<rrc_interface_phy_lte::phy_meas_t>& serving_cells,
cf_t* rssi_power_buffer)
{
bool insync = true;
{
std::unique_lock<std::mutex> lock(meas_mutex);
@ -635,8 +637,9 @@ void phy_common::update_measurements(uint32_t
if (!rssi_read_cnt) {
// Average RSSI over all symbols in antenna port 0 (make sure SF length is non-zero)
float rssi_dbm = SRSLTE_SF_LEN_PRB(cell.nof_prb) > 0 ? (srslte_convert_power_to_dB(srslte_vec_avg_power_cf(
rssi_power_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb))) +
float rssi_dbm = SRSLTE_SF_LEN_PRB(cell.nof_prb) > 0
? (srslte_convert_power_to_dB(
srslte_vec_avg_power_cf(rssi_power_buffer, SRSLTE_SF_LEN_PRB(cell.nof_prb))) +
30)
: 0;
if (std::isnormal(rssi_dbm)) {
@ -736,16 +739,22 @@ void phy_common::update_measurements(uint32_t
if (avg_rsrp_dbm[0] > args->in_sync_rsrp_dbm_th && avg_snr_db_cqi[0] > args->in_sync_snr_db_th) {
log_h->debug(
"SNR=%.1f dB, RSRP=%.1f dBm sync=in-sync from channel estimator\n", avg_snr_db_cqi[0], avg_rsrp_dbm[0]);
if (insync_itf) {
insync_itf->in_sync();
}
} else {
log_h->warning(
"SNR=%.1f dB RSRP=%.1f dBm, sync=out-of-sync from channel estimator\n", avg_snr_db_cqi[0], avg_rsrp_dbm[0]);
insync = false;
}
}
// Report in-sync status to the stack outside the mutex lock
if (insync_itf) {
if (insync) {
insync_itf->in_sync();
} else {
insync_itf->out_of_sync();
}
}
// Call feedback loop for chest
if (cc_idx == 0) {
if (insync_itf && ((1U << (sf_cfg_dl.tti % 10U)) & args->cfo_ref_mask)) {