1. 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
  2. 29 6月, 2013 1 次提交
  3. 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
  4. 17 4月, 2013 1 次提交
  5. 16 4月, 2013 1 次提交
  6. 05 4月, 2013 1 次提交
  7. 27 3月, 2013 6 次提交
  8. 26 3月, 2013 1 次提交
  9. 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
  10. 13 3月, 2013 3 次提交
  11. 09 3月, 2013 3 次提交
  12. 16 1月, 2013 2 次提交
  13. 19 12月, 2012 4 次提交
  14. 01 11月, 2012 1 次提交
    • J
      chardev: Use timer instead of bottom-half to postpone open event · ac4119c0
      Jan Kiszka 提交于
      As the block layer may decide to flush bottom-halfs while the machine is
      still initializing (e.g. to read geometry data from the disk), our
      postponed open event may be processed before the last frontend
      registered with a muxed chardev.
      
      Until the semantics of BHs have been clarified, use an expired timer to
      achieve the same effect (suggested by Paolo Bonzini). This requires to
      perform the alarm timer initialization earlier as otherwise timer
      subsystem can be used before being ready.
      Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
      ac4119c0
  15. 30 10月, 2012 1 次提交
    • P
      aio: introduce AioContext, move bottom halves there · f627aab1
      Paolo Bonzini 提交于
      Start introducing AioContext, which will let us remove globals from
      aio.c/async.c, and introduce multiple I/O threads.
      
      The bottom half functions now take an additional AioContext argument.
      A bottom half is created with a specific AioContext that remains the
      same throughout the lifetime.  qemu_bh_new is just a wrapper that
      uses a global context.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f627aab1
  16. 04 2月, 2012 1 次提交
  17. 29 11月, 2011 1 次提交
  18. 22 10月, 2011 1 次提交
  19. 22 8月, 2011 9 次提交