Skip to content
  • Julien Thierry's avatar
    kvm-cpu: Pause vCPU in signal handler · fdd26ecb
    Julien Thierry authored
    
    
    Currently, the handling a pause signal only sets a state that will be
    checked at the begining of the CPU run loop. At the checking point the vCPU
    sends the notification that it is actually paused allowing the pause
    requester to confirm all vCPUs are paused.
    
    Receiving the pause signal during a KVM_RUN ioctl will make KVM exit to
    userspace. However, there is a small window between that check on
    cpu->paused and the execution of KVM_RUN where the signal has been received
    but the vCPU does not go back through the notification and starts KVM_RUN.
    Since there is no guarantee the vCPU will come back to userspace, the
    pause requester might deadlock.
    
    Perform the pause directly from the signal handler. This relies on a vCPU
    thread never receiving a pause signal while being pause, but such scenario
    would have caused a deadlock for the pause requester anyway.
    
    Signed-off-by: default avatarJulien Thierry <julien.thierry@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    fdd26ecb