1. 27 7月, 2008 1 次提交
  2. 07 5月, 2008 1 次提交
    • C
      [S390] s390-kvm: leave sie context on work. Removes preemption requirement · 0eaeafa1
      Christian Borntraeger 提交于
      From: Martin Schwidefsky <schwidefsky@de.ibm.com>
      
      This patch fixes a bug with cpu bound guest on kvm-s390. Sometimes it
      was impossible to deliver a signal to a spinning guest. We used
      preemption as a circumvention. The preemption notifiers called
      vcpu_load, which checked for pending signals and triggered a host
      intercept. But even with preemption, a sigkill was not delivered
      immediately.
      
      This patch changes the low level host interrupt handler to check for the
      SIE  instruction, if TIF_WORK is set. In that case we change the
      instruction pointer of the return PSW to rerun the vcpu_run loop. The kvm
      code sees an intercept reason 0 if that happens. This patch adds accounting
      for these types of intercept as well.
      
      The advantages:
      - works with and without preemption
      - signals are delivered immediately
      - much better host latencies without preemption
      Acked-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      0eaeafa1
  3. 27 4月, 2008 5 次提交
    • C
      KVM: s390: intercepts for diagnose instructions · e28acfea
      Christian Borntraeger 提交于
      This patch introduces interpretation of some diagnose instruction intercepts.
      Diagnose is our classic architected way of doing a hypercall. This patch
      features the following diagnose codes:
      - vm storage size, that tells the guest about its memory layout
      - time slice end, which is used by the guest to indicate that it waits
        for a lock and thus cannot use up its time slice in a useful way
      - ipl functions, which a guest can use to reset and reboot itself
      
      In order to implement ipl functions, we also introduce an exit reason that
      causes userspace to perform various resets on the virtual machine. All resets
      are described in the principles of operation book, except KVM_S390_RESET_IPL
      which causes a reboot of the machine.
      Acked-by: NMartin Schwidefsky <martin.schwidefsky@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      e28acfea
    • C
      KVM: s390: interprocessor communication via sigp · 5288fbf0
      Christian Borntraeger 提交于
      This patch introduces in-kernel handling of _some_ sigp interprocessor
      signals (similar to ipi).
      kvm_s390_handle_sigp() decodes the sigp instruction and calls individual
      handlers depending on the operation requested:
      - sigp sense tries to retrieve information such as existence or running state
        of the remote cpu
      - sigp emergency sends an external interrupt to the remove cpu
      - sigp stop stops a remove cpu
      - sigp stop store status stops a remote cpu, and stores its entire internal
        state to the cpus lowcore
      - sigp set arch sets the architecture mode of the remote cpu. setting to
        ESAME (s390x 64bit) is accepted, setting to ESA/S390 (s390, 31 or 24 bit) is
        denied, all others are passed to userland
      - sigp set prefix sets the prefix register of a remote cpu
      
      For implementation of this, the stop intercept indication starts to get reused
      on purpose: a set of action bits defines what to do once a cpu gets stopped:
      ACTION_STOP_ON_STOP  really stops the cpu when a stop intercept is recognized
      ACTION_STORE_ON_STOP stores the cpu status to lowcore when a stop intercept is
                           recognized
      Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      5288fbf0
    • C
      KVM: s390: intercepts for privileged instructions · 453423dc
      Christian Borntraeger 提交于
      This patch introduces in-kernel handling of some intercepts for privileged
      instructions:
      
      handle_set_prefix()        sets the prefix register of the local cpu
      handle_store_prefix()      stores the content of the prefix register to memory
      handle_store_cpu_address() stores the cpu number of the current cpu to memory
      handle_skey()              just decrements the instruction address and retries
      handle_stsch()             delivers condition code 3 "operation not supported"
      handle_chsc()              same here
      handle_stfl()              stores the facility list which contains the
                                 capabilities of the cpu
      handle_stidp()             stores cpu type/model/revision and such
      handle_stsi()              stores information about the system topology
      Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      453423dc
    • C
      KVM: s390: interrupt subsystem, cpu timer, waitpsw · ba5c1e9b
      Carsten Otte 提交于
      This patch contains the s390 interrupt subsystem (similar to in kernel apic)
      including timer interrupts (similar to in-kernel-pit) and enabled wait
      (similar to in kernel hlt).
      
      In order to achieve that, this patch also introduces intercept handling
      for instruction intercepts, and it implements load control instructions.
      
      This patch introduces an ioctl KVM_S390_INTERRUPT which is valid for both
      the vm file descriptors and the vcpu file descriptors. In case this ioctl is
      issued against a vm file descriptor, the interrupt is considered floating.
      Floating interrupts may be delivered to any virtual cpu in the configuration.
      
      The following interrupts are supported:
      SIGP STOP       - interprocessor signal that stops a remote cpu
      SIGP SET PREFIX - interprocessor signal that sets the prefix register of a
                        (stopped) remote cpu
      INT EMERGENCY   - interprocessor interrupt, usually used to signal need_reshed
                        and for smp_call_function() in the guest.
      PROGRAM INT     - exception during program execution such as page fault, illegal
                        instruction and friends
      RESTART         - interprocessor signal that starts a stopped cpu
      INT VIRTIO      - floating interrupt for virtio signalisation
      INT SERVICE     - floating interrupt for signalisations from the system
                        service processor
      
      struct kvm_s390_interrupt, which is submitted as ioctl parameter when injecting
      an interrupt, also carrys parameter data for interrupts along with the interrupt
      type. Interrupts on s390 usually have a state that represents the current
      operation, or identifies which device has caused the interruption on s390.
      
      kvm_s390_handle_wait() does handle waitpsw in two flavors: in case of a
      disabled wait (that is, disabled for interrupts), we exit to userspace. In case
      of an enabled wait we set up a timer that equals the cpu clock comparator value
      and sleep on a wait queue.
      
      [christian: change virtio interrupt to 0x2603]
      Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      ba5c1e9b
    • C
      KVM: s390: sie intercept handling · 8f2abe6a
      Christian Borntraeger 提交于
      This path introduces handling of sie intercepts in three flavors: Intercepts
      are either handled completely in-kernel by kvm_handle_sie_intercept(),
      or passed to userspace with corresponding data in struct kvm_run in case
      kvm_handle_sie_intercept() returns -ENOTSUPP.
      In case of partial execution in kernel with the need of userspace support,
      kvm_handle_sie_intercept() may choose to set up struct kvm_run and return
      -EREMOTE.
      
      The trivial intercept reasons are handled in this patch:
      handle_noop() just does nothing for intercepts that don't require our support
        at all
      handle_stop() is called when a cpu enters stopped state, and it drops out to
        userland after updating our vcpu state
      handle_validity() faults in the cpu lowcore if needed, or passes the request
        to userland
      Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NCarsten Otte <cotte@de.ibm.com>
      Signed-off-by: NAvi Kivity <avi@qumranet.com>
      8f2abe6a