Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-19 Thread Paolo Bonzini
Il 19/03/2013 11:38, Peter Maydell ha scritto: > On 19 March 2013 10:34, Paolo Bonzini wrote: >> Il 19/03/2013 11:12, Peter Maydell ha scritto: >>> Threads are supported by the language runtime provided on all >>> the systems we support, which is why they are reasonably usable. >>> When you've per

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-19 Thread Paolo Bonzini
Il 19/03/2013 11:12, Peter Maydell ha scritto: > On 19 March 2013 09:30, Markus Armbruster wrote: >> Coroutines are a perfectly pedestrian control flow construct. > > In some languages, sure. Not in C, and we're writing C. > >> Coroutines fit about as well with C as threads, namely not really. >

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-19 Thread Peter Maydell
On 19 March 2013 10:34, Paolo Bonzini wrote: > Il 19/03/2013 11:12, Peter Maydell ha scritto: >> Threads are supported by the language runtime provided on all >> the systems we support, which is why they are reasonably usable. >> When you've persuaded glibc, MacOSX libc and Windows to implement >>

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-19 Thread Peter Maydell
On 19 March 2013 09:30, Markus Armbruster wrote: > Coroutines are a perfectly pedestrian control flow construct. In some languages, sure. Not in C, and we're writing C. > Coroutines fit about as well with C as threads, namely not really. Threads are supported by the language runtime provided on

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-19 Thread Markus Armbruster
Peter Maydell writes: > On 13 March 2013 12:34, Anthony Liguori wrote: >> AioContext is necessary for the block layer because the block layer >> still has synchronous I/O. I think we should aim to replace all sync >> I/O in the long term with coroutine based I/O. > > I think coroutines are drea

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-15 Thread Stefan Hajnoczi
On Thu, Mar 14, 2013 at 10:04:23AM +, Peter Maydell wrote: > On 13 March 2013 12:34, Anthony Liguori wrote: > > AioContext is necessary for the block layer because the block layer > > still has synchronous I/O. I think we should aim to replace all sync > > I/O in the long term with coroutine

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread Paolo Bonzini
Il 14/03/2013 15:08, liu ping fan ha scritto: > On Wed, Mar 13, 2013 at 6:58 PM, Paolo Bonzini wrote: >> Il 13/03/2013 06:59, Liu Ping Fan ha scritto: >>> These series aim to port network backend onto glib, and >>> prepare for moving towards making network layer mutlit-thread. >>> The brief of the

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread liu ping fan
On Wed, Mar 13, 2013 at 6:58 PM, Paolo Bonzini wrote: > Il 13/03/2013 06:59, Liu Ping Fan ha scritto: >> These series aim to port network backend onto glib, and >> prepare for moving towards making network layer mutlit-thread. >> The brief of the whole aim and plan is documented on >> http://wiki.

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread Peter Maydell
On 14 March 2013 11:04, Paolo Bonzini wrote: >>> > The gthread coroutine backend is really more for debugging than anything >>> > else. It works for qemu-io/img, but not for QEMU. Good that you >>> > actually found proof. :) >> If it's not supposed to work we shouldn't let configure default >> t

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread Paolo Bonzini
Il 14/03/2013 12:00, Peter Maydell ha scritto: >>> >> I think coroutines are dreadful and we should really not be moving >>> >> towards greater use of them. They're just really really not portable >>> >> and they don't fit with the C language, and they're a constant source >>> >> of problems.(For i

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread Peter Maydell
On 14 March 2013 10:53, Paolo Bonzini wrote: > Il 14/03/2013 11:04, Peter Maydell ha scritto: >> I think coroutines are dreadful and we should really not be moving >> towards greater use of them. They're just really really not portable >> and they don't fit with the C language, and they're a const

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread Paolo Bonzini
Il 14/03/2013 11:04, Peter Maydell ha scritto: > On 13 March 2013 12:34, Anthony Liguori wrote: >> AioContext is necessary for the block layer because the block layer >> still has synchronous I/O. I think we should aim to replace all sync >> I/O in the long term with coroutine based I/O. > > I t

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread Peter Maydell
On 13 March 2013 12:34, Anthony Liguori wrote: > AioContext is necessary for the block layer because the block layer > still has synchronous I/O. I think we should aim to replace all sync > I/O in the long term with coroutine based I/O. I think coroutines are dreadful and we should really not be

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread Paolo Bonzini
Il 14/03/2013 10:29, Stefan Hajnoczi ha scritto: > > Okay, I owe AioContext a deeper look then. > > We still have one level of nesting - the mainloop vs the AioContext > aio_pool(). That's a different thing, and it can be solved quite easily. As soon as each BDS will have its own AioContext, the

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-14 Thread Stefan Hajnoczi
On Wed, Mar 13, 2013 at 12:52:11PM -0500, Anthony Liguori wrote: > Paolo Bonzini writes: > > > Il 13/03/2013 18:23, Anthony Liguori ha scritto: > >> I think the nesting is also a bit strange. > > > > Nesting's gone since we added coroutines. :) > > Okay, I owe AioContext a deeper look then. We

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Anthony Liguori
Paolo Bonzini writes: >> 1) It has no facility for timer events > > Yup, it's on the todo list. > >> 2) It's tied to file descriptors (only a problem for win32) > > The other way round: it's not tied to file descriptors for win32, > which is already a problem for e.g. networked backends. main-lo

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > On Wed, Mar 13, 2013 at 06:31:57PM +0100, Paolo Bonzini wrote: >> > We could do that purely >> > with AioContexts as well, but that rules out a large class of >> > backends that offloaded event loops can interact with, such as Chardevs, >> > so I think modelling how

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Paolo Bonzini
> 1) It has no facility for timer events Yup, it's on the todo list. > 2) It's tied to file descriptors (only a problem for win32) The other way round: it's not tied to file descriptors for win32, which is already a problem for e.g. networked backends. main-loop.c has the code that is needed,

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Anthony Liguori
Paolo Bonzini writes: > Il 13/03/2013 18:23, Anthony Liguori ha scritto: >> I think the nesting is also a bit strange. > > Nesting's gone since we added coroutines. :) Okay, deeper isn't that hard apparently. There's not a lot in AioContext. Specifically: 1) It has no facility for timer event

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Michael S. Tsirkin
On Wed, Mar 13, 2013 at 06:31:57PM +0100, Paolo Bonzini wrote: > > We could do that purely > > with AioContexts as well, but that rules out a large class of > > backends that offloaded event loops can interact with, such as Chardevs, > > so I think modelling how to handle both will provide a thread

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Anthony Liguori
Paolo Bonzini writes: > Il 13/03/2013 18:23, Anthony Liguori ha scritto: >> I think the nesting is also a bit strange. > > Nesting's gone since we added coroutines. :) Okay, I owe AioContext a deeper look then. Regards, Anthony Liguori >>> I would like the dataplane virtio code to >>> grow ev

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Paolo Bonzini
Il 13/03/2013 18:23, Anthony Liguori ha scritto: > I think the nesting is also a bit strange. Nesting's gone since we added coroutines. :) >> and AioContext's code is vastly simpler than GMainLoop's. > > For now. Fair enough. :) >> AioContext is also documented and unit tested, with tests >> f

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Paolo Bonzini
Il 13/03/2013 18:06, mdroth ha scritto: > But isn't there also an effort to make virtio-blk/virtio-net a model for > threaded devices/subsystems in general, as opposed to "accelerators" for > specific use-cases like tap-based backends? I think this is the main > question, because most of the planni

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Anthony Liguori
Paolo Bonzini writes: > Il 13/03/2013 13:34, Anthony Liguori ha scritto: >> Paolo Bonzini writes: >> >>> Il 13/03/2013 06:59, Liu Ping Fan ha scritto: These series aim to port network backend onto glib, and prepare for moving towards making network layer mutlit-thread. The brief

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread mdroth
On Wed, Mar 13, 2013 at 05:21:02PM +0100, Paolo Bonzini wrote: > Il 13/03/2013 13:34, Anthony Liguori ha scritto: > > Paolo Bonzini writes: > > > >> Il 13/03/2013 06:59, Liu Ping Fan ha scritto: > >>> These series aim to port network backend onto glib, and > >>> prepare for moving towards making

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Paolo Bonzini
Il 13/03/2013 13:34, Anthony Liguori ha scritto: > Paolo Bonzini writes: > >> Il 13/03/2013 06:59, Liu Ping Fan ha scritto: >>> These series aim to port network backend onto glib, and >>> prepare for moving towards making network layer mutlit-thread. >>> The brief of the whole aim and plan is doc

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Anthony Liguori
Paolo Bonzini writes: > Il 13/03/2013 06:59, Liu Ping Fan ha scritto: >> These series aim to port network backend onto glib, and >> prepare for moving towards making network layer mutlit-thread. >> The brief of the whole aim and plan is documented on >> http://wiki.qemu.org/Features/network_reen

Re: [Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-13 Thread Paolo Bonzini
Il 13/03/2013 06:59, Liu Ping Fan ha scritto: > These series aim to port network backend onto glib, and > prepare for moving towards making network layer mutlit-thread. > The brief of the whole aim and plan is documented on > http://wiki.qemu.org/Features/network_reentrant > > In these series, at

[Qemu-devel] [RFC PATCH 0/2] port network layer onto glib

2013-03-12 Thread Liu Ping Fan
These series aim to port network backend onto glib, and prepare for moving towards making network layer mutlit-thread. The brief of the whole aim and plan is documented on http://wiki.qemu.org/Features/network_reentrant In these series, attach each NetClientState with a GSource At the first, I us