1. 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
  2. 07 6月, 2013 3 次提交
  3. 06 6月, 2013 4 次提交
  4. 04 6月, 2013 5 次提交
    • W
      block: dump snapshot and image info to specified output · 5b917044
      Wenchao Xia 提交于
      bdrv_snapshot_dump() and bdrv_image_info_dump() do not dump to a buffer now,
      some internal buffers are still used for format control, which have no
      chance to be truncated. As a result, these two functions have no more issue
      of truncation, and they can be used by both qemu and qemu-img with correct
      parameter specified.
      Signed-off-by: NWenchao Xia <xiawenc@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      5b917044
    • W
      block: move qmp and info dump related code to block/qapi.c · f364ec65
      Wenchao Xia 提交于
      This patch is a pure code move patch, except following modification:
      1 get_human_readable_size() is changed to static function.
      2 dump_human_image_info() is renamed to bdrv_image_info_dump().
      3 in qmp_query_block() and qmp_query_blockstats, use bdrv_next(bs)
      instead of direct traverse of global array 'bdrv_states'.
      4 collect_snapshots() and collect_image_info() are renamed, unused parameter
      *fmt in collect_image_info() is removed.
      5 code style fix.
      
      To avoid conflict and tip better, macro in header file is BLOCK_QAPI_H
      instead of QAPI_H. Now block.h and snapshot.h are at the same level in
      include path, block_int.h and qapi.h will both include them.
      Signed-off-by: NWenchao Xia <xiawenc@linux.vnet.ibm.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f364ec65
    • W
      block: move snapshot code in block.c to block/snapshot.c · de08c606
      Wenchao Xia 提交于
      All snapshot related code, except bdrv_snapshot_dump() and
      bdrv_is_snapshot(), is moved to block/snapshot.c. bdrv_snapshot_dump()
      will be moved to another file later. bdrv_is_snapshot() is not related
      with internal snapshot. It also fixes small code style errors reported
      by check script.
      Signed-off-by: NWenchao Xia <xiawenc@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      de08c606
    • S
      block: drop bs_snapshots global variable · 29d78271
      Stefan Hajnoczi 提交于
      The bs_snapshots global variable points to the BlockDriverState which
      will be used to save vmstate.  This is really a savevm.c concept but was
      moved into block.c:bdrv_snapshots() when it became clear that hotplug
      could result in a dangling pointer.
      
      While auditing the block layer's global state I came upon bs_snapshots
      and realized that a variable is not necessary here.  Simply find the
      first BlockDriverState capable of internal snapshots each time this is
      needed.
      
      The behavior of bdrv_snapshots() is preserved across hotplug because new
      drives are always appended to the bdrv_states list.  This means that
      calling the new find_vmstate_bs() function is idempotent - it returns
      the same BlockDriverState unless it was hot-unplugged.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NWenchao Xia <xiawenc@linux.vnet.ibm.com>
      Signed-off-by: NWenchao Xia <xiawenc@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      29d78271
    • F
      block: add block driver read only whitelist · b64ec4e4
      Fam Zheng 提交于
      We may want to include a driver in the whitelist for read only tasks
      such as diagnosing or exporting guest data (with libguestfs as a good
      example). This patch introduces a readonly whitelist option, and for
      backward compatibility, the old configure option --block-drv-whitelist
      is now an alias to rw whitelist.
      
      Drivers in readonly list is only permitted to open file readonly, and
      returns -ENOTSUP for RW opening.
      
      E.g. To include vmdk readonly, and others read+write:
          ./configure --target-list=x86_64-softmmu \
                      --block-drv-rw-whitelist=qcow2,raw,file,qed \
                      --block-drv-ro-whitelist=vmdk
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      b64ec4e4
  5. 03 6月, 2013 4 次提交
  6. 02 6月, 2013 4 次提交
  7. 01 6月, 2013 1 次提交
  8. 31 5月, 2013 1 次提交
  9. 30 5月, 2013 1 次提交
    • M
      qapi: pad GenericList value fields to 64 bits · a678e26c
      Michael Roth 提交于
      With the introduction of native list types, we now have types such as
      int64List where the 'value' field is not a pointer, but the actual
      64-bit value.
      
      On 32-bit architectures, this can lead to situations where 'next' field
      offset in GenericList does not correspond to the 'next' field in the
      types that we cast to GenericList when using the visit_next_list()
      interface, causing issues when we attempt to traverse linked list
      structures of these types.
      
      To fix this, pad the 'value' field of GenericList and other
      schema-defined/native *List types out to 64-bits.
      
      This is less memory-efficient for 32-bit architectures, but allows us to
      continue to rely on list-handling interfaces that target GenericList to
      simply visitor implementations.
      
      In the future we can improve efficiency by defaulting to using native C
      array backends to handle list of non-pointer types, which would be more
      memory efficient in itself and allow us to roll back this change.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      a678e26c
  10. 29 5月, 2013 10 次提交
  11. 25 5月, 2013 6 次提交