From 2d33bdc6fb81053077b061e774a1787d5f5fa462 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 8 Feb 2018 09:43:38 -0800 Subject: mg: Temporarily disable concurrency in parts of set_rpc_client() There is an issue with parallel inits and liberio which crops up during initialization. This is not a fix but is a workaround which enables the parallel initialization of devices using liberio. --- host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp | 12 +++++++++++- host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp index 1c6a1733f..ebb350f4a 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -853,6 +853,8 @@ std::string magnesium_radio_ctrl_impl::get_dboard_fe_from_chan( return std::to_string(chan); } +std::mutex magnesium_radio_ctrl_impl::_set_rpc_lock; // FIXME remove + void magnesium_radio_ctrl_impl::set_rpc_client( uhd::rpc_client::sptr rpcc, const uhd::device_addr_t &block_args @@ -897,7 +899,15 @@ void magnesium_radio_ctrl_impl::set_rpc_client( } UHD_LOG_DEBUG(unique_id(), "Master Clock Rate is: " << (_master_clock_rate / 1e6) << " MHz."); - radio_ctrl_impl::set_rate(_master_clock_rate); + { + // FIXME: Remove this lock. It's masking a bug that's probably, but not + // confirmed, to be in the receive packet demuxer. It'll pop up when + // running UHD over liberio without using serialize_init + std::lock_guard l(magnesium_radio_ctrl_impl::_set_rpc_lock); + radio_ctrl_impl::set_rate(_master_clock_rate); + // Note: This lock needs to encompass all CHDR traffic. RPC traffic is + // OK from a thread-safety perspective. + } // EEPROM paths subject to change FIXME const size_t db_idx = get_block_id().get_block_count(); diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp index d12666ce7..e3cfe03e3 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp @@ -142,6 +142,10 @@ public: size_t get_chan_from_dboard_fe(const std::string &fe, const direction_t dir); std::string get_dboard_fe_from_chan(const size_t chan, const direction_t dir); + //! Disable concurrency in set_rpc_client(). This is a workaround for a + // thread-unsafety bug and should get deleted at some point in the future! + static std::mutex _set_rpc_lock; // FIXME remove this + void set_rpc_client( uhd::rpc_client::sptr rpcc, const uhd::device_addr_t &block_args -- cgit v1.2.3