Fix deadlock caused by update_measurements calling in_sync (#1760)

master
Ismael Gomez 4 years ago committed by GitHub
parent eb370642ab
commit 399b986d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -620,6 +620,8 @@ void phy_common::update_measurements(uint32_t
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);
float snr_ema_coeff = args->snr_ema_coeff;
@ -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)) {

Loading…
Cancel
Save