[Qemu-devel] [PATCH v2 0/4] chardev: support non-default gcontext

Peter Xu posted 4 patches 8 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1505975754-21555-1-git-send-email-peterx@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
chardev/char-fd.c      |  5 ++---
chardev/char-fe.c      |  7 ++-----
chardev/char-pty.c     |  5 ++---
chardev/char-socket.c  |  7 +++----
chardev/char-udp.c     |  5 ++---
chardev/char.c         | 11 +++++++++++
include/chardev/char.h | 13 ++++++++++++-
7 files changed, 34 insertions(+), 19 deletions(-)
[Qemu-devel] [PATCH v2 0/4] chardev: support non-default gcontext
Posted by Peter Xu 8 years, 1 month ago
The old chardev may not fully support non-default GMainContext.  One
direct clue is that when we call io_add_watch_poll() sometimes we are
still passing in the NULL context pointer.

IIUC we are fine during setup since the context will be passed
correctly during setup via chr_update_read_handler().  However it
won't survive if chardev reconnected due to some reason.

This series tries to solve above problem by caching the gcontext
pointer in Chardev itself.

This will be required for the monitor OOB (out-of-band) support, since
in that series monitor backends may be run in non-default contexts.

Please review.  Thanks.

Peter Xu (4):
  chardev: new qemu_chr_be_update_read_handlers()
  chardev: add Chardev.gcontext field
  chardev: use per-dev context for io_add_watch_poll
  chardev: remove context in chr_update_read_handler

 chardev/char-fd.c      |  5 ++---
 chardev/char-fe.c      |  7 ++-----
 chardev/char-pty.c     |  5 ++---
 chardev/char-socket.c  |  7 +++----
 chardev/char-udp.c     |  5 ++---
 chardev/char.c         | 11 +++++++++++
 include/chardev/char.h | 13 ++++++++++++-
 7 files changed, 34 insertions(+), 19 deletions(-)

-- 
2.7.4


Re: [Qemu-devel] [PATCH v2 0/4] chardev: support non-default gcontext
Posted by Marc-André Lureau 8 years, 1 month ago
On Thu, Sep 21, 2017 at 8:35 AM, Peter Xu <peterx@redhat.com> wrote:
> The old chardev may not fully support non-default GMainContext.  One
> direct clue is that when we call io_add_watch_poll() sometimes we are
> still passing in the NULL context pointer.
>
> IIUC we are fine during setup since the context will be passed
> correctly during setup via chr_update_read_handler().  However it
> won't survive if chardev reconnected due to some reason.
>
> This series tries to solve above problem by caching the gcontext
> pointer in Chardev itself.
>
> This will be required for the monitor OOB (out-of-band) support, since
> in that series monitor backends may be run in non-default contexts.
>
> Please review.  Thanks.
>
> Peter Xu (4):
>   chardev: new qemu_chr_be_update_read_handlers()
>   chardev: add Chardev.gcontext field
>   chardev: use per-dev context for io_add_watch_poll
>   chardev: remove context in chr_update_read_handler
>
>  chardev/char-fd.c      |  5 ++---
>  chardev/char-fe.c      |  7 ++-----
>  chardev/char-pty.c     |  5 ++---
>  chardev/char-socket.c  |  7 +++----
>  chardev/char-udp.c     |  5 ++---
>  chardev/char.c         | 11 +++++++++++
>  include/chardev/char.h | 13 ++++++++++++-
>  7 files changed, 34 insertions(+), 19 deletions(-)

It's only for the read handler, perhaps the gcontext field should be
named "read_context" or adding a comment to explain this is only used
for that.

Otherwise, looks good:
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


-- 
Marc-André Lureau