Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LPyhL-00068q-1m for qemu-devel@nongnu.org; Thu, 22 Jan 2009 07:30:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LPyhK-00068V-Md for qemu-devel@nongnu.org; Thu, 22 Jan 2009 07:30:14 -0500 Received: from [199.232.76.173] (port=41998 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPyhK-00068S-G3 for qemu-devel@nongnu.org; Thu, 22 Jan 2009 07:30:14 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:10166) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LPyhK-0002lf-64 for qemu-devel@nongnu.org; Thu, 22 Jan 2009 07:30:14 -0500 Received: from mariner.uk.xensource.com ([10.80.2.22]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id n0MCUBZr022241 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 22 Jan 2009 04:30:12 -0800 Received: from iwj by mariner.uk.xensource.com with local (Exim 4.63) (envelope-from ) id 1LPyhG-0002Eu-OQ for qemu-devel@nongnu.org; Thu, 22 Jan 2009 12:30:10 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18808.26322.736884.264358@mariner.uk.xensource.com> Date: Thu, 22 Jan 2009 12:30:10 +0000 Subject: Re: [Qemu-devel] [PATCH 2/5] Add map client retry notification In-Reply-To: <1232620587-11625-3-git-send-email-avi@redhat.com> References: <1232620587-11625-1-git-send-email-avi@redhat.com> <1232620587-11625-3-git-send-email-avi@redhat.com> From: Ian Jackson 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 writes ("[Qemu-devel] [PATCH 2/5] Add map client retry notification"): > The target memory mapping API may fail if the bounce buffer resources > are exhausted. Add a notification mechanism to allow clients to retry > the mapping operation when resources become available again. Does this API not suffer from the potential deadlock described by Anthony ? Imagine that for some reason bounce buffers are in use. If we have a client which wants to do a single writev on a tap device it will even deadlock by itself: map() succeeds map() fails, NULL register_map_client but the callback will never happen because the client is effectively waiting for itself to release its own mapping. Since callers cannot assume that they can map more than one range at once (since there's only one bounce buffer), any caller which needs to do scatter-gather (like a tap device, as Anthony points out) needs to invent its own bounce buffers. That seems like a waste of effort. There should be a single bounce buffer fallback mechanism, and it should be sufficiently powerful that it can be used for tap devices, which means that the calling device emulation must present a single scatter-gather list to the API all in one go. Ian.