Fix potential overflow error in CEQs (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 4 Oct 2016 18:06:06 +0000 (14:06 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 6 Oct 2016 19:41:48 +0000 (15:41 -0400)
commitff691c62592ae15be9ddc5ad3e5b9e92c0d8bb78
tree684169eeeaf04b02c08c941caef6b0a0b4fcc8d3
parent79aef241d5aa005950ebed30a31df938d586b55a
Fix potential overflow error in CEQs (XCC)

The issue was that a consumer that came in during overflow recovery could
see that there was no overflow and return FALSE, meaning the CEQ was empty,
even though there were older messages.

Consider, the kernel already posted two messages, set overflow, and the
ring is empty:

Thread 1                      Thread 2
--------                      --------
see empty ring                see empty ring
see overflow is on
grab lock
clear overflow
extract a message
                              sees overflow is off
                              returns FALSE
sets overflow
unlocks
returns TRUE

And there's still a message in the CEQ that thread 2 should have grabbed.

While doing this change, I also changed nr_events to an unsigned.  That was
my original intent (based on the usage in epoll), and making the change now
keeps this commit from changing the size of the CEQ, which keeps everyone
from having to rebuild every application.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/ros/ceq.h
user/parlib/ceq.c
user/parlib/include/parlib/ceq.h