From patchwork Wed Feb 3 08:53:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 76633 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o138sOV8011338 for ; Wed, 3 Feb 2010 08:54:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756044Ab0BCIyV (ORCPT ); Wed, 3 Feb 2010 03:54:21 -0500 Received: from thoth.sbs.de ([192.35.17.2]:21141 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755946Ab0BCIyT (ORCPT ); Wed, 3 Feb 2010 03:54:19 -0500 Received: from mail3.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id o138rshf025952; Wed, 3 Feb 2010 09:53:54 +0100 Received: from localhost.localdomain ([139.25.173.28]) by mail3.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o138rkCD012112; Wed, 3 Feb 2010 09:53:53 +0100 From: Jan Kiszka To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, Anthony Liguori , Alexander Graf , Glauber Costa , qemu-devel@nongnu.org Subject: [PATCH v2 12/21] qemu-kvm: Use upstream kvm_vcpu_dirty Date: Wed, 3 Feb 2010 09:53:37 +0100 Message-Id: <7590889135b816c090cbbf20b16bb2e81083e350.1265187223.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: References: In-Reply-To: References: Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 03 Feb 2010 08:54:25 +0000 (UTC) diff --git a/cpu-defs.h b/cpu-defs.h index 49a9e8d..c57d8df 100644 --- a/cpu-defs.h +++ b/cpu-defs.h @@ -142,7 +142,6 @@ struct KVMCPUState { pthread_t thread; int signalled; struct qemu_work_item *queued_work_first, *queued_work_last; - int regs_modified; }; #define CPU_TEMP_BUF_NLONGS 128 diff --git a/hw/pc.c b/hw/pc.c index 7a7dfa7..af6ea8b 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -744,7 +744,7 @@ CPUState *pc_new_cpu(const char *cpu_model) fprintf(stderr, "Unable to find x86 CPU definition\n"); exit(1); } - env->kvm_cpu_state.regs_modified = 1; + env->kvm_vcpu_dirty = 1; if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) { env->cpuid_apic_id = env->cpu_index; /* APIC reset callback resets cpu */ diff --git a/qemu-kvm.c b/qemu-kvm.c index 0094db9..6a72b89 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -861,9 +861,9 @@ int pre_kvm_run(kvm_context_t kvm, CPUState *env) { kvm_arch_pre_run(env, env->kvm_run); - if (env->kvm_cpu_state.regs_modified) { + if (env->kvm_vcpu_dirty) { kvm_arch_load_regs(env); - env->kvm_cpu_state.regs_modified = 0; + env->kvm_vcpu_dirty = 0; } pthread_mutex_unlock(&qemu_mutex); @@ -1530,16 +1530,16 @@ static void on_vcpu(CPUState *env, void (*func)(void *data), void *data) static void do_kvm_cpu_synchronize_state(void *_env) { CPUState *env = _env; - if (!env->kvm_cpu_state.regs_modified) { - kvm_arch_save_regs(env); - env->kvm_cpu_state.regs_modified = 1; - } + + kvm_arch_save_regs(env); } void kvm_cpu_synchronize_state(CPUState *env) { - if (!env->kvm_cpu_state.regs_modified) + if (!env->kvm_vcpu_dirty) { on_vcpu(env, do_kvm_cpu_synchronize_state, env); + env->kvm_vcpu_dirty = 1; + } } static void inject_interrupt(void *data) @@ -2329,9 +2329,9 @@ static void kvm_invoke_set_guest_debug(void *data) { struct kvm_set_guest_debug_data *dbg_data = data; - if (cpu_single_env->kvm_cpu_state.regs_modified) { + if (cpu_single_env->kvm_vcpu_dirty) { kvm_arch_save_regs(cpu_single_env); - cpu_single_env->kvm_cpu_state.regs_modified = 0; + cpu_single_env->kvm_vcpu_dirty = 0; } dbg_data->err = kvm_set_guest_debug(cpu_single_env,