From patchwork Tue Feb 2 08:18:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 76321 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 o128JpjL030792 for ; Tue, 2 Feb 2010 08:19:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755159Ab0BBITt (ORCPT ); Tue, 2 Feb 2010 03:19:49 -0500 Received: from david.siemens.de ([192.35.17.14]:15596 "EHLO david.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754951Ab0BBITo (ORCPT ); Tue, 2 Feb 2010 03:19:44 -0500 Received: from mail2.siemens.de (localhost [127.0.0.1]) by david.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o128JEtl019434; Tue, 2 Feb 2010 09:19:14 +0100 Received: from localhost.localdomain ([139.25.173.39]) by mail2.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o128J7sS008551; Tue, 2 Feb 2010 09:19:13 +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 12/21] qemu-kvm: Use upstream kvm_vcpu_dirty Date: Tue, 2 Feb 2010 09:18:58 +0100 Message-Id: <503faf035940632a8734b58c6d8d8225b88c152d.1265098707.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]); Tue, 02 Feb 2010 08:19:52 +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 3ad0ec7..c04f805 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,