From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40268 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxJ43-0001Gt-DD for qemu-devel@nongnu.org; Wed, 09 Mar 2011 08:04:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxJ3z-0003Uu-B6 for qemu-devel@nongnu.org; Wed, 09 Mar 2011 08:04:28 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:60485) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxJ3z-0003Sn-5j for qemu-devel@nongnu.org; Wed, 09 Mar 2011 08:04:27 -0500 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p29CnO5w001735 for ; Wed, 9 Mar 2011 05:49:24 -0700 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p29D4MV0059078 for ; Wed, 9 Mar 2011 06:04:22 -0700 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p29D4LdX026129 for ; Wed, 9 Mar 2011 06:04:22 -0700 Message-ID: <4D777AD3.6040502@linux.vnet.ibm.com> Date: Wed, 09 Mar 2011 07:04:19 -0600 From: Michael Roth MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [RFC][PATCH v7 03/16] Make qemu timers available for tools References: <1299528642-23631-1-git-send-email-mdroth@linux.vnet.ibm.com> <1299528642-23631-4-git-send-email-mdroth@linux.vnet.ibm.com> <4D77578F.5000905@redhat.com> In-Reply-To: <4D77578F.5000905@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: agl@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com, abeekhof@redhat.com, qemu-devel@nongnu.org, aliguori@linux.vnet.ibm.com, markus_mueller@de.ibm.com On 03/09/2011 04:33 AM, Jes Sorensen wrote: > On 03/07/11 21:10, Michael Roth wrote: >> To be able to use qemu_mod_timer() and friends to register timeout >> events for virtagent's qemu-va tool, we need to do the following: >> >> Move several blocks of code out of cpus.c that handle initialization >> of qemu's io_thread_fd and working with it via >> qemu_notify_event()/qemu_event_read()/etc, and make them accessible >> as backend functions to both the emulator code and qemu-tool.c via >> wrapper functions within cpus.c and qemu-tool.c, respectively. These >> have been added to qemu-ioh.c, where similar treatment was given to >> qemu_set_fd_handler() and friends. >> >> Some of these wrapper functions lack declarations when being >> built into tools, so we add those via qemu-tool.h, which can be included >> by a tool to access them. With these changes we can drive timers in a >> tool linking it against qemu-timer.o and then implementing something >> similar to the main i/o loop in vl.c: >> > > [snip] > >> diff --git a/qemu-ioh.c b/qemu-ioh.c >> index cc71470..5c3f94c 100644 >> --- a/qemu-ioh.c >> +++ b/qemu-ioh.c >> @@ -113,3 +117,94 @@ void qemu_process_fd_handlers2(void *ioh_record_list, const fd_set *rfds, >> } >> } >> } >> + >> +#ifndef _WIN32 >> +void iothread_event_increment(int *io_thread_fd) > > Please move these functions into posix/w32 specific files so we don't > get anymore ugly #ifdefs. It would be good if we could use a wrapper > struct as well to hide the different data types so we don't need #ifdefs > in the calling code as well. Yup, meant to add this to the TODO. I may end up sending these general tools changes out in a separate patchset since they seem to be in conflict with quite of few patches floating around the list. Either way I'll make sure to get these cleaned up and tested a bit a more. > > Cheers, > Jes >