From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Role of qemu_fair_mutex Date: Mon, 03 Jan 2011 12:01:17 +0200 Message-ID: <4D219E6D.8060902@redhat.com> References: <4D219AF5.2030204@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: qemu-devel , kvm , Marcelo Tosatti To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:28452 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460Ab1ACKBZ (ORCPT ); Mon, 3 Jan 2011 05:01:25 -0500 In-Reply-To: <4D219AF5.2030204@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On 01/03/2011 11:46 AM, Jan Kiszka wrote: > Hi, > > at least in kvm mode, the qemu_fair_mutex seems to have lost its > function of balancing qemu_global_mutex access between the io-thread and > vcpus. It's now only taken by the latter, isn't it? > > This and the fact that qemu-kvm does not use this kind of lock made me > wonder what its role is and if it is still relevant in practice. I'd > like to unify the execution models of qemu-kvm and qemu, and this lock > is the most obvious difference (there are surely more subtle ones as > well...). > IIRC it was used for tcg, which has a problem that kvm doesn't have: a tcg vcpu needs to hold qemu_mutex when it runs, which means there will always be contention on qemu_mutex. In the absence of fairness, the tcg thread could dominate qemu_mutex and starve the iothread. This doesn't happen with kvm since kvm vcpus drop qemu_mutex when running. -- error compiling committee.c: too many arguments to function