From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LgLzZ-0005Z8-DW for qemu-devel@nongnu.org; Sun, 08 Mar 2009 12:36:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LgLzX-0005Xg-QU for qemu-devel@nongnu.org; Sun, 08 Mar 2009 12:36:45 -0400 Received: from [199.232.76.173] (port=35146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LgLzX-0005Xb-L3 for qemu-devel@nongnu.org; Sun, 08 Mar 2009 12:36:43 -0400 Received: from an-out-0708.google.com ([209.85.132.241]:9537) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LgLzX-0004kS-6n for qemu-devel@nongnu.org; Sun, 08 Mar 2009 12:36:43 -0400 Received: by an-out-0708.google.com with SMTP id b6so599968ana.37 for ; Sun, 08 Mar 2009 09:36:42 -0700 (PDT) Message-ID: <49B3F418.4090805@codemonkey.ws> Date: Sun, 08 Mar 2009 11:36:40 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [6684] Fix "info registers" under kvm. References: <49B3EAA8.6050900@web.de> <49B3EFDC.8050205@redhat.com> <49B3F0F5.8020202@redhat.com> In-Reply-To: <49B3F0F5.8020202@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Avi Kivity wrote: > Avi Kivity wrote: >> Jan Kiszka wrote: >>> I'm just still waiting for a reply from Anthony on how to embed best >>> all >>> the "if (kvm_enabled()) foo();" patterns [2]. That would also allow us >>> to merge gdbstub support for upstream kvm. >>> >>> >> >> Wouldn't 'if (!kvm_enabled()) return;' inside the callees suffice? > > Rather, > > static inline void kvm_foo(...) > { > if (!kvm_enabled()) { > return; > } > > #ifdef CONFIG_KVM > kvm_do_foo(); > #endif > } In the case of save/load registers, I'd prefer wrapper functions like: cpu_state_update(CPUState *env, int is_dirty) That could be hooked by something like Xen. The implementation would be: static void cpu_state_update(CPUState *env, int is_dirty) { if (kvm_enabled()) { if (is_dirty) kvm_arch_save_registers(env); else kvm_arch_load_registers(env); } } Regards, Anthony Liguori > >