1. 08 6月, 2017 14 次提交
    • P
      docs: create config/, devel/ and spin/ subdirectories · ac06724a
      Paolo Bonzini 提交于
      Developer documentation should be its own manual.  As a start, move all
      developer-oriented files to a separate directory.
      
      Also move non-text files to their own directories: docs/config/ for
      QEMU -readconfig input, and docs/spin/ for formal models to be used
      with the SPIN model checker.
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ac06724a
    • F
      cpus: reset throttle_thread_scheduled after sleep · 90bb0c04
      Felipe Franciosi 提交于
      Currently, the throttle_thread_scheduled flag is reset back to 0 before
      sleeping (as part of the throttling logic). Given that throttle_timer
      (well, any timer) may tick with a slight delay, it so happens that under
      heavy throttling (ie. close or on CPU_THROTTLE_PCT_MAX) the tick may
      schedule a further cpu_throttle_thread() work item after the flag reset,
      but before the previous sleep completed. This results on the vCPU thread
      sleeping continuously for potentially several seconds in a row.
      
      The chances of that happening can be drastically minimised by resetting
      the flag after the sleep.
      Signed-off-by: NFelipe Franciosi <felipe@nutanix.com>
      Signed-off-by: NMalcolm Crossley <malcolm@nutanix.com>
      Message-Id: <1495229390-18909-1-git-send-email-felipe@nutanix.com>
      Acked-by: NJason J. Herne <jjherne@linux.vnet.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      90bb0c04
    • G
      kvm: don't register smram_listener when smm is off · d870cfde
      Gonglei 提交于
      If the user set disable smm by '-machine smm=off', we
      should not register smram_listener so that we can
      avoid waster memory in kvm since the added sencond
      address space.
      
      Meanwhile we should assign value of the global kvm_state
      before invoking the kvm_arch_init(), because
      pc_machine_is_smm_enabled() may use it by kvm_has_mm().
      Signed-off-by: NGonglei <arei.gonglei@huawei.com>
      Message-Id: <1496316915-121196-1-git-send-email-arei.gonglei@huawei.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d870cfde
    • P
      nbd: make it thread-safe, fix qcow2 over nbd · 6bdcc018
      Paolo Bonzini 提交于
      NBD is not thread safe, because it accesses s->in_flight without
      a CoMutex.  Fixing this will be required for multiqueue.
      CoQueue doesn't have spurious wakeups but, when another coroutine can
      run between qemu_co_queue_next's wakeup and qemu_co_queue_wait's
      re-locking of the mutex, the wait condition can become false and
      a loop is necessary.
      
      In fact, it turns out that the loop is necessary even without this
      multi-threaded scenario.  A particular sequence of coroutine wakeups
      is happening ~80% of the time when starting a guest with qcow2 image
      served over NBD (i.e. qemu-nbd --format=raw, and QEMU's -drive option
      has -format=qcow2).  This patch fixes that issue too.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      6bdcc018
    • A
      target/i386: Add GDB XML description for SSE registers · b8158192
      Abdallah Bouassida 提交于
      Add an XML description for SSE registers (XMM+MXCSR) for both X86
      and X86-64 architectures in the GDB stub:
      - configure: Define gdb_xml_files for the X86 targets (32 and 64bit).
      - gdb-xml/i386-32bit-sse.xml & gdb-xml/i386-64bit-sse.xml: The XML files
      that contain a description of the XMM + MXCSR registers.
      - gdb-xml/i386-32bit.xml & gdb-xml/i386-64bit.xml: wrappers that include
      the XML file of the core registers and the other XML file of the SSE registers.
      - target/i386/cpu.c: Modify the gdb_core_xml_file to the new XML wrapper,
        modify the gdb_num_core_regs to fit the registers number defined in each
        XML file.
      Signed-off-by: NAbdallah Bouassida <abdallah.bouassida@lauterbach.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b8158192
    • R
      i386/kvm: do not zero out segment flags if segment is unusable or not present · d45fc087
      Roman Pen 提交于
      This is a fix for the problem [1], where VMCB.CPL was set to 0 and interrupt
      was taken on userspace stack.  The root cause lies in the specific AMD CPU
      behaviour which manifests itself as unusable segment attributes on SYSRET[2].
      
      Here in this patch flags are not touched even segment is unusable or is not
      present, therefore CPL (which is stored in DPL field) should not be lost and
      will be successfully restored on kvm/svm kernel side.
      
      Also current patch should not break desired behavior described in this commit:
      
      4cae9c97 ("target-i386: kvm: clear unusable segments' flags in migration")
      
      since present bit will be dropped if segment is unusable or is not present.
      
      This is the second part of the whole fix of the corresponding problem [1],
      first part is related to kvm/svm kernel side and does exactly the same:
      segment attributes are not zeroed out.
      
      [1] Message id: CAJrWOzD6Xq==b-zYCDdFLgSRMPM-NkNuTSDFEtX=7MreT45i7Q@mail.gmail.com
      [2] Message id: 5d120f358612d73fc909f5bfa47e7bd082db0af0.1429841474.git.luto@kernel.org
      Signed-off-by: NRoman Pen <roman.penyaev@profitbricks.com>
      Signed-off-by: NMikhail Sennikovskii <mikhail.sennikovskii@profitbricks.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Radim Krčmář <rkrcmar@redhat.com>
      Cc: Michael Chapman <mike@very.puzzling.org>
      Cc: qemu-devel@nongnu.org
      Message-Id: <20170601085604.12980-1-roman.penyaev@profitbricks.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      d45fc087
    • P
      edu: fix memory leak on msi_broken platforms · c25a67f0
      Paolo Bonzini 提交于
      If msi_init fails, the thread has already been created and the
      mutex/condvar are not destroyed.  Initialize everything only
      after the point where pci_edu_realize cannot fail.
      Reported-by: NMarkus Armbruster <armbru@redhat.com>
      Cc: Peter Xu <peterx@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c25a67f0
    • P
      linuxboot_dma: compile for i486 · 7e018385
      Paolo Bonzini 提交于
      The ROM uses the cmovne instruction, which is new in Pentium Pro and does not
      work when running QEMU with "-cpu 486".  Avoid producing that instruction.
      Suggested-by: NRichard W.M. Jones <rjones@redhat.com>
      Suggested-by: NThomas Huth <thuth@redhat.com>
      Reported-by: NRob Landley <rob@landley.net>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      7e018385
    • D
      kvmclock: update system_time_msr address forcibly · e2b6c171
      Denis Plotnikov 提交于
      Do an update of system_time_msr address every time before reading
      the value of tsc_timestamp from guest's kvmclock page.
      
      There is no other code paths which ensure that qemu has an up-to-date
      value of system_time_msr. So, force this update on guest's tsc_timestamp
      reading.
      
      This bug causes effect on those nested setups which turn off TPR access
      interception for L2 guests and that access being intercepted by L0 doesn't
      show up in L1.
      Linux bootstrap initiate kvmclock before APIC initializing causing TPR access.
      That's why on L1 guests, having TPR interception turned on for L2, the effect
      of the bug is not revealed.
      
      This patch fixes this problem by making sure it knows the correct
      system_time_msr address every time it is needed.
      Signed-off-by: NDenis Plotnikov <dplotnikov@virtuozzo.com>
      Message-Id: <1496054944-25623-1-git-send-email-dplotnikov@virtuozzo.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e2b6c171
    • E
      nbd: Fully initialize client in case of failed negotiation · df8ad9f1
      Eric Blake 提交于
      If a non-NBD client connects to qemu-nbd, we would end up with
      a SIGSEGV in nbd_client_put() because we were trying to
      unregister the client's association to the export, even though
      we skipped inserting the client into that list.  Easy trigger
      in two terminals:
      
      $ qemu-nbd -p 30001 --format=raw file
      $ nmap 127.0.0.1 -p 30001
      
      nmap claims that it thinks it connected to a pago-services1
      server (which probably means nmap could be updated to learn the
      NBD protocol and give a more accurate diagnosis of the open
      port - but that's not our problem), then terminates immediately,
      so our call to nbd_negotiate() fails.  The fix is to reorder
      nbd_co_client_start() to ensure that all initialization occurs
      before we ever try talking to a client in nbd_negotiate(), so
      that the teardown sequence on negotiation failure doesn't fault
      while dereferencing a half-initialized object.
      
      While debugging this, I also noticed that nbd_update_server_watch()
      called by nbd_client_closed() was still adding a channel to accept
      the next client, even when the state was no longer RUNNING.  That
      is fixed by making nbd_can_accept() pay attention to the current
      state.
      
      Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1451614Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-Id: <20170527030421.28366-1-eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      df8ad9f1
    • D
      sockets: improve error reporting if UNIX socket path is too long · ad9579aa
      Daniel P. Berrange 提交于
      The 'struct sockaddr_un' only allows 108 bytes for the socket
      path.
      
      If the user supplies a path, QEMU uses snprintf() to silently
      truncate it when too long. This is undesirable because the user
      will then be unable to connect to the path they asked for.
      
      If the user doesn't supply a path, QEMU builds one based on
      TMPDIR, but if that leads to an overlong path, it mistakenly
      uses error_setg_errno() with a stale errno value, because
      snprintf() does not set errno on truncation.
      
      In solving this the code needed some refactoring to ensure we
      don't pass 'un.sun_path' directly to any APIs which expect
      NUL-terminated strings, because the path is not required to
      be terminated.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Message-Id: <20170525155300.22743-1-berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      ad9579aa
    • M
      i386: fix read/write cr with icount option · 5b003a40
      Mihail Abakumov 提交于
      Running Windows with icount causes a crash in instruction of write cr.
      This patch fixes it.
      
      Reading and writing cr cause an icount read because there are called
      cpu_get_apic_tpr and cpu_set_apic_tpr functions. So, there is need
      gen_io_start()/gen_io_end() calls.
      Signed-off-by: NMihail Abakumov <mikhail.abakumov@ispras.ru>
      Message-Id: <ffb376034ff184f2fcbe93d5317d9e76@ispras.ru>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      5b003a40
    • P
      target/i386: use multiple CPU AddressSpaces · f8c45c65
      Paolo Bonzini 提交于
      This speeds up SMM switches.  Later on it may remove the need to take
      the BQL, and it may also allow to reuse code between TCG and KVM.
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      f8c45c65
    • P
      target/i386: enable A20 automatically in system management mode · c8bc83a4
      Paolo Bonzini 提交于
      Ignore env->a20_mask when running in system management mode.
      Reported-by: NAnthony Xu <anthony.xu@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <1494502528-12670-1-git-send-email-pbonzini@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      c8bc83a4
  2. 07 6月, 2017 18 次提交
  3. 06 6月, 2017 8 次提交
    • P
      Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2017-06-06' into staging · 572db7cd
      Peter Maydell 提交于
      Miscellaneous patches for 2017-06-06
      
      # gpg: Signature made Tue 06 Jun 2017 08:30:43 BST
      # gpg:                using RSA key 0x3870B400EB918653
      # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
      # gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"
      # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653
      
      * remotes/armbru/tags/pull-misc-2017-06-06:
        monitor: fix object_del for command-line-created objects
        tests: check-qom-proplist: add checks for cmdline-created objects
        virtio-scsi-test: Use scsi-hd instead of legacy scsi-disk
        block: Clarify documentation of BlockInfo member io-status
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      572db7cd
    • P
      Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.10-20170606' into staging · e02bbe19
      Peter Maydell 提交于
      ppc patch queue 2017-06-06
      
      Accumulated patches for ppc targets and the pseries machine type.
      
      The big thing in this batch is a start on a substantial cleanup of the
      pseries hotplug mechanisms, which were pretty confusing.  For now
      these shouldn't cause substantial behavioural changes, but I am hoping
      these lead to clearer code and eventually to fixes for the bugs we
      have in hotplug handling, particularly when hotplug and migration are
      combined.
      
      The remaining patches are mostly bugfixes.
      
      # gpg: Signature made Tue 06 Jun 2017 03:48:50 BST
      # gpg:                using RSA key 0x6C38CACA20D9B392
      # gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
      # gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
      # gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
      # gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
      # Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392
      
      * remotes/dgibson/tags/ppc-for-2.10-20170606:
        spapr: Remove some non-useful properties on DRC objects
        spapr: Eliminate spapr_drc_get_type_str()
        spapr: Move configure-connector state into DRC
        spapr: Clean up spapr_dr_connector_by_*()
        spapr: Introduce DRC subclasses
        spapr/drc: don't migrate DRC of cold-plugged CPUs and LMBs
        spapr: Allow boot from vhost-*-scsi backends
        ppc/pnv: check the return value of fdt_setprop()
        spapr_nvram: Check return value from blk_getlength()
        target/ppc: Fixup set_spr error in h_register_process_table
        target-ppc: Fix openpic timer read register offset
        spapr: Make DRC get_index and get_type methods into plain functions
        spapr: Abolish DRC set_configured method
        spapr: Abolish DRC get_fdt method
        spapr: Move DRC RTAS calls into spapr_drc.c
        migration: Mark CPU states dirty before incoming migration/loadvm
        migration: remove register_savevm()
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      e02bbe19
    • M
      target/xtensa: handle unknown registers in gdbstub · dd7b952b
      Max Filippov 提交于
      Xtensa cores may have registers of types/sizes not supported by the
      gdbstub accessors. Ignore writes to such registers and return zero on
      read, but always return correct register size, so that gdb on the other
      side is able to access all registers in the packet holding unsupported
      registers in the middle. This fixes gdb interaction with cores that have
      vector/custom TIE registers.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      dd7b952b
    • M
      target/xtensa: support output to chardev console · 8128b3e0
      Max Filippov 提交于
      In semihosting mode QEMU allows guest to read and write host file
      descriptors directly, including descriptors 0..2, a.k.a. stdin, stdout
      and stderr. Sometimes it's desirable to have semihosting console
      controlled by -serial option, e.g. to connect it to network.
      
      Add semihosting console to xtensa-semi.c, open it in the 'sim' machine
      in the presence of -serial option and direct stdout and stderr to it
      when it's present.
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      8128b3e0
    • M
      target/xtensa: fix return value of read/write simcalls · 347ec030
      Max Filippov 提交于
      Return value of read/write simcalls is not calculated correctly in case
      of operations crossing page boundary and in case of short reads/writes.
      Read and write simcalls should return the size of data actually
      read/written or -1 in case of error.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      347ec030
    • M
      target/xtensa: fix mapping direction in read/write simcalls · 30c2afd1
      Max Filippov 提交于
      Read and write simcalls map physical memory to access I/O buffers, but
      'read' simcall need to map it for writing and 'write' simcall need to
      map it for reading, i.e. the opposite of what they do now. Fix that.
      
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMax Filippov <jcmvbkbc@gmail.com>
      30c2afd1
    • P
      Merge remote-tracking branch 'remotes/ehabkost/tags/x86-and-machine-pull-request' into staging · a65afaae
      Peter Maydell 提交于
      x86 and machine queue, 2017-06-05
      
      # gpg: Signature made Mon 05 Jun 2017 19:58:01 BST
      # gpg:                using RSA key 0x2807936F984DC5A6
      # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>"
      # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6
      
      * remotes/ehabkost/tags/x86-and-machine-pull-request:
        scripts: Test script to look for -device crashes
        qemu.py: Add QEMUMachine.exitcode() method
        qemu.py: Don't set _popen=None on error/shutdown
        spapr: cleanup spapr_fixup_cpu_numa_dt() usage
        numa: move numa_node from CPUState into target specific classes
        numa: make hmp 'info numa' fetch numa nodes from qmp_query_cpus() result
        numa: make sure that all cpus have has_node_id set if numa is enabled
        numa: move default mapping init to machine
        numa: consolidate cpu_preplug fixups/checks for pc/arm/spapr
        pc: Use "min-[x]level" on compat_props
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      a65afaae
    • M
      monitor: fix object_del for command-line-created objects · c645d5ac
      Michael Roth 提交于
      Currently objects specified on the command-line are only partially
      cleaned up when 'object_del' is issued in either HMP or QMP: the
      object itself is fully finalized, but the QemuOpts are not removed.
      This results in the following behavior:
      
        x86_64-softmmu/qemu-system-x86_64 -monitor stdio \
          -object memory-backend-ram,id=ram1,size=256M
      
        QEMU 2.7.91 monitor - type 'help' for more information
        (qemu) object_del ram1
        (qemu) object_del ram1
        object 'ram1' not found
        (qemu) object_add memory-backend-ram,id=ram1,size=256M
        Duplicate ID 'ram1' for object
        Try "help object_add" for more information
      
      which can be an issue for use-cases like memory hotplug.
      
      This happens on the HMP side because hmp_object_add() attempts to
      create a temporary QemuOpts entry with ID 'ram1', which ends up
      conflicting with the command-line-created entry, since it was never
      cleaned up during the previous hmp_object_del() call.
      
      We address this by adding a check in user_creatable_del(), which
      is called by both qmp_object_del() and hmp_object_del() to handle
      the actual object cleanup, to determine whether an option group entry
      matching the object's ID is present and removing it if it is.
      
      Note that qmp_object_add() never attempts to create a temporary
      QemuOpts entry, so it does not encounter the duplicate ID error,
      which is why this isn't generally visible in libvirt.
      
      Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Markus Armbruster <armbru@redhat.com>
      Cc: Eric Blake <eblake@redhat.com>
      Cc: Daniel Berrange <berrange@redhat.com>
      Cc: qemu-stable@nongnu.org
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
      Message-Id: <1496531612-22166-3-git-send-email-mdroth@linux.vnet.ibm.com>
      Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
      c645d5ac