Skip to content
Snippets Groups Projects
  1. Apr 01, 2021
    • Lukas Straub's avatar
      chardev: Fix yank with the chardev-change case · feb774ca
      Lukas Straub authored
      
      When changing from chardev-socket (which supports yank) to
      chardev-socket again, it fails, because the new chardev attempts
      to register a new yank instance. This in turn fails, as there
      still is the yank instance from the current chardev. Also,
      the old chardev shouldn't unregister the yank instance when it
      is freed.
      
      To fix this, now the new chardev only registers a yank instance if
      the current chardev doesn't support yank and thus hasn't registered
      one already. Also, when the old chardev is freed, it now only
      unregisters the yank instance if the new chardev doesn't need it.
      
      If the initialization of the new chardev fails, it still has
      chr->handover_yank_instance set and won't unregister the yank
      instance when it is freed.
      
      s->registered_yank is always true here, as chardev-change only works
      on user-visible chardevs and those are guraranteed to register a
      yank instance as they are initialized via
      chardev_new()
       qemu_char_open()
        cc->open() (qmp_chardev_open_socket()).
      
      Signed-off-by: default avatarLukas Straub <lukasstraub2@web.de>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Tested-by: default avatarLi Zhang <li.zhang@cloud.ionos.com>
      Message-Id: <9637888d7591d2971975188478bb707299a1dc04.1617127849.git.lukasstraub2@web.de>
      feb774ca
  2. Dec 15, 2020
    • Paolo Bonzini's avatar
      chardev: do not use machine_init_done · 5a1ee607
      Paolo Bonzini authored
      
      machine_init_done is not the right flag to check when preconfig
      is taken into account; for example "./qemu-system-x86_64 -serial
      mon:stdio -preconfig" does not print the QEMU monitor header until after
      exit_preconfig.  Add back a custom bool for mux character devices.  This
      partially undoes commit c7278b43 ("chardev: introduce chr_machine_done
      hook", 2018-03-12), but it keeps the cleaner logic using a function
      pointer in ChardevClass.
      
      Reviewed-by: default avatarIgor Mammedov <imammedo@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      5a1ee607
  3. Oct 15, 2020
  4. Sep 18, 2020
  5. Sep 09, 2020
  6. Jul 13, 2020
  7. Jan 08, 2020
  8. Aug 16, 2019
  9. Jun 12, 2019
    • Markus Armbruster's avatar
      Include qemu-common.h exactly where needed · a8d25326
      Markus Armbruster authored
      
      No header includes qemu-common.h after this commit, as prescribed by
      qemu-common.h's file comment.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-5-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
      block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
      target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
      target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
      target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
      target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
      net/tap-bsd.c fixed up]
      a8d25326
  10. May 13, 2019
  11. Feb 21, 2019
  12. Feb 13, 2019
  13. Feb 12, 2019
    • Artem Pisarenko's avatar
      chardev: fix mess in OPENED/CLOSED events when muxed · 7a9657ef
      Artem Pisarenko authored
      
      When chardev is multiplexed (mux=on) there are a lot of cases where
      CHR_EVENT_OPENED/CHR_EVENT_CLOSED events pairing (expected from
      frontend side) is broken. There are either generation of multiple
      repeated or extra CHR_EVENT_OPENED events, or CHR_EVENT_CLOSED just
      isn't generated at all.
      This is mostly because 'qemu_chr_fe_set_handlers()' function makes its
      own (and often wrong) implicit decision on updated frontend state and
      invokes 'fd_event' callback with 'CHR_EVENT_OPENED'. And even worse,
      it doesn't do symmetric action in opposite direction, as someone may
      expect (i.e. it doesn't invoke previously set 'fd_event' with
      'CHR_EVENT_CLOSED'). Muxed chardev uses trick by calling this function
      again to replace callback handlers with its own ones, but it doesn't
      account for such side effect.
      Fix that using extended version of this function with added argument
      for disabling side effect and keep original function for compatibility
      with lots of frontends already using this interface and being
      "tolerant" to its side effects.
      One more source of event duplication is just line of code in
      char-mux.c, which does far more than comment above says (obvious fix).
      
      Signed-off-by: default avatarArtem Pisarenko <artem.k.pisarenko@gmail.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <7dde6abbd21682857f8294644013173c0b9949b3.1541507990.git.artem.k.pisarenko@gmail.com>
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      7a9657ef
  14. Dec 12, 2018
    • Marc-André Lureau's avatar
      char: add a QEMU_CHAR_FEATURE_GCONTEXT flag · 9ac3788b
      Marc-André Lureau authored
      
      QEMU_CHAR_FEATURE_GCONTEXT declares the character device can switch
      GMainContext.
      
      Assert we don't switch context when the character device doesn't
      provide this feature.  Character device users must not violate this
      restriction.  In particular, user configurations that violate them
      must be rejected.
      
      Existing frontend that rely on context switching would now assert() if
      the backend doesn't allow it (instead of silently producing undesired
      events in the default context). Following patches improve the
      situation by reporting an error earlier instead, on the frontend side.
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Message-Id: <20181205203737.9011-4-marcandre.lureau@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      9ac3788b
  15. Oct 03, 2018
    • Marc-André Lureau's avatar
      chardev: mark the calls that allow an implicit mux monitor · 95e30b2a
      Marc-André Lureau authored
      
      This is mostly for readability of the code. Let's make it clear which
      callers can create an implicit monitor when the chardev is muxed.
      
      This will also enforce a safer behaviour, as we don't really support
      creating monitor anywhere/anytime at the moment. Add an assert() to
      make sure the programmer explicitely wanted that behaviour.
      
      There are documented cases, such as: -serial/-parallel/-virtioconsole
      and to less extent -debugcon.
      
      Less obvious and questionable ones are -gdb, SLIRP -guestfwd and Xen
      console. Add a FIXME note for those, but keep the support for now.
      
      Other qemu_chr_new() callers either have a fixed parameter/filename
      string or do not need it, such as -qtest:
      
      * qtest.c: qtest_init()
        Afaik, only used by tests/libqtest.c, without mux. I don't think we
        support it outside of qemu testing: drop support for implicit mux
        monitor (qemu_chr_new() call: no implicit mux now).
      
      * hw/
        All with literal @filename argument that doesn't enable mux monitor.
      
      * tests/
        All with @filename argument that doesn't enable mux monitor.
      
      On a related note, the list of monitor creation places:
      
      - the chardev creators listed above: all from command line (except
        perhaps Xen console?)
      
      - -gdb & hmp gdbserver will create a "GDB monitor command" chardev
        that is wired to an HMP monitor.
      
      - -mon command line option
      
      From this short study, I would like to think that a monitor may only
      be created in the main thread today, though I remain skeptical :)
      
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      95e30b2a
    • Marc-André Lureau's avatar
      5662576a
  16. Aug 23, 2018
  17. Jun 30, 2018
  18. Mar 12, 2018
    • Peter Xu's avatar
      chardev: introduce chr_machine_done hook · c7278b43
      Peter Xu authored
      
      Introduce ChardevClass.chr_machine_done() hook so that chardevs can run
      customized procedures after machine init.
      
      There was an existing mux user already that did similar thing but used a
      raw machine done notifier.  Generalize it into a framework, and let the
      mux chardevs provide such a class-specific hook to achieve the same
      thing.  Then we can move the mux related code to the char-mux.c file.
      
      Since at it, replace the mux_realized variable with the global
      machine_init_done varible.
      
      This notifier framework will be further leverged by other type of
      chardevs soon.
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-Id: <20180306053320.15401-6-peterx@redhat.com>
      Acked-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c7278b43
  19. Mar 02, 2018
  20. Feb 09, 2018
  21. Jan 12, 2018
    • Peter Xu's avatar
      chardev: introduce qemu_chr_timeout_add_ms() · 2c716ba1
      Peter Xu authored
      
      It's a replacement of g_timeout_add[_seconds]() for chardevs.  Chardevs
      now can have dedicated gcontext, we should always bind chardev tasks
      onto those gcontext rather than the default main context.  Since there
      are quite a few of g_timeout_add[_seconds]() callers, a new function
      qemu_chr_timeout_add_ms() is introduced.
      
      One thing to mention is that, terminal3270 is still always running on
      main gcontext.  However let's convert that as well since it's still part
      of chardev codes and in case one day we'll miss that when we move it out
      of main gcontext too.
      
      Also, convert all the timers from GSource tags into GSource pointers.
      Gsource tag IDs and g_source_remove()s can only work with default
      gcontext, while now these GSources can logically be attached to other
      contexts.  So let's use explicit g_source_destroy() plus another
      g_source_unref() to remove a timer.
      
      Note: when in the timer handler, we don't need the g_source_destroy()
      any more since that'll be done automatically if the timer handler
      returns false (and that's what all the current handlers do).
      
      Yet another note: in pty_chr_rearm_timer() we take special care for
      ms=1000.  This patch merged the two cases into one.
      
      Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
      Message-Id: <20180104141835.17987-4-peterx@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      2c716ba1
  22. Dec 21, 2017
  23. Sep 22, 2017
  24. Aug 01, 2017
  25. Jul 14, 2017
  26. Jun 08, 2017
  27. Jun 02, 2017
Loading