1. 26 1月, 2018 2 次提交
    • M
      KVM: s390: exploit GISA and AIV for emulated interrupts · d7c5cb01
      Michael Mueller 提交于
      The adapter interruption virtualization (AIV) facility is an
      optional facility that comes with functionality expected to increase
      the performance of adapter interrupt handling for both emulated and
      passed-through adapter interrupts. With AIV, adapter interrupts can be
      delivered to the guest without exiting SIE.
      
      This patch provides some preparations for using AIV for emulated adapter
      interrupts (including virtio) if it's available. When using AIV, the
      interrupts are delivered at the so called GISA by setting the bit
      corresponding to its Interruption Subclass (ISC) in the Interruption
      Pending Mask (IPM) instead of inserting a node into the floating interrupt
      list.
      
      To keep the change reasonably small, the handling of this new state is
      deferred in get_all_floating_irqs and handle_tpi. This patch concentrates
      on the code handling enqueuement of emulated adapter interrupts, and their
      delivery to the guest.
      
      Note that care is still required for adapter interrupts using AIV,
      because there is no guarantee that AIV is going to deliver the adapter
      interrupts pending at the GISA (consider all vcpus idle). When delivering
      GISA adapter interrupts by the host (usual mechanism) special attention
      is required to honor interrupt priorities.
      
      Empirical results show that the time window between making an interrupt
      pending at the GISA and doing kvm_s390_deliver_pending_interrupts is
      sufficient for a guest with at least moderate cpu activity to get adapter
      interrupts delivered within the SIE, and potentially save some SIE exits
      (if not other deliverable interrupts).
      
      The code will be activated with a follow-up patch.
      Signed-off-by: NMichael Mueller <mimu@linux.vnet.ibm.com>
      Acked-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      d7c5cb01
    • M
      KVM: s390: define GISA format-0 data structure · 19114beb
      Michael Mueller 提交于
      In preperation to support pass-through adapter interrupts, the Guest
      Interruption State Area (GISA) and the Adapter Interruption Virtualization
      (AIV) features will be introduced here.
      
      This patch introduces format-0 GISA (that is defines the struct describing
      the GISA, allocates storage for it, and introduces fields for the
      GISA address in kvm_s390_sie_block and kvm_s390_vsie).
      
      As the GISA requires storage below 2GB, it is put in sie_page2, which is
      already allocated in ZONE_DMA. In addition, The GISA requires alignment to
      its integral boundary. This is already naturally aligned via the
      padding in the sie_page2.
      Signed-off-by: NMichael Mueller <mimu@linux.vnet.ibm.com>
      Reviewed-by: NPierre Morel <pmorel@linux.vnet.ibm.com>
      Reviewed-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
      Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: NCornelia Huck <cohuck@redhat.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      19114beb
  2. 25 1月, 2018 3 次提交
  3. 24 1月, 2018 2 次提交
  4. 16 1月, 2018 3 次提交
  5. 06 12月, 2017 3 次提交
  6. 28 11月, 2017 1 次提交
    • J
      KVM: Let KVM_SET_SIGNAL_MASK work as advertised · 20b7035c
      Jan H. Schönherr 提交于
      KVM API says for the signal mask you set via KVM_SET_SIGNAL_MASK, that
      "any unblocked signal received [...] will cause KVM_RUN to return with
      -EINTR" and that "the signal will only be delivered if not blocked by
      the original signal mask".
      
      This, however, is only true, when the calling task has a signal handler
      registered for a signal. If not, signal evaluation is short-circuited for
      SIG_IGN and SIG_DFL, and the signal is either ignored without KVM_RUN
      returning or the whole process is terminated.
      
      Make KVM_SET_SIGNAL_MASK behave as advertised by utilizing logic similar
      to that in do_sigtimedwait() to avoid short-circuiting of signals.
      Signed-off-by: NJan H. Schönherr <jschoenh@amazon.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      20b7035c
  7. 09 11月, 2017 1 次提交
  8. 09 10月, 2017 1 次提交
  9. 28 9月, 2017 1 次提交
  10. 29 8月, 2017 3 次提交
  11. 08 8月, 2017 2 次提交
  12. 25 7月, 2017 1 次提交
    • C
      KVM: s390: take srcu lock when getting/setting storage keys · 4f899147
      Christian Borntraeger 提交于
      The following warning was triggered by missing srcu locks around
      the storage key handling functions.
      
      =============================
      WARNING: suspicious RCU usage
      4.12.0+ #56 Not tainted
      -----------------------------
      ./include/linux/kvm_host.h:572 suspicious rcu_dereference_check() usage!
      rcu_scheduler_active = 2, debug_locks = 1
       1 lock held by live_migration/4936:
        #0:  (&mm->mmap_sem){++++++}, at: [<0000000000141be0>]
      kvm_arch_vm_ioctl+0x6b8/0x22d0
      
       CPU: 8 PID: 4936 Comm: live_migration Not tainted 4.12.0+ #56
       Hardware name: IBM 2964 NC9 704 (LPAR)
       Call Trace:
       ([<000000000011378a>] show_stack+0xea/0xf0)
        [<000000000055cc4c>] dump_stack+0x94/0xd8
        [<000000000012ee70>] gfn_to_memslot+0x1a0/0x1b8
        [<0000000000130b76>] gfn_to_hva+0x2e/0x48
        [<0000000000141c3c>] kvm_arch_vm_ioctl+0x714/0x22d0
        [<000000000013306c>] kvm_vm_ioctl+0x11c/0x7b8
        [<000000000037e2c0>] do_vfs_ioctl+0xa8/0x6c8
        [<000000000037e984>] SyS_ioctl+0xa4/0xb8
        [<00000000008b20a4>] system_call+0xc4/0x27c
       1 lock held by live_migration/4936:
        #0:  (&mm->mmap_sem){++++++}, at: [<0000000000141be0>]
      kvm_arch_vm_ioctl+0x6b8/0x22d0
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: Pierre Morel<pmorel@linux.vnet.ibm.com>
      4f899147
  13. 28 6月, 2017 1 次提交
    • Q
      KVM: s390: Inject machine check into the guest · 4d62fcc0
      QingFeng Hao 提交于
      If the exit flag of SIE indicates that a machine check has happened
      during guest's running and needs to be injected, inject it to the guest
      accordingly.
      But some machine checks, e.g. Channel Report Pending (CRW), refer to
      host conditions only (the guest's channel devices are not managed by
      the kernel directly) and are therefore not injected into the guest.
      External Damage (ED) is also not reinjected into the guest because ETR
      conditions are gone in Linux and STP conditions are not enabled in the
      guest, and ED contains only these 8 ETR and STP conditions.
      In general, instruction-processing damage, system recovery,
      storage error, service-processor damage and channel subsystem damage
      will be reinjected into the guest, and the remain (System damage,
      timing-facility damage, warning, ED and CRW) will be handled on the host.
      Signed-off-by: NQingFeng Hao <haoqf@linux.vnet.ibm.com>
      Acked-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      4d62fcc0
  14. 27 6月, 2017 1 次提交
    • Q
      KVM: s390: Backup the guest's machine check info · da72ca4d
      QingFeng Hao 提交于
      When a machine check happens in the guest, related mcck info (mcic,
      external damage code, ...) is stored in the vcpu's lowcore on the host.
      Then the machine check handler's low-level part is executed, followed
      by the high-level part.
      
      If the high-level part's execution is interrupted by a new machine check
      happening on the same vcpu on the host, the mcck info in the lowcore is
      overwritten with the new machine check's data.
      
      If the high-level part's execution is scheduled to a different cpu,
      the mcck info in the lowcore is uncertain.
      
      Therefore, for both cases, the further reinjection to the guest will use
      the wrong data.
      Let's backup the mcck info in the lowcore to the sie page
      for further reinjection, so that the right data will be used.
      
      Add new member into struct sie_page to store related machine check's
      info of mcic, failing storage address and external damage code.
      Signed-off-by: NQingFeng Hao <haoqf@linux.vnet.ibm.com>
      Acked-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      da72ca4d
  15. 22 6月, 2017 2 次提交
  16. 04 6月, 2017 1 次提交
  17. 01 6月, 2017 1 次提交
  18. 09 5月, 2017 1 次提交
    • M
      treewide: use kv[mz]alloc* rather than opencoded variants · 752ade68
      Michal Hocko 提交于
      There are many code paths opencoding kvmalloc.  Let's use the helper
      instead.  The main difference to kvmalloc is that those users are
      usually not considering all the aspects of the memory allocator.  E.g.
      allocation requests <= 32kB (with 4kB pages) are basically never failing
      and invoke OOM killer to satisfy the allocation.  This sounds too
      disruptive for something that has a reasonable fallback - the vmalloc.
      On the other hand those requests might fallback to vmalloc even when the
      memory allocator would succeed after several more reclaim/compaction
      attempts previously.  There is no guarantee something like that happens
      though.
      
      This patch converts many of those places to kv[mz]alloc* helpers because
      they are more conservative.
      
      Link: http://lkml.kernel.org/r/20170306103327.2766-2-mhocko@kernel.orgSigned-off-by: NMichal Hocko <mhocko@suse.com>
      Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> # Xen bits
      Acked-by: NKees Cook <keescook@chromium.org>
      Acked-by: NVlastimil Babka <vbabka@suse.cz>
      Acked-by: Andreas Dilger <andreas.dilger@intel.com> # Lustre
      Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> # KVM/s390
      Acked-by: Dan Williams <dan.j.williams@intel.com> # nvdim
      Acked-by: David Sterba <dsterba@suse.com> # btrfs
      Acked-by: Ilya Dryomov <idryomov@gmail.com> # Ceph
      Acked-by: Tariq Toukan <tariqt@mellanox.com> # mlx4
      Acked-by: Leon Romanovsky <leonro@mellanox.com> # mlx5
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Anton Vorontsov <anton@enomsg.org>
      Cc: Colin Cross <ccross@android.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Kent Overstreet <kent.overstreet@gmail.com>
      Cc: Santosh Raspatur <santosh@chelsio.com>
      Cc: Hariprasad S <hariprasad@chelsio.com>
      Cc: Yishai Hadas <yishaih@mellanox.com>
      Cc: Oleg Drokin <oleg.drokin@intel.com>
      Cc: "Yan, Zheng" <zyan@redhat.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David Miller <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      752ade68
  19. 27 4月, 2017 1 次提交
  20. 26 4月, 2017 2 次提交
  21. 25 4月, 2017 1 次提交
  22. 21 4月, 2017 1 次提交
  23. 07 4月, 2017 1 次提交
  24. 06 4月, 2017 1 次提交
    • F
      KVM: s390: introduce ais mode modify function · 51978393
      Fei Li 提交于
      Provide an interface for userspace to modify AIS
      (adapter-interruption-suppression) mode state, and add documentation
      for the interface. Allowed target modes are ALL-Interruptions mode
      and SINGLE-Interruption mode.
      
      We introduce the 'simm' and 'nimm' fields in kvm_s390_float_interrupt
      to store interruption modes for each ISC. Each bit in 'simm' and
      'nimm' targets to one ISC, and collaboratively indicate three modes:
      ALL-Interruptions, SINGLE-Interruption and NO-Interruptions. This
      interface can initiate most transitions between the states; transition
      from SINGLE-Interruption to NO-Interruptions via adapter interrupt
      injection will be introduced in a following patch. The meaningful
      combinations are as follows:
      
          interruption mode | simm bit | nimm bit
          ------------------|----------|----------
                   ALL      |    0     |     0
                 SINGLE     |    1     |     0
                   NO       |    1     |     1
      
      Besides, add tracepoint to track AIS mode transitions.
      Co-Authored-By: NYi Min Zhao <zyimin@linux.vnet.ibm.com>
      Signed-off-by: NYi Min Zhao <zyimin@linux.vnet.ibm.com>
      Signed-off-by: NFei Li <sherrylf@linux.vnet.ibm.com>
      Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      51978393
  25. 23 3月, 2017 1 次提交
  26. 16 3月, 2017 2 次提交