1. 10 3月, 2015 11 次提交
    • B
      x86: fix SS selector in SYSRET · ac576229
      Bill Paul 提交于
      According to my reading of the Intel documentation, the SYSRET instruction
      is supposed to force the RPL bits of the %ss register to 3 when returning
      to user mode. The actual sequence is:
      
      SS.Selector <-- (IA32_STAR[63:48]+8) OR 3; (* RPL forced to 3 *)
      
      However, the code in helper_sysret() leaves them at 0 (in other words, the "OR
      3" part of the above sequence is missing). It does set the privilege level
      bits of %cs correctly though.
      
      This has caused me trouble with some of my VxWorks development: code that runs
      okay on real hardware will crash on QEMU, unless I apply the patch below.
      Signed-off-by: NBill Paul <wpaul@windriver.com>
      Message-Id: <201503091548.01462.wpaul@windriver.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ac576229
    • M
      scsi: Convert remaining PCI HBAs to realize() · ae071cc8
      Markus Armbruster 提交于
      These are "am53c974", "dc390", "lsi53c895a", "lsi53c810", "megasas",
      "megasas-gen2".
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      Message-Id: <1425925048-15482-5-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ae071cc8
    • M
      scsi: Improve error reporting for invalid drive property · 390e90a9
      Markus Armbruster 提交于
      When setting "realized" fails, scsi_bus_legacy_add_drive() passes the
      error to qerror_report_err(), then returns an unspecific "Setting
      drive property failed" error, which is reported further up the call
      chain.
      
      Example:
      
          $ qemu-system-x86_64 -nodefaults -S -display none \
          > -drive if=scsi,id=foo,file=tmp.qcow2 -global isa-fdc.driveA=foo
          qemu-system-x86_64: -drive if=scsi,id=foo,file=tmp.qcow2: Property 'scsi-disk.drive' can't take value 'foo', it's in use
          qemu-system-x86_64: Setting drive property failed
          qemu-system-x86_64: Initialization of device lsi53c895a failed: Device initialization failed
      
      Clean up the obvious way: simply return the original error to the
      caller.  Gets rid of the second message in the above error cascade.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      Message-Id: <1425925048-15482-4-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      390e90a9
    • M
      hw: Propagate errors through qdev_prop_set_drive() · 9b3d111a
      Markus Armbruster 提交于
      Three kinds of callers:
      
      1. On failure, report the error and abort
      
         Passing &error_abort does the job.  No functional change.
      
      2. On failure, report the error and exit()
      
         This is qdev_prop_set_drive_nofail().  Error reporting moves from
         qdev_prop_set_drive() to its caller.  Because hiding away the error
         in the monitor right before exit() isn't helpful, replace
         qerror_report_err() by error_report_err().  Shouldn't make a
         difference, because qdev_prop_set_drive_nofail() should never be
         used in QMP context.
      
      3. On failure, report the error and recover
      
         This is usb_msd_init() and scsi_bus_legacy_add_drive().  Error
         reporting and freeing the error object moves from
         qdev_prop_set_drive() to its callers.
      
         Because usb_msd_init() can't run in QMP context, replace
         qerror_report_err() by error_report_err() there.
      
         No functional change.
      
         scsi_bus_legacy_add_drive() calling qerror_report_err() is of
         course inappropriate, but this commit merely makes it more obvious.
         The next one will clean it up.
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      Message-Id: <1425925048-15482-3-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9b3d111a
    • M
      scsi: Clean up duplicated error in legacy if=scsi code · fa617181
      Markus Armbruster 提交于
      Commit a818a4b6 changed scsi_bus_legacy_handle_cmdline() to report
      errors from scsi_bus_legacy_add_drive() with error_report() in
      addition to returning them.  That's inappropriate.
      
      Two kinds of callers:
      
      1. realize methods (devices "esp", "virtio-scsi-device" and
         "spapr-vscsi")
      
         The error object gets passed up the call chain until it gets
         reported again and freed.
      
         Example:
      
         $ qemu-system-arm -M virt -S -display none \
         > -drive if=scsi,id=foo,bus=1,file=tmp.qcow2 \
         > -device nec-usb-xhci -device usb-storage,drive=foo \
         > -device virtio-scsi-pci
         qemu-system-arm: -drive if=scsi,id=foo,bus=1,file=tmp.qcow2: Property 'scsi-disk.drive' can't take value 'foo', it's in use
         qemu-system-arm: -drive if=scsi,id=foo,bus=1,file=tmp.qcow2: Setting drive property failed
         qemu-system-arm: -device virtio-scsi-pci: Setting drive property failed
         qemu-system-arm: -device virtio-scsi-pci: Device initialization failed
         qemu-system-arm: -device virtio-scsi-pci: Device 'virtio-scsi-pci' could not be initialized
      
         The second message in this error cascade comes from
         scsi_bus_legacy_handle_cmdline().  The error object then gets
         passed up to the qdev_init() called from
         virtio_scsi_pci_init_pci(), which reports it again.
      
      2. init methods (devices "am53c974", "dc390", "lsi53c895a",
         "lsi53c810", "megasas", "megasas-gen2")
      
         init methods need to report their errors with qerror_report().
         These don't.  The inappropriate error_report() papers over the bug.
      
         error_report() isn't the same as qerror_report() in QMP context,
         but this can't actually happen: QMP can still only hot-plug, and
         callers call scsi_bus_legacy_handle_cmdline() only on cold-plug.
         Except for sysbus_esp_realize(), but that can't be hot-plugged at
         all, as far as I can tell.
      
      Fix the init methods and drop the inappropriate error_report() in
      scsi_bus_legacy_handle_cmdline().
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
      Message-Id: <1425925048-15482-2-git-send-email-armbru@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      fa617181
    • P
      cpus: initialize cpu->memory_dispatch · cba70549
      Paolo Bonzini 提交于
      This fixes a NULL pointer dereference in s390x-softmmu.
      
      On pretty much all other architectures, creating an MMIO region calls
      cpu_reload_memory_map.  On s390, however, there are no MMIO regions
      and everything is done via hypercalls.
      
      Fixes: 9d82b5a7Reported-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      cba70549
    • P
      rcu: handle forks safely · 21b7cf9e
      Paolo Bonzini 提交于
      After forking, only the calling thread is duplicated in the child process.
      The call_rcu thread has to be recreated in the child.  Exploit the fact
      that only one thread exists (same as when constructors run), and just redo
      the entire initialization to ensure the threads are in the proper state.
      
      The only additional things to do are emptying the list of threads
      registered with RCU, and unlocking the lock that was taken in the prepare
      callback (implementations are allowed to fail pthread_mutex_init()
      if the mutex is still locked).
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      21b7cf9e
    • P
      qemu-thread: do not use PTHREAD_MUTEX_ERRORCHECK · 24fa9049
      Paolo Bonzini 提交于
      PTHREAD_MUTEX_ERRORCHECK is completely broken with respect to fork.
      The way to safely do fork is to bring all threads to a quiescent
      state by acquiring locks (either in callers---as we do for the
      iothread mutex---or using pthread_atfork's prepare callbacks)
      and then release them in the child.
      
      The problem is that releasing error-checking locks in the child
      fails under glibc with EPERM, because the mutex stores a different
      owner tid than the duplicated thread in the child process.  We
      could make it work for locks acquired via pthread_atfork, by
      recreating the mutex in the child instead of unlocking it
      (we know that there are no other threads that could have taken
      the mutex; but when the lock is acquired in fork's caller
      that would not be possible.
      
      The simplest solution is just to forgo error checking.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      24fa9049
    • S
      kvm_stat: add kvm_stat.1 man page · 811c5727
      Stefan Hajnoczi 提交于
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NAdemar Reis <areis@redhat.com>
      Reviewed-by: NWei Huang <wei@redhat.com>
      Message-Id: <1425338947-10296-3-git-send-email-stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      811c5727
    • S
      kvm_stat: add column headers to text UI · 9a7dcb71
      Stefan Hajnoczi 提交于
      The curses user interface shows both the accumulated total and the
      current event counts.  Add column headers so it's clear what the numbers
      mean.
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: NAdemar Reis <areis@redhat.com>
      Reviewed-by: NWei Huang <wei@redhat.com>
      Message-Id: <1425338947-10296-2-git-send-email-stefanha@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      9a7dcb71
    • S
      iscsi: Fix check for username · 532cee41
      Stefan Weil 提交于
      The variable user in struct iscsi_url is a character array, not a pointer.
      Therefore its address will never be NULL.
      
      clang reports this error:
      
      block/iscsi.c:1329:20: warning:
       comparison of array 'iscsi_url->user' not equal to a null pointer
       is always true [-Wtautological-pointer-compare]
      Reviewed-by: NPeter Lieven <pl@kamp.de>
      Acked-by: NPeter Lieven <pl@kamp.de>
      Signed-off-by: NStefan Weil <sw@weilnetz.de>
      Message-Id: <1425719670-5486-1-git-send-email-sw@weilnetz.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      532cee41
  2. 09 3月, 2015 29 次提交