]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: s390: clear kicked_mask before sleeping again
authorHalil Pasic <pasic@linux.ibm.com>
Tue, 19 Oct 2021 17:53:59 +0000 (19:53 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 20 Oct 2021 11:03:04 +0000 (13:03 +0200)
commitf213138dbaaa3b7c914746450cca607d9bbd34c9
tree3665218fb6d52805e8ee62da349cac0169cd0e5c
parentaeaaee8b211c9f64c1d5f2f0302a2394347dff84
KVM: s390: clear kicked_mask before sleeping again

The idea behind kicked mask is that we should not re-kick a vcpu that
is already in the "kick" process, i.e. that was kicked and is
is about to be dispatched if certain conditions are met.

The problem with the current implementation is, that it assumes the
kicked vcpu is going to enter SIE shortly. But under certain
circumstances, the vcpu we just kicked will be deemed non-runnable and
will remain in wait state. This can happen, if the interrupt(s) this
vcpu got kicked to deal with got already cleared (because the interrupts
got delivered to another vcpu). In this case kvm_arch_vcpu_runnable()
would return false, and the vcpu would remain in kvm_vcpu_block(),
but this time with its kicked_mask bit set. So next time around we
wouldn't kick the vcpu form __airqs_kick_single_vcpu(), but would assume
that we just kicked it.

Let us make sure the kicked_mask is cleared before we give up on
re-dispatching the vcpu.

Fixes: a2ab0f7e961a ("KVM: s390: add gib_alert_irq_handler()")
Reported-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Michael Mueller <mimu@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20211019175401.3757927-2-pasic@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/kvm-s390.c