From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34542 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2axZ-0007uR-N1 for qemu-devel@nongnu.org; Wed, 23 Mar 2011 23:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2axY-0005Z4-L4 for qemu-devel@nongnu.org; Wed, 23 Mar 2011 23:11:41 -0400 Received: from e2.ny.us.ibm.com ([32.97.182.142]:55569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2axY-0005Z0-IR for qemu-devel@nongnu.org; Wed, 23 Mar 2011 23:11:40 -0400 Received: from d01dlp01.pok.ibm.com (d01dlp01.pok.ibm.com [9.56.224.56]) by e2.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p2O2qutg004514 for ; Wed, 23 Mar 2011 22:52:56 -0400 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 9A78038C8038 for ; Wed, 23 Mar 2011 23:11:34 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2O3BdWS2474128 for ; Wed, 23 Mar 2011 23:11:39 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2O3BcUG026788 for ; Thu, 24 Mar 2011 00:11:39 -0300 Message-ID: <4D8AB65F.9060108@us.ibm.com> Date: Wed, 23 Mar 2011 22:11:27 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH, RFC] virtio_blk: add cache control support References: <20110315141049.GA30627@lst.de> <20110315141644.GA30803@lst.de> <87y64fhfjw.fsf@rustcorp.com.au> <20110316140958.GB21877@lst.de> <877hbygwu7.fsf@rustcorp.com.au> <20110317142122.GA27717@lst.de> In-Reply-To: <20110317142122.GA27717@lst.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: kwolf@redhat.com, stefanha@gmail.com, Rusty Russell , linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, Christian Borntraeger , prerna@linux.vnet.ibm.com On 03/17/2011 09:21 AM, Christoph Hellwig wrote: > On Thu, Mar 17, 2011 at 03:36:08PM +1030, Rusty Russell wrote: >>> I'm happ to switch strcmp. >> Of course, that's assuming buf is nul terminated. > It's the string the user writes into it, which normally should be > nul-terminated. > >>> No, it's intentional. config space writes can't return errors, so we need >>> to check that the value has really changed. I'll add a comment explaining it. >> OK, under what circumstances could it fail? >> >> If you're using this mechanism to indicate that the host doesn't support >> the feature, that's making an assumption about the nature of config >> space writes which isn't true for non-PCI virtio. >> >> ie. lguest and S/390 don't trap writes to config space. >> >> Or perhaps they should? But we should be explicit about needing it... > We have the features flag to indicate if updating the caching mode is > supported, but we we could still fail it for other reasons - e.g. we could fail > to reopen the file with/without O_SYNC. But if lguest or S/390 don't support > trapping config space write this feature won't work for them at all. As do > other features that make use of config space write, e.g. updating the MAC > address for virtio-net. QEMU does not rely on config space writes for supporting mac address updates. Whenever the config space is updated, we update the mac address in the virtio-net structure but since PCI only supports 4 byte accesses, it will only be partially updated at certain points in time. This is okay though because as long as a guest updates it before we send a network packet out, when we refer to the mac address, it will be correct. We could just as well have the config space be in shared memory and only refer to the mac address in that shared memory area when transmitting a packet. So the fact that we respond to config space writes doesn't mean that writes have a side effect other than updating the config space, which is really what I think the important point is here. Regards, Anthony Liguori