From: Michael Mueller <mimu@linux.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
Halil Pasic <pasic@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: David Hildenbrand <david@redhat.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>,
Pierre Morel <pmorel@linux.ibm.com>,
Tony Krowiak <akrowiak@linux.ibm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Niklas Schnelle <schnelle@linux.ibm.com>,
farman@linux.ibm.com, kvm@vger.kernel.org
Subject: Re: [PATCH 3/3] KVM: s390: clear kicked_mask if not idle after set
Date: Wed, 20 Oct 2021 12:51:49 +0200 [thread overview]
Message-ID: <6ea9345d-9ca0-694b-3b9f-4702d1681bb8@linux.ibm.com> (raw)
In-Reply-To: <ae8b3b11-2eef-0712-faee-5e3467d3e985@de.ibm.com>
On 20.10.21 12:31, Christian Borntraeger wrote:
> Am 20.10.21 um 11:48 schrieb Michael Mueller:
>>
>>
>> On 19.10.21 19:54, Halil Pasic wrote:
>>> The idea behind kicked mask is that we should not re-kick a vcpu
>>> from __airqs_kick_single_vcpu() that is already in the middle of
>>> being kicked by the same function.
>>>
>>> If however the vcpu that was idle before when the idle_mask was
>>> examined, is not idle any more after the kicked_mask is set, that
>>> means that we don't need to kick, and that we need to clear the
>>> bit we just set because we may be beyond the point where it would
>>> get cleared in the wake-up process. Since the time window is short,
>>> this is probably more a theoretical than a practical thing: the race
>>> window is small.
>>>
>>> To get things harmonized let us also move the clear from vcpu_pre_run()
>>> to __unset_cpu_idle().
>>>
>>> Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
>>> Fixes: 9f30f6216378 ("KVM: s390: add gib_alert_irq_handler()")
>>
>> Before releasing something like this, where none of us is sure if
>> it really saves cpu cost, I'd prefer to run some measurement with
>> the whole kicked_mask logic removed and to compare the number of
>> vcpu wake ups with the number of interrupts to be processed by
>> the gib alert mechanism in a slightly over committed host while
>> driving with Matthews test load.
>
> But I think patch 1 and 2 can go immediately as they measurably or
> testable fix things. Correct?
Yes
>
>> A similar run can be done with this code.
>>
>>> ---
>>> arch/s390/kvm/interrupt.c | 7 ++++++-
>>> arch/s390/kvm/kvm-s390.c | 2 --
>>> 2 files changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
>>> index 2245f4b8d362..3c80a2237ef5 100644
>>> --- a/arch/s390/kvm/interrupt.c
>>> +++ b/arch/s390/kvm/interrupt.c
>>> @@ -426,6 +426,7 @@ static void __unset_cpu_idle(struct kvm_vcpu *vcpu)
>>> {
>>> kvm_s390_clear_cpuflags(vcpu, CPUSTAT_WAIT);
>>> clear_bit(vcpu->vcpu_idx, vcpu->kvm->arch.idle_mask);
>>> + clear_bit(vcpu->vcpu_idx, vcpu->kvm->arch.gisa_int.kicked_mask);
>>> }
>>> static void __reset_intercept_indicators(struct kvm_vcpu *vcpu)
>>> @@ -3064,7 +3065,11 @@ static void __airqs_kick_single_vcpu(struct
>>> kvm *kvm, u8 deliverable_mask)
>>> /* lately kicked but not yet running */
>>> if (test_and_set_bit(vcpu_idx, gi->kicked_mask))
>>> return;
>>> - kvm_s390_vcpu_wakeup(vcpu);
>>> + /* if meanwhile not idle: clear and don't kick */
>>> + if (test_bit(vcpu_idx, kvm->arch.idle_mask))
>>> + kvm_s390_vcpu_wakeup(vcpu);
>>> + else
>>> + clear_bit(vcpu_idx, gi->kicked_mask);
>>> return;
>>> }
>>> }
>>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>>> index 1c97493d21e1..6b779ef9f5fb 100644
>>> --- a/arch/s390/kvm/kvm-s390.c
>>> +++ b/arch/s390/kvm/kvm-s390.c
>>> @@ -4067,8 +4067,6 @@ static int vcpu_pre_run(struct kvm_vcpu *vcpu)
>>> kvm_s390_patch_guest_per_regs(vcpu);
>>> }
>>> - clear_bit(vcpu->vcpu_idx, vcpu->kvm->arch.gisa_int.kicked_mask);
>>> -
>>> vcpu->arch.sie_block->icptcode = 0;
>>> cpuflags = atomic_read(&vcpu->arch.sie_block->cpuflags);
>>> VCPU_EVENT(vcpu, 6, "entering sie flags %x", cpuflags);
>>>
next prev parent reply other threads:[~2021-10-20 10:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-19 17:53 [PATCH 0/3] fixes for __airqs_kick_single_vcpu() Halil Pasic
2021-10-19 17:53 ` [PATCH 1/3] KVM: s390: clear kicked_mask before sleeping again Halil Pasic
2021-10-19 21:22 ` Christian Borntraeger
2021-10-20 5:35 ` Claudio Imbrenda
2021-10-20 6:03 ` Christian Borntraeger
2021-10-20 6:08 ` Claudio Imbrenda
2021-10-20 8:14 ` Halil Pasic
2021-10-20 10:42 ` Claudio Imbrenda
2021-10-20 8:06 ` Michael Mueller
2021-10-20 10:44 ` Claudio Imbrenda
2021-10-19 17:54 ` [PATCH 2/3] KVM: s390: preserve deliverable_mask in __airqs_kick_single_vcpu Halil Pasic
2021-10-19 21:24 ` Christian Borntraeger
2021-10-20 5:39 ` Claudio Imbrenda
2021-10-20 8:08 ` Michael Mueller
2021-10-19 17:54 ` [PATCH 3/3] KVM: s390: clear kicked_mask if not idle after set Halil Pasic
2021-10-19 21:35 ` Christian Borntraeger
2021-10-20 5:14 ` Christian Borntraeger
2021-10-20 7:52 ` Halil Pasic
2021-10-26 8:52 ` Christian Borntraeger
2021-10-20 9:48 ` Michael Mueller
2021-10-20 10:31 ` Christian Borntraeger
2021-10-20 10:45 ` Halil Pasic
2021-10-20 10:52 ` Christian Borntraeger
2021-10-20 10:51 ` Michael Mueller [this message]
2021-10-20 11:04 ` [PATCH 0/3] fixes for __airqs_kick_single_vcpu() Christian Borntraeger
2021-10-20 12:12 ` Halil Pasic
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=6ea9345d-9ca0-694b-3b9f-4702d1681bb8@linux.ibm.com \
--to=mimu@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=farman@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-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pmorel@linux.ibm.com \
--cc=schnelle@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