aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCiro Nishiguchi <ciro.nishiguchi@ni.com>2019-08-06 14:44:51 -0500
committerMartin Braun <martin.braun@ettus.com>2019-11-26 11:49:34 -0800
commit1c79742231c5cc3609e35bda34c8d9b9e7440f50 (patch)
treec8b7f1aa071c1366fc289baa191416fcc394ae80
parent986316132094f2218bd6ef51a182bb2b9600c5ab (diff)
downloaduhd-1c79742231c5cc3609e35bda34c8d9b9e7440f50.tar.gz
uhd-1c79742231c5cc3609e35bda34c8d9b9e7440f50.tar.bz2
uhd-1c79742231c5cc3609e35bda34c8d9b9e7440f50.zip
utils: remove thread priority elevation
Remove UHD call to elevate thread priority to realtime from utils, and add warning in documentation of set_thread_priority function. Setting all threads to the same realtime priority can cause the threads to not share access to the network interface fairly, which adversely affects operation of the worker threads in UHD.
-rw-r--r--host/include/uhd/utils/thread.hpp6
-rw-r--r--host/tests/packet_handler_benchmark.cpp2
-rw-r--r--host/utils/query_gpsdo_sensors.cpp2
-rw-r--r--host/utils/uhd_cal_rx_iq_balance.cpp2
-rw-r--r--host/utils/uhd_cal_tx_dc_offset.cpp2
-rw-r--r--host/utils/uhd_cal_tx_iq_balance.cpp2
-rw-r--r--tools/kitchen_sink/kitchen_sink.cpp2
7 files changed, 4 insertions, 14 deletions
diff --git a/host/include/uhd/utils/thread.hpp b/host/include/uhd/utils/thread.hpp
index aeb27e467..9f71161d0 100644
--- a/host/include/uhd/utils/thread.hpp
+++ b/host/include/uhd/utils/thread.hpp
@@ -20,8 +20,10 @@ static const float default_thread_priority = float(0.5);
/*!
* Set the scheduling priority on the current thread.
*
- * A new thread or calling process should make this call
- * with the defaults this to enable realtime scheduling.
+ * To enable realtime scheduling on a new thread, call this function with
+ * the default values. Warning: realtime scheduling can cause UHD worker
+ * threads to not share resources such as network interfaces fairly,
+ * potentially causing it to malfunction.
*
* A priority of zero corresponds to normal priority.
* Positive priority values are higher than normal.
diff --git a/host/tests/packet_handler_benchmark.cpp b/host/tests/packet_handler_benchmark.cpp
index 21e1430ae..ec7eff517 100644
--- a/host/tests/packet_handler_benchmark.cpp
+++ b/host/tests/packet_handler_benchmark.cpp
@@ -319,8 +319,6 @@ int UHD_SAFE_MAIN(int argc, char* argv[])
return EXIT_FAILURE;
}
- uhd::set_thread_priority_safe();
-
const char* formats[] = {"sc16", "fc32", "fc64"};
constexpr size_t rx_spp = 2000;
constexpr size_t tx_spp = 1000;
diff --git a/host/utils/query_gpsdo_sensors.cpp b/host/utils/query_gpsdo_sensors.cpp
index ecc0048a7..99fbd1d03 100644
--- a/host/utils/query_gpsdo_sensors.cpp
+++ b/host/utils/query_gpsdo_sensors.cpp
@@ -82,8 +82,6 @@ int query_clock_sensors(const std::string& args)
int UHD_SAFE_MAIN(int argc, char* argv[])
{
- uhd::set_thread_priority_safe();
-
std::string args;
// Set up program options
diff --git a/host/utils/uhd_cal_rx_iq_balance.cpp b/host/utils/uhd_cal_rx_iq_balance.cpp
index c68c96173..1d8bdf6ee 100644
--- a/host/utils/uhd_cal_rx_iq_balance.cpp
+++ b/host/utils/uhd_cal_rx_iq_balance.cpp
@@ -32,8 +32,6 @@ static void tx_thread(uhd::usrp::multi_usrp::sptr usrp,
uhd::tx_streamer::sptr tx_stream,
const double tx_wave_ampl)
{
- uhd::set_thread_priority_safe();
-
// set max TX gain
usrp->set_tx_gain(usrp->get_tx_gain_range().stop());
diff --git a/host/utils/uhd_cal_tx_dc_offset.cpp b/host/utils/uhd_cal_tx_dc_offset.cpp
index f47b5e913..4ae305696 100644
--- a/host/utils/uhd_cal_tx_dc_offset.cpp
+++ b/host/utils/uhd_cal_tx_dc_offset.cpp
@@ -31,8 +31,6 @@ static void tx_thread(uhd::usrp::multi_usrp::sptr usrp,
const double tx_wave_freq,
const double tx_wave_ampl)
{
- uhd::set_thread_priority_safe();
-
// set max TX gain
usrp->set_tx_gain(usrp->get_tx_gain_range().stop());
diff --git a/host/utils/uhd_cal_tx_iq_balance.cpp b/host/utils/uhd_cal_tx_iq_balance.cpp
index 2e7229fd3..233f23862 100644
--- a/host/utils/uhd_cal_tx_iq_balance.cpp
+++ b/host/utils/uhd_cal_tx_iq_balance.cpp
@@ -28,8 +28,6 @@ static void tx_thread(uhd::usrp::multi_usrp::sptr usrp,
const double tx_wave_freq,
const double tx_wave_ampl)
{
- uhd::set_thread_priority_safe();
-
// set max TX gain
usrp->set_tx_gain(usrp->get_tx_gain_range().stop());
diff --git a/tools/kitchen_sink/kitchen_sink.cpp b/tools/kitchen_sink/kitchen_sink.cpp
index ce33d049b..ea49ad284 100644
--- a/tools/kitchen_sink/kitchen_sink.cpp
+++ b/tools/kitchen_sink/kitchen_sink.cpp
@@ -1037,8 +1037,6 @@ std::vector<size_t> get_channels(const std::string& channel_list, size_t max = -
* Main code + dispatcher
**********************************************************************/
int UHD_SAFE_MAIN(int argc, char *argv[]){
- uhd::set_thread_priority_safe();
-
//variables to be set by po
std::string args;
double duration;