[Qemu-devel] [PATCH 0/3] chardev: convert leftover glib APIs to use dedicate gcontext

Peter Xu posted 3 patches 7 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20171228072945.9573-1-peterx@redhat.com
Test checkpatch passed
Test docker passed
Test ppc passed
Test s390x passed
There is a newer version of this series
chardev/char-fe.c      |  2 +-
chardev/char-pty.c     | 16 ++++++++--------
chardev/char-socket.c  |  4 ++--
chardev/char.c         | 20 ++++++++++++++++++++
hw/char/terminal3270.c |  7 ++++---
include/chardev/char.h |  2 ++
6 files changed, 37 insertions(+), 14 deletions(-)
[Qemu-devel] [PATCH 0/3] chardev: convert leftover glib APIs to use dedicate gcontext
Posted by Peter Xu 7 years, 10 months ago
There were existing work that tried to allow chardev to be run in a
dedicated gcontext rather than the default main context/thread.
Basically that work passed in the correct gcontext during
g_source_attach().  However, I found something missing along the way,
that some legacy glib APIs are used by chardev code which take the
main context as default:

   g_timeout_add_seconds
   g_timeout_add
   g_idle_add

To fully allow the chardevs to be run in dedicated gcontext, we need
to convert all these legacy APIs into g_source_attach() calls as well,
with the correct gcontext passed in.

This series tries to clean the rest of things up.

I picked up patch 1 from monitor-oob series into this series (which is
a missing of chardev frontend call fix for g_source_attach()), so that
this series can be a complete fix.

Please review.  Thanks,

Peter Xu (3):
  chardev: use backend chr context when watch for fe
  chardev: let g_idle_add() be with chardev gcontext
  chardev: introduce qemu_chr_timeout_add() and use

 chardev/char-fe.c      |  2 +-
 chardev/char-pty.c     | 16 ++++++++--------
 chardev/char-socket.c  |  4 ++--
 chardev/char.c         | 20 ++++++++++++++++++++
 hw/char/terminal3270.c |  7 ++++---
 include/chardev/char.h |  2 ++
 6 files changed, 37 insertions(+), 14 deletions(-)

-- 
2.14.3


Re: [Qemu-devel] [PATCH 0/3] chardev: convert leftover glib APIs to use dedicate gcontext
Posted by Paolo Bonzini 7 years, 9 months ago
On 28/12/2017 08:29, Peter Xu wrote:
> There were existing work that tried to allow chardev to be run in a
> dedicated gcontext rather than the default main context/thread.
> Basically that work passed in the correct gcontext during
> g_source_attach().  However, I found something missing along the way,
> that some legacy glib APIs are used by chardev code which take the
> main context as default:
> 
>    g_timeout_add_seconds
>    g_timeout_add
>    g_idle_add
> 
> To fully allow the chardevs to be run in dedicated gcontext, we need
> to convert all these legacy APIs into g_source_attach() calls as well,
> with the correct gcontext passed in.
> 
> This series tries to clean the rest of things up.
> 
> I picked up patch 1 from monitor-oob series into this series (which is
> a missing of chardev frontend call fix for g_source_attach()), so that
> this series can be a complete fix.
> 
> Please review.  Thanks,
> 
> Peter Xu (3):
>   chardev: use backend chr context when watch for fe
>   chardev: let g_idle_add() be with chardev gcontext
>   chardev: introduce qemu_chr_timeout_add() and use
> 
>  chardev/char-fe.c      |  2 +-
>  chardev/char-pty.c     | 16 ++++++++--------
>  chardev/char-socket.c  |  4 ++--
>  chardev/char.c         | 20 ++++++++++++++++++++
>  hw/char/terminal3270.c |  7 ++++---
>  include/chardev/char.h |  2 ++
>  6 files changed, 37 insertions(+), 14 deletions(-)
> 

All queued, thanks!

Paolo

Re: [Qemu-devel] [PATCH 0/3] chardev: convert leftover glib APIs to use dedicate gcontext
Posted by Peter Xu 7 years, 9 months ago
On Wed, Jan 03, 2018 at 08:10:58AM +0100, Paolo Bonzini wrote:
> On 28/12/2017 08:29, Peter Xu wrote:
> > There were existing work that tried to allow chardev to be run in a
> > dedicated gcontext rather than the default main context/thread.
> > Basically that work passed in the correct gcontext during
> > g_source_attach().  However, I found something missing along the way,
> > that some legacy glib APIs are used by chardev code which take the
> > main context as default:
> > 
> >    g_timeout_add_seconds
> >    g_timeout_add
> >    g_idle_add
> > 
> > To fully allow the chardevs to be run in dedicated gcontext, we need
> > to convert all these legacy APIs into g_source_attach() calls as well,
> > with the correct gcontext passed in.
> > 
> > This series tries to clean the rest of things up.
> > 
> > I picked up patch 1 from monitor-oob series into this series (which is
> > a missing of chardev frontend call fix for g_source_attach()), so that
> > this series can be a complete fix.
> > 
> > Please review.  Thanks,
> > 
> > Peter Xu (3):
> >   chardev: use backend chr context when watch for fe
> >   chardev: let g_idle_add() be with chardev gcontext
> >   chardev: introduce qemu_chr_timeout_add() and use
> > 
> >  chardev/char-fe.c      |  2 +-
> >  chardev/char-pty.c     | 16 ++++++++--------
> >  chardev/char-socket.c  |  4 ++--
> >  chardev/char.c         | 20 ++++++++++++++++++++
> >  hw/char/terminal3270.c |  7 ++++---
> >  include/chardev/char.h |  2 ++
> >  6 files changed, 37 insertions(+), 14 deletions(-)
> > 
> 
> All queued, thanks!

Paolo,

Would you like to queue V2 of the series which fixed the issue that
Marc-Andre has pointed out (Note that there is a v2.1 for patch 3).

Thanks anyways!

-- 
Peter Xu