]> git.baikalelectronics.ru Git - kernel.git/commit
xen/grant-table: add a mechanism to safely unmap pages that are in use
authorJennifer Herbert <jennifer.herbert@citrix.com>
Tue, 9 Dec 2014 18:28:37 +0000 (18:28 +0000)
committerDavid Vrabel <david.vrabel@citrix.com>
Wed, 28 Jan 2015 14:03:14 +0000 (14:03 +0000)
commitff299e3ea267ee64f93d48d204f058f87ad7bb87
treef92be430b64202bce20f597e121f23a111cc3493
parent81938b9f0d628839a29b725d747d2f96c431a6b8
xen/grant-table: add a mechanism to safely unmap pages that are in use

Introduce gnttab_unmap_refs_async() that can be used to safely unmap
pages that may be in use (ref count > 1).  If the pages are in use the
unmap is deferred and retried later.  This polling is not very clever
but it should be good enough if the cases where the delay is necessary
are rare.

The initial delay is 5 ms and is increased linearly on each subsequent
retry (to reduce load if the page is in use for a long time).

This is needed to allow block backends using grant mapping to safely
use network storage (block or filesystem based such as iSCSI or NFS).

The network storage driver may complete a block request whilst there
is a queued network packet retry (because the ack from the remote end
races with deciding to queue the retry).  The pages for the retried
packet would be grant unmapped and the network driver (or hardware)
would access the unmapped page.

Signed-off-by: Jennifer Herbert <jennifer.herbert@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
drivers/xen/grant-table.c
include/xen/grant_table.h