diff mbox

[14/23] kvm-all: make async_safe_run_on_cpu safe on kvm too

Message ID 20170606181948.16238-15-rkagan@virtuozzo.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roman Kagan June 6, 2017, 6:19 p.m. UTC
Wrap the bulk of kvm_cpu_exec with cpu_exec_start/end, so that kvm
version can also enjoy performing certain operations while all vCPUs are
quiescent.

Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
---
 kvm-all.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paolo Bonzini June 8, 2017, 2:47 p.m. UTC | #1
On 06/06/2017 20:19, Roman Kagan wrote:
> Wrap the bulk of kvm_cpu_exec with cpu_exec_start/end, so that kvm
> version can also enjoy performing certain operations while all vCPUs are
> quiescent.
> 
> Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
> ---
>  kvm-all.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index 494b925..85668fb 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -1974,6 +1974,7 @@ int kvm_cpu_exec(CPUState *cpu)
>      }
>  
>      qemu_mutex_unlock_iothread();
> +    cpu_exec_start(cpu);
>  
>      do {
>          MemTxAttrs attrs;
> @@ -2103,6 +2104,7 @@ int kvm_cpu_exec(CPUState *cpu)
>          }
>      } while (ret == 0);
>  
> +    cpu_exec_end(cpu);
>      qemu_mutex_lock_iothread();
>  
>      if (ret < 0) {
> 

This patch caught my eye, I'm applying it right now.

Paolo
diff mbox

Patch

diff --git a/kvm-all.c b/kvm-all.c
index 494b925..85668fb 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1974,6 +1974,7 @@  int kvm_cpu_exec(CPUState *cpu)
     }
 
     qemu_mutex_unlock_iothread();
+    cpu_exec_start(cpu);
 
     do {
         MemTxAttrs attrs;
@@ -2103,6 +2104,7 @@  int kvm_cpu_exec(CPUState *cpu)
         }
     } while (ret == 0);
 
+    cpu_exec_end(cpu);
     qemu_mutex_lock_iothread();
 
     if (ret < 0) {