From patchwork Wed Jun 3 12:07:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 27658 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n53C82K5002168 for ; Wed, 3 Jun 2009 12:08:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754802AbZFCMH6 (ORCPT ); Wed, 3 Jun 2009 08:07:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754412AbZFCMH6 (ORCPT ); Wed, 3 Jun 2009 08:07:58 -0400 Received: from mx2.redhat.com ([66.187.237.31]:60953 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754121AbZFCMH5 (ORCPT ); Wed, 3 Jun 2009 08:07:57 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n53C7x7c000572 for ; Wed, 3 Jun 2009 08:07:59 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n53C7wgU021282; Wed, 3 Jun 2009 08:07:58 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n53C7vVE019104; Wed, 3 Jun 2009 08:07:57 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id AD31C18D462; Wed, 3 Jun 2009 15:07:56 +0300 (IDT) Date: Wed, 3 Jun 2009 15:07:56 +0300 From: Gleb Natapov To: avi@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH] revert part of 3db8b916e merge Message-ID: <20090603120756.GC11384@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org kvm_*_mpstate() cannot be called from kvm_arch_*_registers() since kvm_arch_*_registers() sometimes called from io thread, but kvm_*_mpstate() can be called only by cpu thread. Signed-off-by: Gleb Natapov --- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/qemu-kvm.c b/qemu-kvm.c index 68d3b92..7ed1e06 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1431,26 +1431,3 @@ void qemu_kvm_cpu_stop(CPUState *env) if (kvm_enabled()) env->kvm_cpu_state.stopped = 1; } - -void kvm_arch_get_registers(CPUState *env) -{ - kvm_save_registers(env); - kvm_save_mpstate(env); -} - -void kvm_arch_put_registers(CPUState *env) -{ - kvm_load_registers(env); - kvm_load_mpstate(env); -} - - -void cpu_synchronize_state(CPUState *env, int modified) -{ - if (kvm_enabled()) { - if (modified) - kvm_arch_put_registers(env); - else - kvm_arch_get_registers(env); - } -} diff --git a/qemu-kvm.h b/qemu-kvm.h index 725589b..5d47e88 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -216,10 +216,25 @@ int kvm_log_stop(target_phys_addr_t phys_addr, target_phys_addr_t len); static inline int kvm_sync_vcpus(void) { return 0; } -void kvm_arch_get_registers(CPUState *env); -void kvm_arch_put_registers(CPUState *env); +static inline void kvm_arch_get_registers(CPUState *env) +{ + kvm_save_registers(env); +} -void cpu_synchronize_state(CPUState *env, int modified); +static inline void kvm_arch_put_registers(CPUState *env) +{ + kvm_load_registers(env); +} + +static inline void cpu_synchronize_state(CPUState *env, int modified) +{ + if (kvm_enabled()) { + if (modified) + kvm_arch_put_registers(env); + else + kvm_arch_get_registers(env); + } +} uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg); diff --git a/target-i386/machine.c b/target-i386/machine.c index f280d3d..07df1e1 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -32,7 +32,10 @@ void cpu_save(QEMUFile *f, void *opaque) int32_t pending_irq; int i, bit; - cpu_synchronize_state(env, 0); + if (kvm_enabled()) { + kvm_save_registers(env); + kvm_save_mpstate(env); + } for(i = 0; i < CPU_NB_REGS; i++) qemu_put_betls(f, &env->regs[i]);