Merge remote-tracking branch 'origin/nr-ue-threading-improvements' into integration_2024_w48 (!3091)
Update NR UE threading model This updates the NR UE threading model by preventing calling threadpool from threadpool and fixes deadlock issues related to processSlotTX. By making processSlotTX run to completion instead of starting and waiting for other threads to finish it prevents locking thread pool cores, therefore prevening deadlocks. There is a slight difference here compared to the previous version where I do not use the UL actor as I believe it is not necessary, processSlotTX satisfies the run-to-completion requirement now. If in the future any UL procedure would be parallelized using the thread pool it should either be done in a run-to-completion model or the processSlotTX function should be taken off the thread pool. The documentation has been updated.
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/defs_UE.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
|
||||
#include "LTE_SystemInformationBlockType2.h"
|
||||
//#include "RadioResourceConfigCommonSIB.h"
|
||||
|
||||
@@ -53,7 +53,7 @@ if(ENABLE_UESCOPE OR ENABLE_ENBSCOPE OR ENABLE_NRSCOPE)
|
||||
target_link_libraries(uescope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
|
||||
|
||||
add_library(nrscope MODULE nr_phy_scope.c)
|
||||
target_link_libraries(nrscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs)
|
||||
target_link_libraries(nrscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs UTIL)
|
||||
|
||||
# all libraries should be written to root build dir (default creates the same hierarchie under build as existing for sources)
|
||||
set_target_properties(enbscope uescope nrscope
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
#include "common_lib.h"
|
||||
#include "fapi_nr_ue_interface.h"
|
||||
#include "assertions.h"
|
||||
#include "barrier.h"
|
||||
#include "actor.h"
|
||||
//#include "openair1/SCHED_NR_UE/defs.h"
|
||||
|
||||
#ifdef MEX
|
||||
@@ -74,16 +76,6 @@
|
||||
#define openair_free(y,x) free((y))
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
#ifdef NR_UNIT_TEST
|
||||
#define FILE_NAME " "
|
||||
#define LINE_FILE (0)
|
||||
#define NR_TST_PHY_PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define FILE_NAME (__FILE__)
|
||||
#define LINE_FILE (__LINE__)
|
||||
#define NR_TST_PHY_PRINTF(...)
|
||||
#endif
|
||||
|
||||
#define PAGE_MASK 0xfffff000
|
||||
#define virt_to_phys(x) (x)
|
||||
#define openair_sched_exit() exit(-1)
|
||||
@@ -91,6 +83,7 @@
|
||||
#define bzero(s,n) (memset((s),0,(n)))
|
||||
/// suppress compiler warning for unused arguments
|
||||
#define UNUSED(x) (void)x;
|
||||
#define NUM_DL_ACTORS 4
|
||||
|
||||
#include "impl_defs_top.h"
|
||||
#include "impl_defs_nr.h"
|
||||
@@ -530,7 +523,7 @@ typedef struct PHY_VARS_NR_UE_s {
|
||||
void *phy_sim_pdsch_dl_ch_estimates_ext;
|
||||
uint8_t *phy_sim_dlsch_b;
|
||||
|
||||
notifiedFIFO_t tx_resume_ind_fifo[NR_MAX_SLOTS_PER_FRAME];
|
||||
dynamic_barrier_t process_slot_tx_barriers[NR_MAX_SLOTS_PER_FRAME];
|
||||
|
||||
// Gain change required for automation RX gain change
|
||||
int adjust_rxgain;
|
||||
@@ -538,6 +531,8 @@ typedef struct PHY_VARS_NR_UE_s {
|
||||
// Sidelink parameters
|
||||
sl_nr_sidelink_mode_t sl_mode;
|
||||
sl_nr_ue_phy_params_t SL_UE_PHY_PARAMS;
|
||||
Actor_t sync_actor;
|
||||
Actor_t dl_actors[NUM_DL_ACTORS];
|
||||
} PHY_VARS_NR_UE;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -31,10 +31,19 @@
|
||||
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
#include "SCHED_NR/phy_frame_config_nr.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
#ifdef NR_UNIT_TEST
|
||||
#define FILE_NAME " "
|
||||
#define LINE_FILE (0)
|
||||
#define NR_TST_PHY_PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define FILE_NAME (__FILE__)
|
||||
#define LINE_FILE (__LINE__)
|
||||
#define NR_TST_PHY_PRINTF(...)
|
||||
#endif
|
||||
|
||||
/*******************************************************************
|
||||
*
|
||||
* NAME : set_tdd_configuration
|
||||
|
||||
@@ -635,18 +635,6 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This function release the Tx working thread for one pending information, like dlsch ACK/NACK
|
||||
static void send_dl_done_to_tx_thread(notifiedFIFO_t *nf, int rx_slot)
|
||||
{
|
||||
if (nf) {
|
||||
notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(int), 0, NULL, NULL);
|
||||
// We put rx slot only for tracing purpose
|
||||
int *msgData = (int *) NotifiedFifoData(newElt);
|
||||
*msgData = rx_slot;
|
||||
pushNotifiedFIFO(nf, newElt);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t compute_csi_rm_unav_res(fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config)
|
||||
{
|
||||
uint32_t unav_res = 0;
|
||||
@@ -740,7 +728,7 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
// don't wait anymore
|
||||
LOG_E(NR_PHY, "Internal error nr_ue_dlsch_procedure() called but no active cw on slot %d, harq %d\n", nr_slot_rx, harq_pid);
|
||||
const int ack_nack_slot = (proc->nr_slot_rx + dlsch[0].dlsch_config.k1_feedback) % ue->frame_parms.slots_per_frame;
|
||||
send_dl_done_to_tx_thread(ue->tx_resume_ind_fifo + ack_nack_slot, proc->nr_slot_rx);
|
||||
dynamic_barrier_join(&ue->process_slot_tx_barriers[ack_nack_slot]);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -876,7 +864,7 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
// DLSCH decoding finished! don't wait anymore in Tx process, we know if we should answer ACK/NACK PUCCH
|
||||
if (dlsch[0].rnti_type == TYPE_C_RNTI_) {
|
||||
const int ack_nack_slot = (proc->nr_slot_rx + dlsch[0].dlsch_config.k1_feedback) % ue->frame_parms.slots_per_frame;
|
||||
send_dl_done_to_tx_thread(ue->tx_resume_ind_fifo + ack_nack_slot, proc->nr_slot_rx);
|
||||
dynamic_barrier_join(&ue->process_slot_tx_barriers[ack_nack_slot]);
|
||||
}
|
||||
|
||||
if (ue->phy_sim_dlsch_b)
|
||||
@@ -1158,9 +1146,8 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
|
||||
nr_ue_dlsch_procedures(ue, proc, dlsch, llr, G);
|
||||
else {
|
||||
LOG_E(NR_PHY, "Demodulation impossible, internal error\n");
|
||||
send_dl_done_to_tx_thread(
|
||||
ue->tx_resume_ind_fifo + (proc->nr_slot_rx + dlsch_config->k1_feedback) % ue->frame_parms.slots_per_frame,
|
||||
proc->nr_slot_rx);
|
||||
int ack_nack_slot = (proc->nr_slot_rx + dlsch_config->k1_feedback) % ue->frame_parms.slots_per_frame;
|
||||
dynamic_barrier_join(&ue->process_slot_tx_barriers[ack_nack_slot]);
|
||||
LOG_W(NR_PHY, "nr_ue_pdsch_procedures failed in slot %d\n", proc->nr_slot_rx);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user