evtchn: don't lose pending state if FIFO event array page is missing
authorDavid Vrabel <david.vrabel@citrix.com>
Wed, 6 Nov 2013 09:20:24 +0000 (10:20 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 6 Nov 2013 09:20:24 +0000 (10:20 +0100)
commit917c12302985f7702664faa572f9a2963f4aa947
tree9ab1f1cca2ff2bc4b7d5e46675d98008616792fc
parent636b6433908ebedc8928fd47b95f75d6580e1d3e
evtchn: don't lose pending state if FIFO event array page is missing

When the FIFO-based ABI is in use, if an event is bound when the
corresponding event array page is missing any attempt to set the event
pending will lose the event (because there is nowhere to write the
pending state).

This wasn't initially considered an issue because guests were expected
to only bind events once they had expanded the event array, however:

1. A domain may start with events already bound (by the toolstack).

2. The guest does not know what the port number will be until the
   event is bound (it doesn't know how many already bound events there
   are), so it does not know how many event array pages are required.
   This makes it difficult to expand in advanced (the current Linux
   implementation expands after binding for example).

To prevent pending events from being lost because there is no array
page, temporarily store the pending state in evtchn->pending.  When an
array page is added, use this state to set the port as pending.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/common/event_fifo.c
xen/include/xen/sched.h