From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
To: Robert Hoo <robert.hu@linux.intel.com>, qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"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, "David Hildenbrand" <david@redhat.com>
Subject: Re: [PATCH v3 2/3] KVM: keep track of running ioctls
Date: Fri, 2 Dec 2022 13:03:45 +0100 [thread overview]
Message-ID: <22042ca5-9786-ca2b-3e3d-6443a744c5a9@redhat.com> (raw)
In-Reply-To: <c7971c8ad3b4683e2b3036dd7524af1cb42e50e1.camel@linux.intel.com>
Am 02/12/2022 um 07:54 schrieb Robert Hoo:
> On Fri, 2022-11-11 at 10:47 -0500, Emanuele Giuseppe Esposito wrote:
>> Using the new accel-blocker API, mark where ioctls are being called
>> in KVM. Next, we will implement the critical section that will take
>> care of performing memslots modifications atomically, therefore
>> preventing any new ioctl from running and allowing the running ones
>> to finish.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
>> ---
>> accel/kvm/kvm-all.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
>> index f99b0becd8..ff660fd469 100644
>> --- a/accel/kvm/kvm-all.c
>> +++ b/accel/kvm/kvm-all.c
>> @@ -2310,6 +2310,7 @@ static int kvm_init(MachineState *ms)
>> assert(TARGET_PAGE_SIZE <= qemu_real_host_page_size());
>>
>> s->sigmask_len = 8;
>> + accel_blocker_init();
>>
>> #ifdef KVM_CAP_SET_GUEST_DEBUG
>> QTAILQ_INIT(&s->kvm_sw_breakpoints);
>> @@ -3014,7 +3015,9 @@ int kvm_vm_ioctl(KVMState *s, int type, ...)
>> va_end(ap);
>>
>> trace_kvm_vm_ioctl(type, arg);
>> + accel_ioctl_begin();
>> ret = ioctl(s->vmfd, type, arg);
>> + accel_ioctl_end();
>> if (ret == -1) {
>> ret = -errno;
>> }
>> @@ -3032,7 +3035,9 @@ int kvm_vcpu_ioctl(CPUState *cpu, int type,
>> ...)
>> va_end(ap);
>>
>> trace_kvm_vcpu_ioctl(cpu->cpu_index, type, arg);
>> + accel_cpu_ioctl_begin(cpu);
>
> Does this mean that kvm_region_commit() can inhibit any other vcpus
> doing any ioctls?
Yes, because we must prevent any vcpu from reading memslots while we are
updating them.
>
>> ret = ioctl(cpu->kvm_fd, type, arg);
>> + accel_cpu_ioctl_end(cpu);
>> if (ret == -1) {
>> ret = -errno;
>> }
>> @@ -3050,7 +3055,9 @@ int kvm_device_ioctl(int fd, int type, ...)
>> va_end(ap);
>>
>> trace_kvm_device_ioctl(fd, type, arg);
>> + accel_ioctl_begin();
>> ret = ioctl(fd, type, arg);
>> + accel_ioctl_end();
>> if (ret == -1) {
>> ret = -errno;
>> }
>
next prev parent reply other threads:[~2022-12-02 12:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 15:47 [PATCH v3 0/3] KVM: allow listener to stop all vcpus before Emanuele Giuseppe Esposito
2022-11-11 15:47 ` [PATCH v3 1/3] accel: introduce accelerator blocker API Emanuele Giuseppe Esposito
2022-11-18 7:32 ` Philippe Mathieu-Daudé
2022-11-18 7:35 ` Philippe Mathieu-Daudé
2022-12-02 6:56 ` Robert Hoo
2022-11-11 15:47 ` [PATCH v3 2/3] KVM: keep track of running ioctls Emanuele Giuseppe Esposito
2022-11-17 19:27 ` David Hildenbrand
2022-11-18 9:53 ` Emanuele Giuseppe Esposito
2022-12-02 6:54 ` Robert Hoo
2022-12-02 12:03 ` Emanuele Giuseppe Esposito [this message]
2022-12-02 13:32 ` Robert Hoo
2022-12-02 14:32 ` Emanuele Giuseppe Esposito
2022-11-11 15:47 ` [PATCH v3 3/3] kvm: Atomic memslot updates Emanuele Giuseppe Esposito
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=22042ca5-9786-ca2b-3e3d-6443a744c5a9@redhat.com \
--to=eesposit@redhat.com \
--cc=david@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=richard.henderson@linaro.org \
--cc=robert.hu@linux.intel.com \
--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).