1. 16 5月, 2014 12 次提交
  2. 13 5月, 2014 1 次提交
  3. 08 5月, 2014 2 次提交
    • G
      kvm: x86: emulate monitor and mwait instructions as nop · 87c00572
      Gabriel L. Somlo 提交于
      Treat monitor and mwait instructions as nop, which is architecturally
      correct (but inefficient) behavior. We do this to prevent misbehaving
      guests (e.g. OS X <= 10.7) from crashing after they fail to check for
      monitor/mwait availability via cpuid.
      
      Since mwait-based idle loops relying on these nop-emulated instructions
      would keep the host CPU pegged at 100%, do NOT advertise their presence
      via cpuid, to prevent compliant guests from using them inadvertently.
      Signed-off-by: NGabriel L. Somlo <somlo@cmu.edu>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      87c00572
    • M
      kvm/x86: implement hv EOI assist · b63cf42f
      Michael S. Tsirkin 提交于
      It seems that it's easy to implement the EOI assist
      on top of the PV EOI feature: simply convert the
      page address to the format expected by PV EOI.
      
      Notes:
      -"No EOI required" is set only if interrupt injected
       is edge triggered; this is true because level interrupts are going
       through IOAPIC which disables PV EOI.
       In any case, if guest triggers EOI the bit will get cleared on exit.
      -For migration, set of HV_X64_MSR_APIC_ASSIST_PAGE sets
       KVM_PV_EOI_EN internally, so restoring HV_X64_MSR_APIC_ASSIST_PAGE
       seems sufficient
       In any case, bit is cleared on exit so worst case it's never re-enabled
      -no handling of PV EOI data is performed at HV_X64_MSR_EOI write;
       HV_X64_MSR_EOI is a separate optimization - it's an X2APIC
       replacement that lets you do EOI with an MSR and not IO.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b63cf42f
  4. 07 5月, 2014 6 次提交
  5. 06 5月, 2014 5 次提交
  6. 05 5月, 2014 1 次提交
    • C
      kvm/irqchip: Speed up KVM_SET_GSI_ROUTING · 719d93cd
      Christian Borntraeger 提交于
      When starting lots of dataplane devices the bootup takes very long on
      Christian's s390 with irqfd patches. With larger setups he is even
      able to trigger some timeouts in some components.  Turns out that the
      KVM_SET_GSI_ROUTING ioctl takes very long (strace claims up to 0.1 sec)
      when having multiple CPUs.  This is caused by the  synchronize_rcu and
      the HZ=100 of s390.  By changing the code to use a private srcu we can
      speed things up.  This patch reduces the boot time till mounting root
      from 8 to 2 seconds on my s390 guest with 100 disks.
      
      Uses of hlist_for_each_entry_rcu, hlist_add_head_rcu, hlist_del_init_rcu
      are fine because they do not have lockdep checks (hlist_for_each_entry_rcu
      uses rcu_dereference_raw rather than rcu_dereference, and write-sides
      do not do rcu lockdep at all).
      
      Note that we're hardly relying on the "sleepable" part of srcu.  We just
      want SRCU's faster detection of grace periods.
      
      Testing was done by Andrew Theurer using netperf tests STREAM, MAERTS
      and RR.  The difference between results "before" and "after" the patch
      has mean -0.2% and standard deviation 0.6%.  Using a paired t-test on the
      data points says that there is a 2.5% probability that the patch is the
      cause of the performance difference (rather than a random fluctuation).
      
      (Restricting the t-test to RR, which is the most likely to be affected,
      changes the numbers to respectively -0.3% mean, 0.7% stdev, and 8%
      probability that the numbers actually say something about the patch.
      The probability increases mostly because there are fewer data points).
      
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> # s390
      Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      719d93cd
  7. 30 4月, 2014 1 次提交
    • P
      Merge tag 'kvm-s390-20140429' of... · 57b5981c
      Paolo Bonzini 提交于
      Merge tag 'kvm-s390-20140429' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into kvm-next
      
      1. Guest handling fixes
      The handling of MVPG, PFMF and Test Block is fixed to better follow
      the architecture. None of these fixes is critical for any current
      Linux guests, but let's play safe.
      
      2. Optimization for single CPU guests
      We can enable the IBS facility if only one VCPU is running (!STOPPED
      state). We also enable this optimization for guest > 1 VCPU as soon
      as all but one VCPU is in stopped state. Thus will help guests that
      have tools like cpuplugd (from s390-utils) that do dynamic offline/
      online of CPUs.
      
      3. NOTES
      There is one non-s390 change in include/linux/kvm_host.h that
      introduces 2 defines for VCPU requests:
      define KVM_REQ_ENABLE_IBS        23
      define KVM_REQ_DISABLE_IBS       24
      57b5981c
  8. 29 4月, 2014 7 次提交
  9. 28 4月, 2014 2 次提交
  10. 24 4月, 2014 3 次提交
    • X
      KVM: MMU: flush tlb out of mmu lock when write-protect the sptes · 198c74f4
      Xiao Guangrong 提交于
      Now we can flush all the TLBs out of the mmu lock without TLB corruption when
      write-proect the sptes, it is because:
      - we have marked large sptes readonly instead of dropping them that means we
        just change the spte from writable to readonly so that we only need to care
        the case of changing spte from present to present (changing the spte from
        present to nonpresent will flush all the TLBs immediately), in other words,
        the only case we need to care is mmu_spte_update()
      
      - in mmu_spte_update(), we haved checked
        SPTE_HOST_WRITEABLE | PTE_MMU_WRITEABLE instead of PT_WRITABLE_MASK, that
        means it does not depend on PT_WRITABLE_MASK anymore
      Acked-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      198c74f4
    • X
      KVM: MMU: flush tlb if the spte can be locklessly modified · 7f31c959
      Xiao Guangrong 提交于
      Relax the tlb flush condition since we will write-protect the spte out of mmu
      lock. Note lockless write-protection only marks the writable spte to readonly
      and the spte can be writable only if both SPTE_HOST_WRITEABLE and
      SPTE_MMU_WRITEABLE are set (that are tested by spte_is_locklessly_modifiable)
      
      This patch is used to avoid this kind of race:
      
            VCPU 0                         VCPU 1
      lockless wirte protection:
            set spte.w = 0
                                       lock mmu-lock
      
                                       write protection the spte to sync shadow page,
                                       see spte.w = 0, then without flush tlb
      
      				 unlock mmu-lock
      
                                       !!! At this point, the shadow page can still be
                                           writable due to the corrupt tlb entry
           Flush all TLB
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      7f31c959
    • X
      KVM: MMU: lazily drop large spte · c126d94f
      Xiao Guangrong 提交于
      Currently, kvm zaps the large spte if write-protected is needed, the later
      read can fault on that spte. Actually, we can make the large spte readonly
      instead of making them un-present, the page fault caused by read access can
      be avoided
      
      The idea is from Avi:
      | As I mentioned before, write-protecting a large spte is a good idea,
      | since it moves some work from protect-time to fault-time, so it reduces
      | jitter.  This removes the need for the return value.
      
      This version has fixed the issue reported in 6b73a960, the reason of that
      issue is that fast_page_fault() directly sets the readonly large spte to
      writable but only dirty the first page into the dirty-bitmap that means
      other pages are missed. Fixed it by only the normal sptes (on the
      PT_PAGE_TABLE_LEVEL level) can be fast fixed
      Reviewed-by: NMarcelo Tosatti <mtosatti@redhat.com>
      Signed-off-by: NXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
      c126d94f