Skip to content

Commit 63513cb

Browse files
frankistcodebot
authored andcommitted
du-high: make timer executor synchronous when in zmq mode
1 parent 04631e7 commit 63513cb

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

apps/services/worker_manager.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ void worker_manager::create_low_prio_executors(const expert_execution_appconfig&
323323
// Used for PCAP writing.
324324
non_rt_pool.executors.emplace_back("low_prio_exec", task_priority::max - 1);
325325
// Used for control plane and timer management.
326-
non_rt_pool.executors.push_back({"high_prio_exec", task_priority::max, {}, std::nullopt, not rt_mode});
326+
non_rt_pool.executors.push_back({"high_prio_exec", task_priority::max});
327327
// Used to serialize all CU-UP tasks, while CU-UP does not support multithreading.
328328
non_rt_pool.executors.push_back({"cu_up_strand",
329329
task_priority::max - 1,
@@ -337,9 +337,11 @@ void worker_manager::create_low_prio_executors(const expert_execution_appconfig&
337337
// Configuration of strands for PCAP writing. These strands will use the low priority executor.
338338
append_pcap_strands(low_prio_strands, cu_cp_pcaps, cu_up_pcaps, du_pcaps);
339339

340-
// Configuration of strand for the control plane handling (CU-CP and DU-high control plane). This strand will
341-
// support two priority levels, the highest being for timer management.
342-
strand cp_strand{{{"timer_exec", concurrent_queue_policy::lockfree_spsc, task_worker_queue_size},
340+
// Configuration of strand for the control plane handling (CU-CP and DU-high control plane).
341+
// This strand will support two priority levels, the highest being for timer management.
342+
// Note: In case of non-RT operation, we make the timer_exec synchronous. This will have the effect of stopping
343+
// the lower layers from running faster than this strand.
344+
strand cp_strand{{{"timer_exec", concurrent_queue_policy::lockfree_spsc, task_worker_queue_size, not rt_mode},
343345
{"ctrl_exec", concurrent_queue_policy::lockfree_mpmc, task_worker_queue_size}}};
344346
high_prio_strands.push_back(cp_strand);
345347

include/srsran/support/executors/task_execution_manager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ struct strand {
3838
concurrent_queue_policy policy;
3939
/// \brief Size of the queue used.
4040
unsigned size;
41+
/// \brief Whether the caller blocks waiting for task to complete.
42+
bool synchronous = false;
4143
};
4244
/// Queues of different priorities. The lower the index, the higher the priority.
4345
std::vector<executor> queues;

lib/support/executors/task_execution_manager.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,22 @@ class common_task_execution_context : public task_execution_context
196196

197197
// Create executors that own the strand through reference counting.
198198
for (unsigned i = 0; i != strand_cfg.queues.size(); ++i) {
199-
enqueue_priority prio = detail::queue_index_to_enqueue_priority(i, strand_cfg.queues.size());
200-
execs.emplace_back(strand_cfg.queues[i].name, make_priority_task_executor_ptr(prio, shared_strand));
199+
enqueue_priority prio = detail::queue_index_to_enqueue_priority(i, strand_cfg.queues.size());
200+
auto prio_exec = make_priority_task_executor_ptr(prio, shared_strand);
201+
if (strand_cfg.queues[i].synchronous) {
202+
prio_exec = make_sync_executor(std::move(prio_exec));
203+
}
204+
execs.emplace_back(strand_cfg.queues[i].name, std::move(prio_exec));
201205
}
202206
} else {
203207
// Single priority level case.
204208
concurrent_queue_params qparams;
205209
qparams.policy = strand_cfg.queues[0].policy;
206210
qparams.size = strand_cfg.queues[0].size;
207211
auto strand_ptr = make_task_strand_ptr(exec_type{basic_exec}, qparams);
212+
if (strand_cfg.queues[0].synchronous) {
213+
strand_ptr = make_sync_executor(std::move(strand_ptr));
214+
}
208215

209216
// Strand becomes the executor.
210217
execs.emplace_back(strand_cfg.queues[0].name, std::move(strand_ptr));

0 commit comments

Comments
 (0)