- Status Closed
- Percent Complete
- Task Type Patches
- Category Operating System/Drivers
- Assigned To No-one
- Operating System All players
- Severity Low
- Priority Very Low
- Reported Version
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
Attached to Project: Rockbox
Opened by Steve Bavin - 2006-10-29
Last edited by Steve Bavin - 2007-08-01
Opened by Steve Bavin - 2006-10-29
Last edited by Steve Bavin - 2007-08-01
FS#6259 - Panic if queue overflows
Here’s an additional test to force a panic if a queue overflows. Please can someone check my maths is right before I commit this, I wouldn’t want to cause unwanted panic, and it seems to detect a lot of overflows on my H300.
Closed by Steve Bavin
2007-08-01 15:05
Reason for closing: Rejected
Additional comments about closing:
2007-08-01 15:05
Reason for closing: Rejected
Additional comments about closing:
It's rather too easy to overflow a queue
(by holding down a key during initial
boot for example)… so this is probably
not a good idea.
from a quick look into the queuing stuff: mustn’t you also wrap the queue value for the test? I.e.
if(q→write == 1) like e.g. in queue_post() at kernel.c:164 as you otherwise would point to somewhere outside of the queue?
(Note that I know nothing of the queuing stuff, but that simply popped into my mind as I read the patch so I might be completely wrong – just wanted to note this
Since you will panic anyway, why not check after q→write has been incremented?
if(q→read == q→write)
Both read and write are forever-incrementing UINTs; they are not restricted by QUEUE_LENGTH_MASK. They will wrap eventually, but so will the proposed (q→read + QUEUE_LENGTH).
As I understand it, q→read == q→write just indicates an empty queue, not an overflowed one.
p.s. Out of interest, my H340 always overflows on shutdown with the standard queue length of 16…
Hehe, silly me. And I even wrote that code myself…
Linus: I knew you did, now I laugh.
Here’s an updated version that I’ve been using to find queue overflows for a while now. This one is enabled on logf builds only and keeps track of the queue name so you can actually tell which queue overflowed.
I’ll commit this one soon unless anyone objects.