diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2021-10-07 15:20:54 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-10-11 10:43:46 -0700 |
commit | 7ba25a638eaa6e88696471df5ecd6af70e57d796 (patch) | |
tree | c09ac48d27a03736226f596d1225fcdde915a6ad /mpm/python | |
parent | 0fa4f7179b952c51137177b191c67501051ade81 (diff) | |
download | uhd-7ba25a638eaa6e88696471df5ecd6af70e57d796.tar.gz uhd-7ba25a638eaa6e88696471df5ecd6af70e57d796.tar.bz2 uhd-7ba25a638eaa6e88696471df5ecd6af70e57d796.zip |
mpm: rfdc: Tear down RFDC on teardown
So, the Python garbage collector is a bit pernicious, in that it happens
behind the scenes in a way which is difficult to predict. The rfdc_ctrl
class expects that its "lifetime" will be a single live/die cycle of the
FPGA (i.e. that when a new FPGA is loaded, it will be destructed).
However, by default the Python GC will keep the X4xxRfdcCtrl class alive
for an arbitrary amount of time, meaning that it's possible that
multiple (C++) rfdc_ctrl classes can be alive at a single time.
When the GC reaps all of these classes, libmetal segfaults when we call
metal_finish several times in a row. This change works around that
issue, if not the overall GC issue, by explicitly deleting the rfdc_ctrl
object.
Diffstat (limited to 'mpm/python')
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/x4xx.py | 2 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/x4xx.py b/mpm/python/usrp_mpm/periph_manager/x4xx.py index a9db6f510..30938a6b2 100644 --- a/mpm/python/usrp_mpm/periph_manager/x4xx.py +++ b/mpm/python/usrp_mpm/periph_manager/x4xx.py @@ -696,7 +696,7 @@ class x4xx(ZynqComponents, PeriphManagerBase): super(x4xx, self).tear_down() if self.dio_control is not None: self.dio_control.tear_down() - self.rfdc.unset_cbs() + self.rfdc.tear_down() self._clk_mgr.unset_cbs() # remove x4xx overlay active_overlays = self.list_active_overlays() diff --git a/mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py b/mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py index be93a495e..6dca79b2a 100644 --- a/mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py +++ b/mpm/python/usrp_mpm/periph_manager/x4xx_rfdc_ctrl.py @@ -88,11 +88,13 @@ class X4xxRfdcCtrl: self._cal_freeze_cache = {} @no_rpc - def unset_cbs(self): + def tear_down(self): """ - Removes any stored references to our owning X4xx class instance + Removes any stored references to our owning X4xx class instance and + destructs anything that must happen at teardown """ self._get_spll_freq = None + del self._rfdc_ctrl ########################################################################### # Public APIs (not available as MPM RPC calls) |