Skip to content

chardev: convert leftover glib APIs to use dedicate gcontext

Peter Xu qemu-devel 4 versions – Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 1 replyApplied
  2. v33 patches 1 replySuperseded
  3. v23 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v13 patches6 repliesSuperseded

Changes in v4 from the cover letter

- replace all timers from gsource tag IDs into gsource objects, otherwise g_source_remove() on that tag ID can errornously remove an gsource from default main context rather than the timer itself.

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3chardev: use backend chr context when watch for fechardev/char-fe.c+1 -10 replies
2/3chardev: let g_idle_add() be with chardev gcontextchardev/char-pty.c+13 -80 replies
3/3chardev: introduce qemu_chr_timeout_add_ms()chardev/char-pty.c chardev/char-socket.c chardev/char.c +2 more+74 -460 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchStefan HajnocziMarc-André Lureau
1/3R-b R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

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

v4:
- replace all timers from gsource tag IDs into gsource objects, otherwise g_source_remove() on that tag ID can errornously remove an gsource from default main context rather than the timer itself.

v3:
- rename function to qemu_chr_timeout_add_ms() [Stefan]
- add comment on return code [Stefan]
- add comment in commit message on why change GSource name [Stefan]

v2:
- add r-bs
- fix patch 3 on some s->ms conversion [Marc-André]

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_ms()

 chardev/char-fe.c      |  2 +-
 chardev/char-pty.c     | 64 +++++++++++++++++++++++++-------------------------
 chardev/char-socket.c  | 28 ++++++++++++++--------
 chardev/char.c         | 18 ++++++++++++++
 hw/char/terminal3270.c | 28 ++++++++++++----------
 include/chardev/char.h |  3 +++
 6 files changed, 88 insertions(+), 55 deletions(-)
Signature · 1 line
2.14.3