From: Jan Kiszka <jan.kiszka@web.de>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
kvm@vger.kernel.org, Anthony Liguori <aliguori@us.ibm.com>,
Alexander Graf <agraf@suse.de>,
Glauber Costa <glommer@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [PATCH v2 14/21] qemu-kvm: Rework VCPU state writeback API
Date: Sun, 07 Feb 2010 14:51:19 +0100 [thread overview]
Message-ID: <4B6EC557.9090804@web.de> (raw)
In-Reply-To: <4B6EC180.7000203@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2450 bytes --]
Avi Kivity wrote:
> On 02/03/2010 10:53 AM, Jan Kiszka wrote:
>> This grand cleanup drops all reset and vmsave/load related
>> synchronization points in favor of four(!) generic hooks:
>>
>> - cpu_synchronize_all_states in qemu_savevm_state_complete
>> (initial sync from kernel before vmsave)
>> - cpu_synchronize_all_post_init in qemu_loadvm_state
>> (writeback after vmload)
>> - cpu_synchronize_all_post_init in main after machine init
>> - cpu_synchronize_all_post_reset in qemu_system_reset
>> (writeback after system reset)
>>
>> These writeback points + the existing one of VCPU exec after
>> cpu_synchronize_state map on three levels of writeback:
>>
>> - KVM_PUT_ASYNC_STATE (during runtime, other VCPUs continue to run)
>>
>
> Wouldn't that be SYNC_STATE (state that is modified by the current vcpu
> only)?
It's async /wrt other VCPUs. They continue to run and may interact with
this VCPU while updating its state.
>
>> - KVM_PUT_RESET_STATE (on synchronous system reset, all VCPUs stopped)
>> - KVM_PUT_FULL_STATE (on init or vmload, all VCPUs stopped as well)
>>
>> This level is passed to the arch-specific VCPU state writing function
>> that will decide which concrete substates need to be written. That way,
>> no writer of load, save or reset functions that interact with in-kernel
>> KVM states will ever have to worry about synchronization again. That
>> also means that a lot of reasons for races, segfaults and deadlocks are
>> eliminated.
>>
>> cpu_synchronize_state remains untouched, just as Anthony suggested. We
>> continue to need it before reading or writing of VCPU states that are
>> also tracked by in-kernel KVM subsystems.
>>
>> Consequently, this patch removes many cpu_synchronize_state calls that
>> are now redundant, just like remaining explicit register syncs. It does
>> not touch qemu-kvm's special hooks for mpstate, vcpu_events, or tsc
>> loading. They will be cleaned up by individual patches.
>>
>>
>
> I'm uneasy about this. What are the rules for putting
> cpu_synchronize_state() now?
As before for code that accesses the state during runtime: Before you
read or write some bit of it, call cpu_synchronize_state().
Only reset and save/restore handlers do not have to worry about
synchronization anymore. It makes no sense to overload them with
arch-specific KVM knowledge about what shall be written and when.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@web.de>
To: Avi Kivity <avi@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
kvm@vger.kernel.org, Glauber Costa <glommer@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] Re: [PATCH v2 14/21] qemu-kvm: Rework VCPU state writeback API
Date: Sun, 07 Feb 2010 14:51:19 +0100 [thread overview]
Message-ID: <4B6EC557.9090804@web.de> (raw)
In-Reply-To: <4B6EC180.7000203@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2450 bytes --]
Avi Kivity wrote:
> On 02/03/2010 10:53 AM, Jan Kiszka wrote:
>> This grand cleanup drops all reset and vmsave/load related
>> synchronization points in favor of four(!) generic hooks:
>>
>> - cpu_synchronize_all_states in qemu_savevm_state_complete
>> (initial sync from kernel before vmsave)
>> - cpu_synchronize_all_post_init in qemu_loadvm_state
>> (writeback after vmload)
>> - cpu_synchronize_all_post_init in main after machine init
>> - cpu_synchronize_all_post_reset in qemu_system_reset
>> (writeback after system reset)
>>
>> These writeback points + the existing one of VCPU exec after
>> cpu_synchronize_state map on three levels of writeback:
>>
>> - KVM_PUT_ASYNC_STATE (during runtime, other VCPUs continue to run)
>>
>
> Wouldn't that be SYNC_STATE (state that is modified by the current vcpu
> only)?
It's async /wrt other VCPUs. They continue to run and may interact with
this VCPU while updating its state.
>
>> - KVM_PUT_RESET_STATE (on synchronous system reset, all VCPUs stopped)
>> - KVM_PUT_FULL_STATE (on init or vmload, all VCPUs stopped as well)
>>
>> This level is passed to the arch-specific VCPU state writing function
>> that will decide which concrete substates need to be written. That way,
>> no writer of load, save or reset functions that interact with in-kernel
>> KVM states will ever have to worry about synchronization again. That
>> also means that a lot of reasons for races, segfaults and deadlocks are
>> eliminated.
>>
>> cpu_synchronize_state remains untouched, just as Anthony suggested. We
>> continue to need it before reading or writing of VCPU states that are
>> also tracked by in-kernel KVM subsystems.
>>
>> Consequently, this patch removes many cpu_synchronize_state calls that
>> are now redundant, just like remaining explicit register syncs. It does
>> not touch qemu-kvm's special hooks for mpstate, vcpu_events, or tsc
>> loading. They will be cleaned up by individual patches.
>>
>>
>
> I'm uneasy about this. What are the rules for putting
> cpu_synchronize_state() now?
As before for code that accesses the state during runtime: Before you
read or write some bit of it, call cpu_synchronize_state().
Only reset and save/restore handlers do not have to worry about
synchronization anymore. It makes no sense to overload them with
arch-specific KVM knowledge about what shall be written and when.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
next prev parent reply other threads:[~2010-02-07 13:51 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 8:53 [PATCH v2 00/21] qemu-kvm: Hook cleanups and extended use of upstream code Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 01/21] qemu-kvm: Drop vmport changes Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-07 13:17 ` Avi Kivity
2010-02-07 13:17 ` [Qemu-devel] " Avi Kivity
2010-02-07 13:54 ` Jan Kiszka
2010-02-07 13:54 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 02/21] KVM: Make vmport KVM-compatible Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 03/21] qemu-kvm: Clean up register access API Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 04/21] KVM: x86: Fix up misreported CPU features Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 05/21] qemu-kvm: Use upstream kvm_enabled and cpu_synchronize_state Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 06/21] qemu-kvm: Use upstream kvm_setup_guest_memory Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 07/21] qemu-kvm: Use some more upstream prototypes Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 08/21] qemu-kvm: Use upstream kvm_arch_get_supported_cpuid Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 09/21] qemu-kvm: Use upstream kvm_pit_in_kernel Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 10/21] KVM: Move and rename regs_modified Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 11/21] KVM: Rework of guest debug state writing Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 12/21] qemu-kvm: Use upstream kvm_vcpu_dirty Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 13/21] qemu-kvm: Use upstream guest debug code Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 14/21] qemu-kvm: Rework VCPU state writeback API Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-07 13:34 ` Avi Kivity
2010-02-07 13:34 ` [Qemu-devel] " Avi Kivity
2010-02-07 13:51 ` Jan Kiszka [this message]
2010-02-07 13:51 ` Jan Kiszka
2010-02-07 13:58 ` Avi Kivity
2010-02-07 13:58 ` [Qemu-devel] " Avi Kivity
2010-02-07 14:26 ` Jan Kiszka
2010-02-07 14:26 ` [Qemu-devel] " Jan Kiszka
2010-02-07 14:32 ` Avi Kivity
2010-02-07 14:32 ` [Qemu-devel] " Avi Kivity
2010-02-03 8:53 ` [PATCH v2 15/21] qemu-kvm: Clean up mpstate synchronization Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 16/21] KVM: x86: Restrict writeback of VCPU state Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 17/21] qemu-kvm: Use VCPU event state for reset and vmsave/load Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 18/21] qemu-kvm: Cleanup/fix TSC and PV clock writeback Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 19/21] qemu-kvm: Clean up KVM's APIC hooks Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 20/21] qemu-kvm: Move kvm_set_boot_cpu_id Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 8:53 ` [PATCH v2 21/21] qemu-kvm: Bring qemu_init_vcpu back home Jan Kiszka
2010-02-03 8:53 ` [Qemu-devel] " Jan Kiszka
2010-02-03 16:50 ` [PATCH v2 00/21] qemu-kvm: Hook cleanups and extended use of upstream code Marcelo Tosatti
2010-02-03 16:50 ` [Qemu-devel] " Marcelo Tosatti
2010-02-03 18:02 ` Jan Kiszka
2010-02-03 18:02 ` [Qemu-devel] " Jan Kiszka
2010-02-03 18:36 ` Marcelo Tosatti
2010-02-03 18:36 ` [Qemu-devel] " Marcelo Tosatti
2010-02-04 7:17 ` Gleb Natapov
2010-02-04 7:17 ` [Qemu-devel] " Gleb Natapov
2010-02-04 8:18 ` [Qemu-devel] Need QEMU source and documentation Taimoor Mirza
2010-02-04 9:40 ` Roy Tam
2010-02-04 14:12 ` Anthony Liguori
2010-02-07 9:46 ` [PATCH v2 00/21] qemu-kvm: Hook cleanups and extended use of upstream code Gleb Natapov
2010-02-07 9:46 ` [Qemu-devel] " Gleb Natapov
2010-02-07 11:28 ` Jan Kiszka
2010-02-07 11:28 ` [Qemu-devel] " Jan Kiszka
2010-02-07 11:51 ` Gleb Natapov
2010-02-07 11:51 ` [Qemu-devel] " Gleb Natapov
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=4B6EC557.9090804@web.de \
--to=jan.kiszka@web.de \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=glommer@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--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 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.