From: Paolo Bonzini <pbonzini@redhat.com>
To: David Hildenbrand <dahi@linux.vnet.ibm.com>,
Alexander Graf <agraf@suse.de>
Cc: linux-s390 <linux-s390@vger.kernel.org>,
KVM <kvm@vger.kernel.org>, qemu-devel <qemu-devel@nongnu.org>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Jens Freimann <jfrei@linux.vnet.ibm.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: Re: [Qemu-devel] [PATCH/RFC 4/5] s390x/kvm: test whether a cpu is STOPPED when checking "has_work"
Date: Tue, 29 Jul 2014 15:52:00 +0200 [thread overview]
Message-ID: <53D7A700.8090207@redhat.com> (raw)
In-Reply-To: <20140728170318.1eb8ed64@thinkpad-w530>
Il 28/07/2014 17:03, David Hildenbrand ha scritto:
> Well the difference is, that a STOPPED vcpu can be woken up by non-interrupt
> like things (SIGP START) AND a special interrupt (SIGP RESTART - which is like
> a "SIPI"++ as it performs a psw exchange - "NMI"). So we basically have two
> paths that can lead to a state change. All interrupt bits may be in any
> combination (SIGP RESTART interrupts can't be masked out, nor can SIGP START be
> denied).
>
> The other thing may be that on s390, each vcpu (including itself) can put
> another vcpu into the STOPPED state - I assume that this is different for x86 "
> INIT_RECEIVED". For this reason we have to watch out for bad race conditions
> (e.g. multiple vcpus working on another vcpu)...
You can do that in x86 by sending an INIT inter-processor interrupt. A
SIPI is ignored if the CPU is not in INIT_RECEIVED state.
Commit 66450a21f99636af4fafac2afd33f1a40631bc3a introduced the current
implementation.
- an INIT cancels a previous SIPI;
- if both INIT and SIPI are sent, on real hardware you need to have a
few hundred microseconds between them, but KVM will reliably process
INIT before SIPI.
See commit 299018f44ac553dce3caf84df1d14c4764faa279 for an example of
the races that can happen.
Note that x86 has KVM_MP_STATE_SIPI_RECEIVED state but it is obsolete,
we go straight from KVM_MP_STATE_INIT_RECEIVED to KVM_MP_STATE_RUNNABLE.
next prev parent reply other threads:[~2014-07-29 13:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 13:10 [Qemu-devel] [PATCH/RFC 0/5] s390x/kvm: track the logical cpu state in QEMU and propagate it to kvm Christian Borntraeger
2014-07-10 13:10 ` [Qemu-devel] [PATCH/RFC 1/5] update linux headers with with cpustate changes Christian Borntraeger
2014-07-10 13:10 ` [Qemu-devel] [PATCH/RFC 2/5] s390x/kvm: introduce proper states for s390 cpus Christian Borntraeger
2014-07-10 13:10 ` [Qemu-devel] [PATCH/RFC 3/5] s390x/kvm: proper use of the cpu states OPERATING and STOPPED Christian Borntraeger
2014-07-10 13:10 ` [Qemu-devel] [PATCH/RFC 4/5] s390x/kvm: test whether a cpu is STOPPED when checking "has_work" Christian Borntraeger
2014-07-28 13:49 ` Alexander Graf
2014-07-28 14:16 ` David Hildenbrand
2014-07-28 14:19 ` Paolo Bonzini
2014-07-28 14:22 ` Alexander Graf
2014-07-28 15:03 ` David Hildenbrand
2014-07-28 15:57 ` David Hildenbrand
2014-07-28 16:45 ` Alexander Graf
2014-07-29 13:52 ` Paolo Bonzini [this message]
2014-07-29 15:06 ` David Hildenbrand
2014-07-29 11:44 ` Christian Borntraeger
2014-07-29 11:49 ` Alexander Graf
2014-07-31 7:45 ` David Hildenbrand
2014-07-10 13:10 ` [Qemu-devel] [PATCH/RFC 5/5] s390x/kvm: propagate s390 cpu state to kvm Christian Borntraeger
2014-07-10 13:14 ` [Qemu-devel] [PATCH/RFC 0/5] s390x/kvm: track the logical cpu state in QEMU and propagate it " David Hildenbrand
2014-07-10 13:14 ` David Hildenbrand
2014-07-10 13:27 ` David Hildenbrand
2014-07-28 13:43 ` Alexander Graf
2014-07-28 13:45 ` Alexander Graf
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=53D7A700.8090207@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).