]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen/evtchn: dynamically grow pending event channel ring
authorDavid Vrabel <david.vrabel@citrix.com>
Thu, 26 Nov 2015 16:14:35 +0000 (16:14 +0000)
committerJoao Martins <joao.m.martins@oracle.com>
Sun, 27 Mar 2016 01:01:29 +0000 (02:01 +0100)
commit9b3c1551fe5fc139da3f67ebb7d7b65592af1598
tree64a6f5bf1c86df18fb399150675c4611b0df7f60
parentfb7192400f663b8870a3a23329a218898b03c215
xen/evtchn: dynamically grow pending event channel ring

If more than 1024 event channels are bound to a evtchn device then it
possible (even with well behaved applications) for the ring to
overflow and events to be lost (reported as an -EFBIG error).

Dynamically increase the size of the ring so there is always enough
space for all bound events.  Well behaved applicables that only unmask
events after draining them from the ring can thus no longer lose
events.

However, an application could unmask an event before draining it,
allowing multiple entries per port to accumulate in the ring, and a
overflow could still occur.  So the overflow detection and reporting
is retained.

The ring size is initially only 64 entries so the common use case of
an application only binding a few events will use less memory than
before.  The ring size may grow to 512 KiB (enough for all 2^17
possible channels).  This order 7 kmalloc() may fail due to memory
fragmentation, so we fall back to trying vmalloc().

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
(cherry picked from commit 8620015499101090ae275bf11e9bc2f9febfdf08)
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
drivers/xen/evtchn.c