From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58595 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PKWtB-0005g5-29 for qemu-devel@nongnu.org; Mon, 22 Nov 2010 08:57:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PKWsV-0001rI-N9 for qemu-devel@nongnu.org; Mon, 22 Nov 2010 08:56:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PKWsV-0001r5-B9 for qemu-devel@nongnu.org; Mon, 22 Nov 2010 08:56:19 -0500 From: Juan Quintela In-Reply-To: <20101121191641.GA28858@redhat.com> (Michael S. Tsirkin's message of "Sun, 21 Nov 2010 21:16:42 +0200") References: <20101121191641.GA28858@redhat.com> Date: Mon, 22 Nov 2010 14:56:08 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCHv3 RFC] qemu-kvm: stop devices on vmstop List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: jasowang@redhat.com, qemu-devel@nongnu.org, kraxel@redhat.com "Michael S. Tsirkin" wrote: > Stop running devices on vmstop, so that VM does not interact with > outside world at that time. > > Whitelist system handlers which run even when VM is stopped. > These are specific handlers like monitor, gdbstub, migration. > I'm not really sure about ui: spice and vnc: do they need to run? > > -int qemu_aio_set_fd_handler(int fd, > +static int qemu_aio_assign_fd_handler(int fd, > IOHandler *io_read, > IOHandler *io_write, > AioFlushHandler *io_flush, > AioProcessQueue *io_process_queue, > - void *opaque) > + void *opaque, bool system) > { New names much better O:-) > - qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); > + qemu_set_systemk_fd_handler(vs->csock, NULL, vnc_client_read, NULL, vs); typo? it would not compile (extra k on syntemk) > +static inline void call_ioh_fds(IOHandlerRecordList *list, > + fd_set *rfds, fd_set *wfds) > +{ > + IOHandlerRecord *ioh, *pioh; > + > + QLIST_FOREACH_SAFE(ioh, list, next, pioh) { > + if (ioh->deleted) { > + QLIST_REMOVE(ioh, next); > + qemu_free(ioh); > + continue; > + } > + if (ioh->fd_read && FD_ISSET(ioh->fd, rfds)) { > + ioh->fd_read(ioh->opaque); > + if (!(ioh->fd_read_poll && ioh->fd_read_poll(ioh->opaque))) > + FD_CLR(ioh->fd, rfds); > + } > + if (ioh->fd_write && FD_ISSET(ioh->fd, wfds)) { > + ioh->fd_write(ioh->opaque); > + } Notice this loop has been changed to be able that the fd_read to delete the handle. > - } > > - slirp_select_poll(&rfds, &wfds, &xfds, (ret < 0)); > + slirp_select_poll(&rfds, &wfds, &xfds, (ret < 0)); white space damage? I haven't tested it either, to know if changing things to the bottom handler would improve things. Later, Juan.