-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added logic to skip ahead to next intact message after overflow #41
base: master
Are you sure you want to change the base?
Added logic to skip ahead to next intact message after overflow #41
Conversation
…e QS queue, this removes spammy bad checksum errors
Hi Sven
I don't understand that claim. I think that only one (the oldest) trace record gets partially overwritten by the new trace record. Of course, if you keep adding to the head without advancing the tail, more and more old trace records gets overwritten, but still only one record at a time gets corrupted. Please explain why you think that all subsequent records come out corrupted. --MMS |
I was using the TX mechanism from the arm-cr dpp example: https://github.com/QuantumLeaps/qpc-examples/blob/8912782f022cdf8ebf2528619d7d46af7fd4f097/arm-cr/dpp_launchxl2-tms57012/qv/bsp.c#L322 When reaching full capacity on the buffer, the two ends of that pipe are basically racing each other constantly and the data coming out on sci is pretty much a continuous stream of nonsense, with only occasional intact messages getting through when the consumer end is winning briefly. And if you've reached full capacity, then the consumer most consistently losing that race is expected. The PR fix is actually paired with a fix on the TX side, implementing the QV_onIdle via this function (which you might consider using in the dpp example):
The above fix on the TX side could not work (easily) without changing QS's internals to seek forward to the message boundaries. |
Hi Sven, Producing less data is a much better (arguably the only) way to fix such issues. For this, QS provides powerful filtering mechanisms. These "global" and "local" filters allow you precisely to decide what is valuable and what is not. This is a much better policy than throwing stuff out indiscriminately. Finally, I'd like you to understand my reluctance to accept such fixes. The main problem is that functions like
But even this version is non-deterministic and I doubt that such a change wouldn't hurt more than it helps. (I would just use the filters!) --MMS |
Of course it is. The point is being able to diagnose this effectively. When seeing a large number of "Bad checksum" errors, it was not easy to understand what the problem was. All I could find out about this error was this post: https://sourceforge.net/p/qpc/discussion/668726/thread/935d7a34a8/
Yes, I understand that. I did make a note of that fact in the original comment: "the additional non-deterministic timing of that loop is innocuous in a debugging facility (behind Q_SPY flag).". If you require run-time determinism even under the "SPY" build mode, then obviously, this is not appropriate.
I could not figure out a way to specifically filter out all QS output related in any way to one particular event (which fires at 1kHz, and is the main culprit for the inability to keep up). Any help on that would be appreciated.
Thanks. There is an off-by-one bug in that code. In case others find this thread and want to patch this in, this is the fixed version:
|
Hi Sven, But maybe your situation is a bit more subtle than that. Please provide more details if this crude solution does not address your situation. Finally, regarding the proposed "fix" to the
--MMS |
In a DMA interrupt (from ADC sampling at 1kHz), I post an event like this:
And essentially, what I need is something like |
Unfortunately, filtering by event signal is not possible because the signal space is too vast (it could be 32 bits). You could filter out everything related to your In case you also trace the Finally, a quick question: does the DMA need to post so frequently? I mean, DMA can collect ADC data into a buffer (event) and interrupt only when the buffer is full. --MMS |
Yeah, that's pretty much the conclusion I had reached as far as filtering. And yes, we are going to improve our DMA collection to something more reasonably tuned for our needs. |
720f487
to
37b686e
Compare
e5cc46a
to
d3f94c7
Compare
a80ce2e
to
309f482
Compare
f52084d
to
efec637
Compare
Added logic to skip ahead to next intact message after overflowing the QS queue, this removes spammy "Bad checksum" errors.
This was discovered while having an issue of not being able to send the QS messages fast enough, which leads to an overflow of the QS buffer (fixed capacity circular buffer), which overwrites the data at the TX end (tail). This results in pretty much all subsequent messages coming out being corrupted, leading to a massive amount of "Bad checksum error" spamming the qspy output without leaving anything useful.
This PR just adds simple logic so that when the buffer is overflown (clobbering the tail), the tail is seek'ed forward to the next intact message by consuming bytes up to and including the next QS_FRAME.
The resulting behavior is that the overflowing condition results in "Discontinuity" errors rather than a wall of checksum errors, which is much more intuitive to diagnose the issue. It incurs more additional loss of information since the partially clobbered message at the tail is not lost already by the time this code reached. And finally, the additional non-deterministic timing of that loop is innocuous in a debugging facility (behind Q_SPY flag).
I tested this in my project and it works as described above.
I'm not sure if there's a test suite somewhere where this regression test condition should be added to. That should be pretty trivial to do.