From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, KVM <kvm@vger.kernel.org>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
linux-s390 <linux-s390@vger.kernel.org>,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH/RFC 2/2] KVM: enable kvm_vcpu_kick/wake_up for s390
Date: Fri, 17 Feb 2017 16:23:57 +0100 [thread overview]
Message-ID: <20170217152357.GF12224@potion> (raw)
In-Reply-To: <1487337007-91063-3-git-send-email-borntraeger@de.ibm.com>
2017-02-17 14:10+0100, Christian Borntraeger:
> while we still need to provide our private version of kick and wakeup
> to synchronize with some special cases, we can still enable the common
> code variant.
>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> arch/s390/kvm/kvm-s390.c | 12 ++++++++++--
> virt/kvm/kvm_main.c | 2 --
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 7cfd0dd..fa20686 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -2485,8 +2485,14 @@ static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start,
>
> int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
> {
> - /* kvm common code refers to this, but never calls it */
> - BUG();
> + /*
> + * STOP indication is resetted when delivering interrupts. This
> + * is done before we handle requests, so we only "loose" this
> + * when we are still going to handle requests. In that case
> + * we no longer need that STOP indication.
> + */
> + __set_cpuflag(vcpu, CPUSTAT_STOP_INT);
> + kvm_s390_vsie_kick(vcpu);
I wouldn't put the kick into that function. On other architectures, the
function decides whether we should call an operation that actually
forces the exit. e.g. x86 and arm do
return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE
(which also contains an optimization, because they will not kick a VCPU
twice or do a kick for a VCPU outside the guest mode.)
There little point in having vcpu->mode if we do not use it here.
And we'd also like to use kvm_arch_vcpu_should_kick() for the same
decision in kvm_make_all_cpus_request(); basic idea:
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 4f4d250e1f53..676c0636d73c 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -163,10 +163,6 @@ void vcpu_put(struct kvm_vcpu *vcpu)
}
EXPORT_SYMBOL_GPL(vcpu_put);
-static void ack_flush(void *_completed)
-{
-}
-
bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
{
int i, cpu, me;
@@ -194,13 +190,13 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req)
smp_mb__after_atomic();
if (cpus != NULL && cpu != -1 && cpu != me &&
- kvm_vcpu_exiting_guest_mode(vcpu) != OUTSIDE_GUEST_MODE)
+ kvm_arch_vcpu_should_kick(vcpu))
cpumask_set_cpu(cpu, cpus);
}
if (unlikely(cpus == NULL))
- smp_call_function_many(cpu_online_mask, ack_flush, NULL, 1);
+ kvm_arch_cpu_kick_many(cpu_online_mask);
else if (!cpumask_empty(cpus))
- smp_call_function_many(cpus, ack_flush, NULL, 1);
+ kvm_arch_cpu_kick_many(cpus);
else
called = false;
put_cpu();
prev parent reply other threads:[~2017-02-17 15:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 13:10 [PATCH/RFC 0/2] KVM: s390: enable kvm_vpcu_kick/wake_up Christian Borntraeger
2017-02-17 13:10 ` [PATCH/RFC 1/2] s390/smp: export smp_send_reschedule Christian Borntraeger
2017-02-17 15:12 ` [PATCH] KVM: add kvm_arch_cpu_kick Radim Krčmář
2017-02-17 15:46 ` Christian Borntraeger
2017-02-17 16:23 ` Paolo Bonzini
2017-02-17 16:42 ` Christian Borntraeger
2017-02-17 17:10 ` David Hildenbrand
2017-02-20 11:12 ` Christian Borntraeger
2017-02-20 11:35 ` David Hildenbrand
2017-02-20 21:45 ` Radim Krčmář
2017-02-21 8:59 ` Christian Borntraeger
2017-02-21 17:15 ` Radim Krčmář
2017-02-21 19:08 ` Christian Borntraeger
2017-02-22 15:29 ` Radim Krčmář
2017-02-20 20:59 ` Radim Krčmář
2017-02-17 17:07 ` David Hildenbrand
2017-02-17 13:10 ` [PATCH/RFC 2/2] KVM: enable kvm_vcpu_kick/wake_up for s390 Christian Borntraeger
2017-02-17 15:23 ` Radim Krčmář [this message]
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=20170217152357.GF12224@potion \
--to=rkrcmar@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.