Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
xen.7316
5537a81d-libxl-fd-events3.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5537a81d-libxl-fd-events3.patch of Package xen.7316
Referencs: bsc#955104 bsc#959552 bsc#993665 bsc#959330 bsc#990500 commit 56d2350bf542ad5fd20d20e4e9dac76e8d9a54fe Author: Ian Jackson <ian.jackson@eu.citrix.com> Date: Thu Apr 16 19:23:28 2015 +0100 libxl: fd events: Suppress spurious fd events Always recheck with poll() right before making the callback. All sorts of things may have happened since poll() originally signaled the fd. We would like the main functional libxl code not to have to worry about spurious wakeups. In particular, this fixes a bug in the save/restore callout: the save helper message reader operates with the fd in blocking mode. In a multithreaded program one thread might have eaten all the messages out of the fd while another one is busy returning from poll and reacquiring the libxl lock, possibly resulting in a deadlock. (Also, we abolish the anomalous direct caller of efd->func.) Reported-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reported-by: Jim Fehlig <jfehlig@suse.com> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> CC: Jim Fehlig <jfehlig@suse.com> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Tested-by: Jim Fehlig <jfehlig@suse.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Index: xen-4.5.3-testing/tools/libxl/libxl_event.c =================================================================== --- xen-4.5.3-testing.orig/tools/libxl/libxl_event.c +++ xen-4.5.3-testing/tools/libxl/libxl_event.c @@ -1127,12 +1127,15 @@ static int afterpoll_check_fd(libxl__pol return revents; } -static void fd_occurs(libxl__egc *egc, libxl__ev_fd *efd, short revents) +static void fd_occurs(libxl__egc *egc, libxl__ev_fd *efd, short revents_ign) { - DBG("ev_fd=%p occurs fd=%d events=%x revents=%x", - efd, efd->fd, efd->events, revents); + short revents_current = libxl__fd_poll_recheck(egc, efd->fd, efd->events); - efd->func(egc, efd, efd->fd, efd->events, revents); + DBG("ev_fd=%p occurs fd=%d events=%x revents_ign=%x revents_current=%x", + efd, efd->fd, efd->events, revents_ign, revents_current); + + if (revents_current) + efd->func(egc, efd, efd->fd, efd->events, revents_current); } static void afterpoll_internal(libxl__egc *egc, libxl__poller *poller, @@ -1261,10 +1264,7 @@ void libxl_osevent_occurred_fd(libxl_ctx if (!ev) goto out; if (ev->fd != fd) goto out; - short current_revents = libxl__fd_poll_recheck(egc, ev->fd, ev->events); - - if (current_revents) - ev->func(egc, ev, fd, ev->events, current_revents); + fd_occurs(egc, ev, revents_ign); out: CTX_UNLOCK; Index: xen-4.5.3-testing/tools/libxl/libxl_internal.h =================================================================== --- xen-4.5.3-testing.orig/tools/libxl/libxl_internal.h +++ xen-4.5.3-testing/tools/libxl/libxl_internal.h @@ -162,6 +162,9 @@ typedef void libxl__ev_fd_callback(libxl * * It is not permitted to listen for the same or overlapping events * on the same fd using multiple different libxl__ev_fd's. + * + * (Spurious wakeups, and spurious bits set in revents, are + * suppressed by the libxl event core.) */ struct libxl__ev_fd { /* caller should include this in their own struct */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor