From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRJEQ-0000SM-Dk for qemu-devel@nongnu.org; Thu, 25 Oct 2012 04:56:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRJEM-0007nb-74 for qemu-devel@nongnu.org; Thu, 25 Oct 2012 04:56:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4666) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRJEL-0007nP-Ui for qemu-devel@nongnu.org; Thu, 25 Oct 2012 04:55:58 -0400 Message-ID: <5088FE94.7050104@redhat.com> Date: Thu, 25 Oct 2012 10:55:48 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1350897839-29593-1-git-send-email-pingfank@linux.vnet.ibm.com> <1350897839-29593-14-git-send-email-pingfank@linux.vnet.ibm.com> <50852299.8090109@redhat.com> <50865E3F.4010809@siemens.com> <5086656A.6060603@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [patch v4 13/16] e1000: add busy flag to anti broken device state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Liu Ping Fan , Jan Kiszka , Marcelo Tosatti , "qemu-devel@nongnu.org" , Anthony Liguori , Stefan Hajnoczi , Paolo Bonzini On 10/24/2012 08:36 AM, liu ping fan wrote: > On Tue, Oct 23, 2012 at 5:37 PM, Avi Kivity wrote: >> On 10/23/2012 11:32 AM, liu ping fan wrote: >>> On Tue, Oct 23, 2012 at 5:07 PM, Jan Kiszka wrote: >>>> On 2012-10-23 07:52, liu ping fan wrote: >>>>> On Mon, Oct 22, 2012 at 6:40 PM, Avi Kivity wrote: >>>>>> On 10/22/2012 11:23 AM, Liu Ping Fan wrote: >>>>>>> The broken device state is caused by releasing local lock before acquiring >>>>>>> big lock. To fix this issue, we have two choice: >>>>>>> 1.use busy flag to protect the state >>>>>>> The drawback is that we will introduce independent busy flag for each >>>>>>> independent device's logic unit. >>>>>>> 2.reload the device's state >>>>>>> The drawback is if the call chain is too deep, the action to reload will >>>>>>> touch each layer. Also the reloading means to recaculate the intermediate >>>>>>> result based on device's regs. >>>>>>> >>>>>>> This patch adopt the solution 1 to fix the issue. >>>>>> >>>>>> Doesn't the nested mmio patch detect this? >>>>>> >>>>> It will only record and fix the issue on one thread. But guest can >>>>> touch the emulated device on muti-threads. >>>> >>>> Sorry, what does that mean? A second VCPU accessing the device will >>>> simply be ignored when it races with another VCPU? Specifically >>>> >>> Yes, just ignored. For device which support many logic in parallel, >>> it should use independent busy flag for each logic >> >> We don't actually know that e1000 doesn't. Why won't writing into >> different registers in parallel work? >> > I think e1000 has only one transfer logic, so one busy flag is enough. > And the normal guest's driver will access the registers one by one. > But anyway, it may have parallel modules. So what about model it like > this > if busy: > wait > > clear busy: > wakeup > You mean lock()/unlock()? Again I suggest to ignore this issue for now. We need to make progress and we can't get everything perfect (or even agree on everything). When we have converted a few devices, we will have more information and can think of a good solution. -- error compiling committee.c: too many arguments to function