From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Yanan Wang" <wangyanan55@huawei.com>,
kvm@vger.kernel.org,
"Emanuele Giuseppe Esposito" <eesposit@redhat.com>
Subject: [RFC PATCH 0/3] KVM: allow listener to stop all vcpus before
Date: Fri, 4 Nov 2022 11:14:51 -0400 [thread overview]
Message-ID: <20221104151454.136551-1-eesposit@redhat.com> (raw)
QEMU needs to perform memslots operations like merging and splitting,
and each operation requires more than a single ioctl.
Therefore if a vcpu is concurrently reading the same memslots,
it could end up reading something that was temporarly deleted.
For example, merging two memslots into one would imply:
DELETE(m1)
DELETE(m2)
CREATE(m1+m2)
And a vcpu could attempt to read m2 right after it is deleted, but
before the new one is created.
This approach is 100% QEMU-based. No KVM API modification is involved,
but implies that QEMU must make sure no new ioctl is running and all
vcpus are stopped.
The logic and code are basically taken from David Hildenbrand
proposal given a while ago while reviewing a previous attempt where
I suggested to solve the above problem directly in KVM by extending
its API.
This is the original code:
https://github.com/davidhildenbrand/qemu/commit/86b1bf546a8d00908e33f7362b0b61e2be8dbb7a
I just split the patch in three smaller patches, and used a
QemuLockCnt instead of counter + mutex.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1979276
Emanuele
David Hildenbrand (1):
kvm: Atomic memslot updates
Emanuele Giuseppe Esposito (2):
KVM: keep track of running ioctls
KVM: keep track of running vcpu ioctls
accel/kvm/kvm-all.c | 175 ++++++++++++++++++++++++++++++++++++---
hw/core/cpu-common.c | 2 +
include/hw/core/cpu.h | 3 +
include/sysemu/kvm_int.h | 8 ++
4 files changed, 177 insertions(+), 11 deletions(-)
--
2.31.1
next reply other threads:[~2022-11-04 15:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 15:14 Emanuele Giuseppe Esposito [this message]
2022-11-04 15:14 ` [RFC PATCH 1/3] KVM: keep track of running ioctls Emanuele Giuseppe Esposito
2022-11-04 15:14 ` [RFC PATCH 2/3] KVM: keep track of running vcpu ioctls Emanuele Giuseppe Esposito
2022-11-04 15:14 ` [RFC PATCH 3/3] kvm: Atomic memslot updates Emanuele Giuseppe Esposito
2022-11-08 16:25 ` Paolo Bonzini
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=20221104151454.136551-1-eesposit@redhat.com \
--to=eesposit@redhat.com \
--cc=eduardo@habkost.net \
--cc=kvm@vger.kernel.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wangyanan55@huawei.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;
as well as URLs for NNTP newsgroup(s).