From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nj83n-0004Yv-58 for qemu-devel@nongnu.org; Sun, 21 Feb 2010 04:25:07 -0500 Received: from [199.232.76.173] (port=51217 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nj83m-0004Y8-Oc for qemu-devel@nongnu.org; Sun, 21 Feb 2010 04:25:06 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nj83m-0001Gu-4T for qemu-devel@nongnu.org; Sun, 21 Feb 2010 04:25:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41824) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nj83l-0001GX-LZ for qemu-devel@nongnu.org; Sun, 21 Feb 2010 04:25:05 -0500 Message-ID: <4B80FBED.9010903@redhat.com> Date: Sun, 21 Feb 2010 11:25:01 +0200 From: Avi Kivity MIME-Version: 1.0 References: <97ef7408c86f7984db721c38cd736b98b81efad9.1266603744.git.jan.kiszka@siemens.com> In-Reply-To: <97ef7408c86f7984db721c38cd736b98b81efad9.1266603744.git.jan.kiszka@siemens.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/9] qemu-kvm: Clean up register access API List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Anthony Liguori , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org, Gleb Natapov On 02/19/2010 08:22 PM, Jan Kiszka wrote: > qemu-kvm's functions for accessing the VCPU registers are > kvm_arch_load/save_regs. Use them directly instead of going through > various wrappers. Specifically, we do not need on_vcpu wrapping as all > users either already run in the related thread or call while the vm is > stopped. This is now also validated during runtime via asserts. > > > + assert(kvm_cpu_is_stopped(env) || env->thread_id == kvm_get_thread_id()); > The kvm_cpu_is_stopped() part is wrong, for two reasons. First, a future ABI revolution might switch to syscalls and thus make the association between vcpu and thread implicit. This will allow us to drop vcpu->mutex, eventually. Second, kvm_cpu_is_stopped() will be racy in a threaded future version of qemu. All vcpu ioctls should be made from the vcpu thread. Documentation/kvm/api.txt has this to say about the matter: > - vcpu ioctls: These query and set attributes that control the operation > of a single virtual cpu. > > Only run vcpu ioctls from the same thread that was used to create the > vcpu. So it isn't just me. -- error compiling committee.c: too many arguments to function