public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Mueller <mimu@linux.ibm.com>
To: Nico Boehr <nrb@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Viktor Mihajlovski <mihajlov@linux.ibm.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org,
	Michael Mueller <mimu@linux.vnet.ibm.com>
Subject: Re: [PATCH v4] KVM: s390: fix gisa destroy operation might lead to cpu stalls
Date: Mon, 4 Sep 2023 16:11:26 +0200	[thread overview]
Message-ID: <1f5636f6-18f3-442a-4a60-62440d4907af@linux.ibm.com> (raw)
In-Reply-To: <169381110909.97137.16554568711338641072@t14-nrb>



On 04.09.23 09:05, Nico Boehr wrote:
> 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?

You are right, It cannnot be running in that situation because 
gisa_vcpu_kicker() has returned with HRTIMER_NORESTART and no vcpus are 
defined anymore.

There is another case when the gisa specific timer is started not only 
in the process_gib_alert() case but also when a vcpu of the guest owning 
the gisa is put into wait state, see kvm_s390_handle_wait(). Thus yes, 
it could be running already in that situation. I remember having seen 
this situation when I write the gisa/gib code. But that's case in 
process_gib_alert_list()

It does not hurt to have the hrtimer_cancel() here but I don't want to 
add a change to this patch. Eventually a new one.

Thanks for asking!

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

  reply	other threads:[~2023-09-04 14:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 10:58 [PATCH v4] KVM: s390: fix gisa destroy operation might lead to cpu stalls Michael Mueller
2023-09-04  7:05 ` Nico Boehr
2023-09-04 14:11   ` Michael Mueller [this message]
2023-09-05  7:18     ` Nico Boehr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f5636f6-18f3-442a-4a60-62440d4907af@linux.ibm.com \
    --to=mimu@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mihajlov@linux.ibm.com \
    --cc=mimu@linux.vnet.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=nrb@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox