1. 23 3月, 2016 1 次提交
  2. 16 3月, 2016 1 次提交
    • P
      replay: character devices · 33577b47
      Pavel Dovgalyuk 提交于
      This patch implements record and replay of character devices.
      It records chardevs communication in replay mode. Recorded information
      include data read from backend and counter of bytes written
      from frontend to backend to preserve frontend internal state.
      If character device was configured through the command line in record mode,
      then in replay mode it should be also added to command line. Backend of
      the character device could be changed in replay mode.
      Replaying of devices that perform ioctl and get_msgfd operations is not
      supported.
      gdbstub which also acts as a backend is not recorded to allow controlling
      the replaying through gdb. Monitor backends are also not recorded.
      Signed-off-by: NPavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
      Message-Id: <20160314074436.4980.83856.stgit@PASHA-ISP>
      [Add stubs. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      33577b47
  3. 25 2月, 2016 1 次提交
  4. 02 2月, 2016 1 次提交
  5. 16 1月, 2016 1 次提交
    • D
      qemu-char: add logfile facility to all chardev backends · d0d7708b
      Daniel P. Berrange 提交于
      Typically a UNIX guest OS will log boot messages to a serial
      port in addition to any graphical console. An admin user
      may also wish to use the serial port for an interactive
      console. A virtualization management system may wish to
      collect system boot messages by logging the serial port,
      but also wish to allow admins interactive access.
      
      Currently providing such a feature forces the mgmt app
      to either provide 2 separate serial ports, one for
      logging boot messages and one for interactive console
      login, or to proxy all output via a separate service
      that can multiplex the two needs onto one serial port.
      While both are valid approaches, they each have their
      own downsides. The former causes confusion and extra
      setup work for VM admins creating disk images. The latter
      places an extra burden to re-implement much of the QEMU
      chardev backends logic in libvirt or even higher level
      mgmt apps and adds extra hops in the data transfer path.
      
      A simpler approach that is satisfactory for many use
      cases is to allow the QEMU chardev backends to have a
      "logfile" property associated with them.
      
       $QEMU -chardev socket,host=localhost,port=9000,\
                      server=on,nowait,id-charserial0,\
      		logfile=/var/log/libvirt/qemu/test-serial0.log
             -device isa-serial,chardev=charserial0,id=serial0
      
      This patch introduces a 'ChardevCommon' struct which
      is setup as a base for all the ChardevBackend types.
      Ideally this would be registered directly as a base
      against ChardevBackend, rather than each type, but
      the QAPI generator doesn't allow that since the
      ChardevBackend is a non-discriminated union. The
      ChardevCommon struct provides the optional 'logfile'
      parameter, as well as 'logappend' which controls
      whether QEMU truncates or appends (default truncate).
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <1452516281-27519-1-git-send-email-berrange@redhat.com>
      [Call qemu_chr_parse_common if cd->parse is NULL. - Paolo]
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d0d7708b
  6. 25 10月, 2015 1 次提交
  7. 19 10月, 2015 4 次提交
  8. 14 10月, 2015 1 次提交
  9. 17 9月, 2014 2 次提交
  10. 06 8月, 2014 1 次提交
    • P
      backends: Introduce chr-testdev · 5692399f
      Paolo Bonzini 提交于
      From: Paolo Bonzini <pbonzini@redhat.com>
      
      chr-testdev enables a virtio serial channel to be used for guest
      initiated qemu exits. hw/misc/debugexit already enables guest
      initiated qemu exits, but only for PC targets. chr-testdev supports
      any virtio-capable target. kvm-unit-tests/arm is already making use
      of this backend.
      
      Currently there is a single command implemented, "q".  It takes a
      (prefix) argument for the exit code, thus an exit is implemented by
      writing, e.g. "1q", to the virtio-serial port.
      
      It can be used as:
         $QEMU ... \
           -device virtio-serial-device \
           -device virtserialport,chardev=ctd -chardev testdev,id=ctd
      
      or, use:
         $QEMU ... \
           -device virtio-serial-device \
           -device virtconsole,chardev=ctd -chardev testdev,id=ctd
      
      to bind it to virtio-serial port0.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NAndrew Jones <drjones@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5692399f
  11. 06 7月, 2014 1 次提交
    • K
      Handle G_IO_HUP in tcp_chr_read for tcp chardev · 812c1057
      Kirill Batuzov 提交于
      Since commit cdaa86a5
      ("Add G_IO_HUP handler for socket chardev")
      GLib limitation results in a bug on Windows host. Steps to reproduce:
      
      Start qemu: qemu-system-i386 -qmp tcp:127.0.0.1:4444:server:nowait
      Connect with telnet: telnet 127.0.0.1 4444
      Try sending some data from telnet.
      Expected result: answers from QEMU.
      Observed result: no answers (actually tcp_chr_read is not called at all).
      
      Due to GLib limitations it is not possible to create several watches on one
      channel on Windows hosts. See bug #338943 in GNOME bugzilla for details:
      https://bugzilla.gnome.org/show_bug.cgi?id=338943
      
      This reimplements commit cdaa86a5
      ("Add G_IO_HUP handler for socket chardev") using a single watch:
      
      Handle G_IO_HUP in tcp_chr_read instead. It is already watched by a
      corresponding watch.  Remove the second watch with its handler.
      
      Cc: Antonios Motakis <a.motakis@virtualopensystems.com>
      Cc: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NKirill Batuzov <batuzovk@ispras.ru>
      Signed-off-by: NNikita Belov <zodiac@ispras.ru>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      812c1057
  12. 23 6月, 2014 3 次提交
  13. 19 6月, 2014 4 次提交
  14. 11 6月, 2014 1 次提交
  15. 16 12月, 2013 1 次提交
  16. 05 9月, 2013 1 次提交
  17. 31 7月, 2013 1 次提交
    • M
      chardev: fix CHR_EVENT_OPENED events for mux chardevs · 7b7ab18d
      Michael Roth 提交于
      As of bd5c51ee, chardevs no longer use
      bottom-halves to issue CHR_EVENT_OPENED events. To maintain past
      semantics, we instead defer the CHR_EVENT_OPENED events toward the end
      of chardev initialization.
      
      For muxes, this isn't good enough, since a range of FEs must be able
      to attach to the mux prior to any CHR_EVENT_OPENED being issued, else
      each FE will immediately print it's initial output (prompts, banners,
      etc.) just prior to us switching to the next FE as part of
      initialization.
      
      The is new and confusing behavior for users, as they'll see output for
      things like the HMP monitor, even though their the current mux focus
      may be a guest serial port with potentially no output.
      
      We fix this by further deferring CHR_EVENT_OPENED events for FEs
      associated with muxes until after machine init by flagging mux chardevs
      with 'explicit_be_open', which suppresses emission of CHR_EVENT_OPENED
      events until we explicitly set the mux as opened later.
      
      Currently, we must defer till after machine init since we potentially
      associate FEs with muxes as part of realize (for instance,
      serial_isa_realizefn).
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Message-id: 1375207462-8141-1-git-send-email-mdroth@linux.vnet.ibm.com
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      7b7ab18d
  18. 29 6月, 2013 1 次提交
  19. 11 6月, 2013 1 次提交
    • M
      qemu-char: don't issue CHR_EVENT_OPEN in a BH · bd5c51ee
      Michael Roth 提交于
      When CHR_EVENT_OPENED was initially added, it was CHR_EVENT_RESET,
      and it was issued as a bottom-half:
      
      86e94dea
      
      Which we basically used to print out a greeting/prompt for the
      monitor.
      
      AFAICT the only reason this was ever done in a BH was because in
      some cases we'd modify the chr_write handler for a new chardev
      backend *after* the site where we issued the reset (see:
      86e94d:qemu_chr_open_stdio())
      
      At some point this event was renamed to CHR_EVENT_OPENED, and we've
      maintained the use of this BH ever since.
      
      However, due to 9f939df9, we schedule
      the BH via g_idle_add(), which is causing events to sometimes be
      delivered after we've already begun processing data from backends,
      leading to:
      
       known bugs:
      
        QMP:
          session negotation resets with OPENED event, in some cases this
          is causing new sessions to get sporadically reset
      
       potential bugs:
      
        hw/usb/redirect.c:
          can_read handler checks for dev->parser != NULL, which may be
          true if CLOSED BH has not been executed yet. In the past, OPENED
          quiesced outstanding CLOSED events prior to us reading client
          data. If it's delayed, our check may allow reads to occur even
          though we haven't processed the OPENED event yet, and when we
          do finally get the OPENED event, our state may get reset.
      
        qtest.c:
          can begin session before OPENED event is processed, leading to
          a spurious reset of the system and irq_levels
      
        gdbstub.c:
          may start a gdb session prior to the machine being paused
      
      To fix these, let's just drop the BH.
      
      Since the initial reasoning for using it still applies to an extent,
      work around that by deferring the delivery of CHR_EVENT_OPENED until
      after the chardevs have been fully initialized, toward the end of
      qmp_chardev_add() (or some cases, qemu_chr_new_from_opts()). This
      defers delivery long enough that we can be assured a CharDriverState
      is fully initialized before CHR_EVENT_OPENED is sent.
      
      Also, rather than requiring each chardev to do an explicit open, do it
      automatically, and allow the small few who don't desire such behavior to
      suppress the OPENED-on-init behavior by setting a 'explicit_be_open'
      flag.
      
      We additionally add missing OPENED events for stdio backends on w32,
      which were previously not being issued, causing us to not recieve the
      banner and initial prompts for qmp/hmp.
      Reported-by: NStefan Priebe <s.priebe@profihost.ag>
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Message-id: 1370636393-21044-1-git-send-email-mdroth@linux.vnet.ibm.com
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      bd5c51ee
  20. 17 4月, 2013 1 次提交
  21. 16 4月, 2013 1 次提交
  22. 05 4月, 2013 1 次提交
  23. 27 3月, 2013 6 次提交
  24. 26 3月, 2013 1 次提交
  25. 19 3月, 2013 1 次提交
    • K
      char: Fix return type of qemu_chr_fe_add_watch() · 2c8a5942
      Kevin Wolf 提交于
      qemu_chr_fe_add_watch() can return negative errors, therefore it must
      not have an unsigned return type. For consistency with other
      qemu_chr_fe_* functions, this uses a standard C int instead of glib
      types.
      
      In situations where qemu_chr_fe_add_watch() is falsely assumed to have
      succeeded, the serial ports would go into a state where it never becomes
      ready for transmitting more data; this is fixed by this patch.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      2c8a5942
  26. 13 3月, 2013 1 次提交