Rockbox

  • Status Closed
  • Percent Complete
    100%
  • 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

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:  

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.

Dominik Riebeling commented on 2006-10-29 18:19

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 :-)

1) q→read + QUEUE_LENGTH) & QUEUE_LENGTH_MASK
Admin
Linus Nielsen Feltzing commented on 2006-10-29 19:03

Since you will panic anyway, why not check after q→write has been incremented?

if(q→read == q→write)

 panicf("Queue overflowed id=%x", id);
Steve Bavin commented on 2006-10-30 08:05

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…

Admin
Linus Nielsen Feltzing commented on 2006-10-30 08:33

Hehe, silly me. And I even wrote that code myself… :-)

Brandon Low commented on 2006-10-30 17:36

Linus: I knew you did, now I laugh.

Steve Bavin commented on 2006-11-13 08:47

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.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing