On Mon, 09/29 11:28, Stefan Hajnoczi wrote: > On Mon, Sep 29, 2014 at 01:26:29PM +0800, Fam Zheng wrote: > > +int qemu_epoll(GPollFD *fds, guint nfds, int64_t timeout) > > +{ > > + /* A copy of last fd array, used to skip epoll_prepare when nothing > > + * changed. */ > > + static GPollFD *last_fds; > > + static guint last_nfds; > > + /* An array of fds that failed epoll_ctl and fall back to ppoll. Rare > > case > > + * too. */ > > + static GPollFD *g_poll_fds; > > + static guint g_poll_nfds; > > + static int *g_poll_fd_idx; > > + static int epollfd = -1; > > These static variables will suffer from race conditions since IOThread > AioContext also calls qemu_poll_ns() when dataplane is active. >
Good catch. Maybe we could pass the AioContext into qemu_poll_ns and put them in the struct? Fam