This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/15524 Change subject: radioInterface: Atomically fetch and change underrun variable ...................................................................... radioInterface: Atomically fetch and change underrun variable Otherwise, it could happen that underrun events are lost: TxLower (isUnderrun): RxLower (pullBuffer): read(underrun) read(underrun) write(underrun, |val) [maybe underrun becomes TRUE] write(underrun, false) Similary, it could happen the other direction if atomic was only applied to isUnderrun: TxLower (isUnderrun): RxLower (pullBuffer): read(underrun) -> true read(underrun)-> true write(underrun, false) write(underrun, true|val) where val=false So in here isUnderrun would return true twice while it should only return one. Change-Id: I684e0a5d2a9583a161d5a6593559b3a9e7cd57e3 --- M Transceiver52M/radioInterface.cpp M Transceiver52M/radioInterface.h M Transceiver52M/radioInterfaceMulti.cpp M Transceiver52M/radioInterfaceResamp.cpp 4 files changed, 10 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/24/15524/1 diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp index 6e49a75..bfd6099 100644 --- a/Transceiver52M/radioInterface.cpp +++ b/Transceiver52M/radioInterface.cpp @@ -288,9 +288,9 @@ bool RadioInterface::isUnderrun() { - bool retVal = underrun; - underrun = false; - + bool retVal; + /* atomically get previous value of "underrun" and set the var to false */ + retVal = __sync_fetch_and_and(&underrun, false); return retVal; } @@ -340,7 +340,7 @@ segmentLen * 2); } - underrun |= local_underrun; + __sync_or_and_fetch(&underrun, local_underrun); readTimestamp += numRecv; return 0; } @@ -366,7 +366,7 @@ segmentLen, &local_underrun, writeTimestamp); - underrun |= local_underrun; + __sync_or_and_fetch(&underrun, local_underrun); writeTimestamp += numSent; return true; diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h index 83e00b9..6f4deaa 100644 --- a/Transceiver52M/radioInterface.h +++ b/Transceiver52M/radioInterface.h @@ -48,7 +48,7 @@ std::vector<short *> convertRecvBuffer; std::vector<short *> convertSendBuffer; std::vector<float> powerScaling; - bool underrun; ///< indicates writes to USRP are too slow + int underrun; ///< indicates writes to USRP are too slow bool overrun; ///< indicates reads from USRP are too slow TIMESTAMP writeTimestamp; ///< sample timestamp of next packet written to USRP TIMESTAMP readTimestamp; ///< sample timestamp of next packet read from USRP diff --git a/Transceiver52M/radioInterfaceMulti.cpp b/Transceiver52M/radioInterfaceMulti.cpp index 99f6231..8060e73 100644 --- a/Transceiver52M/radioInterfaceMulti.cpp +++ b/Transceiver52M/radioInterfaceMulti.cpp @@ -251,7 +251,7 @@ convert_short_float((float *) outerRecvBuffer->begin(), convertRecvBuffer[0], 2 * outerRecvBuffer->size()); - underrun |= local_underrun; + __sync_or_and_fetch(&underrun, local_underrun); readTimestamp += num; channelizer->rotate((float *) outerRecvBuffer->begin(), @@ -348,7 +348,7 @@ LOG(ALERT) << "Transmit error " << num; } - underrun |= local_underrun; + __sync_or_and_fetch(&underrun, local_underrun); writeTimestamp += num; return true; diff --git a/Transceiver52M/radioInterfaceResamp.cpp b/Transceiver52M/radioInterfaceResamp.cpp index 864cdee..03551ee 100644 --- a/Transceiver52M/radioInterfaceResamp.cpp +++ b/Transceiver52M/radioInterfaceResamp.cpp @@ -184,7 +184,7 @@ convert_short_float((float *) outerRecvBuffer->begin(), convertRecvBuffer[0], 2 * resamp_outchunk); - underrun |= local_underrun; + __sync_or_and_fetch(&underrun, local_underrun); readTimestamp += (TIMESTAMP) resamp_outchunk; /* Write to the end of the inner receive buffer */ @@ -232,7 +232,7 @@ LOG(ALERT) << "Transmit error " << numSent; } - underrun |= local_underrun; + __sync_or_and_fetch(&underrun, local_underrun); writeTimestamp += resamp_outchunk; return true; -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/15524 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I684e0a5d2a9583a161d5a6593559b3a9e7cd57e3 Gerrit-Change-Number: 15524 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190913/b6968ddf/attachment.htm>