From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaM6m-0003VG-8M for qemu-devel@nongnu.org; Fri, 11 Sep 2015 07:03:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaM6g-0006ZZ-I2 for qemu-devel@nongnu.org; Fri, 11 Sep 2015 07:03:08 -0400 References: <20150729115333.GA15022@ad.nay.redhat.com> <55B8C12D.2070105@redhat.com> <20150909032205.GA10922@ad.nay.redhat.com> <55F28D99.5060908@redhat.com> <20150911091433.GA6759@ad.nay.redhat.com> <20150911094425.GA9241@ad.nay.redhat.com> <55F2A4D6.6050009@redhat.com> <20150911104055.GB9241@ad.nay.redhat.com> <55F2B0EE.7030407@redhat.com> <20150911110122.GC9241@ad.nay.redhat.com> From: Paolo Bonzini Message-ID: <55F2B4D7.4060801@redhat.com> Date: Fri, 11 Sep 2015 13:02:47 +0200 MIME-Version: 1.0 In-Reply-To: <20150911110122.GC9241@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 11/11] block: Only poll block layer fds in bdrv_aio_poll List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, qemu-block@nongnu.org, Alberto Garcia , qemu-devel@nongnu.org, stefanha@redhat.com On 11/09/2015 13:01, Fam Zheng wrote: > On Fri, 09/11 12:46, Paolo Bonzini wrote: >> >> >> On 11/09/2015 12:40, Fam Zheng wrote: >>> On Fri, 09/11 11:54, Paolo Bonzini wrote: >>>> >>>> >>>> On 11/09/2015 11:44, Fam Zheng wrote: >>>>>>>> That would be a step back. Using GSource is useful because it lets >>>>>>>> you integrate libraries such as GTK+. >>>>>>> >>>>>>> Can we move GTK to a separate GSource thread? >>>>>> >>>>>> I think that GTK should always run in the main thread, or at least the >>>>>> one running the default main loop / GMainContext. >>>>> >>>>> Yeah it's basically GMainContext staying in the main thread and >>>>> block/net/chardev I/O put in a new AioContext thread. >>>> >>>> Why? The point of an event loop is that you can multiplex everything on >>>> the same thread. Unless we have specific needs (e.g. scalability) one >>>> thread is the way to go and keep things simple. >>> >>> The reason is scalability. :) >> >> Scalability of what? If virtio-net or virtio-serial needs to be more >> scalable, putting all of them into a non-main-loop thread will not make >> things more scalable, because you have a single thread anyway. You'd >> need to go BQL-free and allow an arbitrary number. >> >>> Moving things to AIO isn't deviation, it's more about enabling of dataplane and >>> epoll. That's why block was moved to AioContext, and I think we can do similar >>> for net and serial, the difference is that as a start, they don't need to be >>> fully BQL-free like virtio-blk and scsi. But by running in an aio_poll() loop, >>> they can better performance because of epoll. >> >> Isn't that what your "iohandler.c with AioHandler" already does? True, >> it would be epoll-within-poll, not pure poll. But if you need epoll, >> you might as well go BQL-free. > > epoll-within-poll? Do you mean change the main event loop from: > > qemu_poll_ns([..., ioeventfd1, ioeventfd2, ..., ioeventfd99], ...) > > to > > qemu_poll_ns([epollfd], ...) > > where epollfd watches all the fds, and let the handler of epollfd do > epoll_wait()? I mean that glib's main loop (or os_host_main_loop_wait in main-loop.c) uses poll, and then the AioContext GSource uses epoll. Still, you have a constant (and low) number of file descriptors in the outer poll. Paolo