From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xopqy-0005qs-Bp for qemu-devel@nongnu.org; Thu, 13 Nov 2014 03:34:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xopqs-0005rA-07 for qemu-devel@nongnu.org; Thu, 13 Nov 2014 03:34:08 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:8439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xopqr-0005qy-Sn for qemu-devel@nongnu.org; Thu, 13 Nov 2014 03:34:01 -0500 Message-ID: <54646CF6.7090302@citrix.com> Date: Thu, 13 Nov 2014 09:33:58 +0100 From: =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= MIME-Version: 1.0 References: <1415807116-8375-1-git-send-email-roger.pau@citrix.com> In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] xen_disk: fix unmapping of persistent grants List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefano Stabellini Cc: Kevin Wolf , xen-devel@lists.xenproject.org, George Dunlap , qemu-devel@nongnu.org, Stefan Hajnoczi El 12/11/14 a les 18.41, Stefano Stabellini ha escrit: > On Wed, 12 Nov 2014, Roger Pau Monne wrote: >> This patch fixes two issues with persistent grants and the disk PV backend >> (Qdisk): >> >> - Don't use batch mappings when using persistent grants, doing so prevents >> unmapping single grants (the whole area has to be unmapped at once). > > The real issue is that destroy_grant cannot work with batch_maps. > One could reimplement destroy_grant to build a single array with all the > grants to unmap and make a single xc_gnttab_munmap call. > > Do you think that would be feasible? Making destroy_grant work with batch maps using the current tree structure is going to be quite complicated, because destroy_grant iterates on every entry on the tree, and doesn't know which grants belong to which regions. IMHO a simpler solution would be to introduce another tree (or list) that keeps track of grant-mapped regions, and on tear down use the data in that list to unmap the regions. This way the current tree will still be used to perform the grant_ref->vaddr translation, but on teardown the newly introduced list would be used instead. In general I was reluctant to do this because not using batch maps with persistent grants should not introduce a noticeable performance regression due to the fact that grants are only mapped once for the whole life-cycle of the virtual disk. Also, if we plan to implement indirect descriptors for Qdisk we really need to be able to unmap single grants in order to purge the list, since in that case it's not possible to keep all possible grants persistently mapped. Since this alternate solution is easy to implement I will send a new patch using this approach, then we can decide what to do. Roger.