* [Qemu-devel] [PATCH] kvm: run cpu state synchronization on target vcpu thread
@ 2014-08-20 12:55 David Hildenbrand
2014-08-26 12:43 ` Christian Borntraeger
0 siblings, 1 reply; 3+ messages in thread
From: David Hildenbrand @ 2014-08-20 12:55 UTC (permalink / raw)
To: qemu-devel; +Cc: cornelia.huck, pbonzini, dahi, borntraeger
As already done for kvm_cpu_synchronize_state(), let's trigger
kvm_arch_put_registers() via run_on_cpu() for kvm_cpu_synchronize_post_reset()
and kvm_cpu_synchronize_post_init().
This way, we make sure that the register synchronizing ioctls are
called from the proper vcpu thread; this avoids calls to
synchronize_rcu() in the kernel.
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
---
kvm-all.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 1402f4f..b240bf8 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1669,18 +1669,32 @@ void kvm_cpu_synchronize_state(CPUState *cpu)
}
}
-void kvm_cpu_synchronize_post_reset(CPUState *cpu)
+static void do_kvm_cpu_synchronize_post_reset(void *arg)
{
+ CPUState *cpu = arg;
+
kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
cpu->kvm_vcpu_dirty = false;
}
-void kvm_cpu_synchronize_post_init(CPUState *cpu)
+void kvm_cpu_synchronize_post_reset(CPUState *cpu)
+{
+ run_on_cpu(cpu, do_kvm_cpu_synchronize_post_reset, cpu);
+}
+
+static void do_kvm_cpu_synchronize_post_init(void *arg)
{
+ CPUState *cpu = arg;
+
kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE);
cpu->kvm_vcpu_dirty = false;
}
+void kvm_cpu_synchronize_post_init(CPUState *cpu)
+{
+ run_on_cpu(cpu, do_kvm_cpu_synchronize_post_init, cpu);
+}
+
int kvm_cpu_exec(CPUState *cpu)
{
struct kvm_run *run = cpu->kvm_run;
--
1.8.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] kvm: run cpu state synchronization on target vcpu thread
2014-08-20 12:55 [Qemu-devel] [PATCH] kvm: run cpu state synchronization on target vcpu thread David Hildenbrand
@ 2014-08-26 12:43 ` Christian Borntraeger
2014-08-26 12:46 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Christian Borntraeger @ 2014-08-26 12:43 UTC (permalink / raw)
To: David Hildenbrand, qemu-devel; +Cc: cornelia.huck, pbonzini
On 20/08/14 14:55, David Hildenbrand wrote:
> As already done for kvm_cpu_synchronize_state(), let's trigger
> kvm_arch_put_registers() via run_on_cpu() for kvm_cpu_synchronize_post_reset()
> and kvm_cpu_synchronize_post_init().
>
> This way, we make sure that the register synchronizing ioctls are
> called from the proper vcpu thread; this avoids calls to
> synchronize_rcu() in the kernel.
>
> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Paolo, will you take that via the kvm tree?
Otherwise I can queue that via the s390 tree together with the other patches that move our vcpu ioctls to the vcpu thread. I need your ACK in that case.
Christian
> ---
> kvm-all.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 1402f4f..b240bf8 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1669,18 +1669,32 @@ void kvm_cpu_synchronize_state(CPUState *cpu)
> }
> }
>
> -void kvm_cpu_synchronize_post_reset(CPUState *cpu)
> +static void do_kvm_cpu_synchronize_post_reset(void *arg)
> {
> + CPUState *cpu = arg;
> +
> kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
> cpu->kvm_vcpu_dirty = false;
> }
>
> -void kvm_cpu_synchronize_post_init(CPUState *cpu)
> +void kvm_cpu_synchronize_post_reset(CPUState *cpu)
> +{
> + run_on_cpu(cpu, do_kvm_cpu_synchronize_post_reset, cpu);
> +}
> +
> +static void do_kvm_cpu_synchronize_post_init(void *arg)
> {
> + CPUState *cpu = arg;
> +
> kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE);
> cpu->kvm_vcpu_dirty = false;
> }
>
> +void kvm_cpu_synchronize_post_init(CPUState *cpu)
> +{
> + run_on_cpu(cpu, do_kvm_cpu_synchronize_post_init, cpu);
> +}
> +
> int kvm_cpu_exec(CPUState *cpu)
> {
> struct kvm_run *run = cpu->kvm_run;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-26 12:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 12:55 [Qemu-devel] [PATCH] kvm: run cpu state synchronization on target vcpu thread David Hildenbrand
2014-08-26 12:43 ` Christian Borntraeger
2014-08-26 12:46 ` Paolo Bonzini
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.