Re: [PATCH v4] KVM: s390: fix gisa destroy operation might lead to cpu stalls

Nico Boehr
2023-09-04T07:10:21Z

Quoting Michael Mueller (2023-09-01 12:58:23)
[...]
> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
> index 9bd0a873f3b1..96450e5c4b6f 100644
> --- a/arch/s390/kvm/interrupt.c
> +++ b/arch/s390/kvm/interrupt.c
[...]
> static inline void gisa_set_ipm_gisc(struct kvm_s390_gisa *gisa, u32 gisc)
> {
> set_bit_inv(IPM_BIT_OFFSET + gisc, (unsigned long *) gisa);
> @@ -3202,11 +3197,12 @@ void kvm_s390_gisa_destroy(struct kvm *kvm)
>
> if (!gi->origin)
> return;
> - if (gi->alert.mask)
> - KVM_EVENT(3, "vm 0x%pK has unexpected iam 0x%02x",
> - kvm, gi->alert.mask);
> - while (gisa_in_alert_list(gi->origin))
> - cpu_relax();
> + WARN(gi->alert.mask != 0x00,
> + "unexpected non zero alert.mask 0x%02x",
> + gi->alert.mask);
> + gi->alert.mask = 0x00;
> + if (gisa_set_iam(gi->origin, gi->alert.mask))
> + process_gib_alert_list();

I am not an expert for the GISA, so excuse my possibly stupid question:
process_gib_alert_list() starts the timer. So can gisa_vcpu_kicker()
already be running before we reach hrtimer_cancel() below? Is this fine?

> hrtimer_cancel(&gi->timer);
> gi->origin = NULL;
> VM_EVENT(kvm, 3, "gisa 0x%pK destroyed", gisa);