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: 44257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5667DB7D16 for ; Tue, 2 Feb 2010 20:34:25 +1100 (EST) Received: from localhost ([127.0.0.1]:53725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcF6E-0006sx-DH for incoming@patchwork.ozlabs.org; Tue, 02 Feb 2010 04:31:10 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NcEn5-0004PB-Hy for qemu-devel@nongnu.org; Tue, 02 Feb 2010 04:11:23 -0500 Received: from [199.232.76.173] (port=53311 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcEn4-0004P1-Vh for qemu-devel@nongnu.org; Tue, 02 Feb 2010 04:11:23 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NcEn3-00051J-8w for qemu-devel@nongnu.org; Tue, 02 Feb 2010 04:11:22 -0500 Received: from david.siemens.de ([192.35.17.14]:19368) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NcEn2-0004zs-DZ for qemu-devel@nongnu.org; Tue, 02 Feb 2010 04:11:21 -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 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: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: Anthony Liguori , Glauber Costa , Alexander Graf , kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 12/21] qemu-kvm: Use upstream kvm_vcpu_dirty X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Drop regs_modified in favor of upstream's equivalent and clean up kvm_cpu_synchronize_state at this chance. Signed-off-by: Jan Kiszka --- cpu-defs.h | 1 - hw/pc.c | 2 +- qemu-kvm.c | 18 +++++++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) 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,