Skip to content

xen: fix many long-standing grant mapping bugs

David Vrabel netdev xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest14 patches 17 repliesIn review
  2. v1 RFC12 patches 21 repliesSuperseded

Changes in v2 from the cover letter

- Add find_page() VMA op instead of pages field (so struct vm_area_struct doesn't increase in size.
- Make foreign page tracking arch-independant and improve the API.
- Alloc extra memory (for 32-bit archs) for the (domain, gref) when allocating the page (instead of during the map).
- Convert gntdev's lock to a mutex.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14mm: provide a find_page vma operationinclude/linux/mm.h mm/memory.c+5 -00 replies
2/14mm: add 'foreign' alias for the 'pinned' page flaginclude/linux/page-flags.h+2 -00 replies
3/14xen/grant-table: pre-populate kernel unmap ops for xen_gnttab_unmap_refs()arch/arm/include/asm/xen/page.h arch/arm/xen/p2m.c arch/x86/include/asm/xen/page.h +4 more+34 -250 replies
4/14xen: remove scratch frames for ballooned pages and m2p overridearch/x86/include/asm/xen/page.h arch/x86/xen/p2m.c drivers/xen/balloon.c+14 -3440 replies
5/14x86/xen: require ballooned pages for grant mapsarch/x86/xen/p2m.c drivers/net/xen-netback/netback.c+3 -80 replies
6/14xen/grant-table: add helpers for allocating pagesdrivers/block/xen-blkback/blkback.c drivers/net/xen-netback/interface.c drivers/xen/gntdev.c +3 more+42 -130 replies
7/14xen: mark grant mapped pages as foreignarch/x86/xen/p2m.c drivers/xen/grant-table.c include/xen/grant_table.h+61 -93 replies
8/14xen-netback: use foreign page information from the pages themselvesdrivers/net/xen-netback/netback.c+9 -917 replies
9/14xen/grant-table: add a mechanism to safely unmap pages that are in usedrivers/xen/grant-table.c include/xen/grant_table.h+62 -02 replies
10/14xen/gntdev: convert priv->lock to a mutexdrivers/xen/gntdev.c+20 -200 replies
11/14xen/gntdev: safely unmap grants in case they are still in usedrivers/xen/gntdev.c+31 -50 replies
12/14xen-blkback: safely unmap grants in case they are still in usedrivers/block/xen-blkback/blkback.c drivers/block/xen-blkback/common.h+103 -45 replies
13/14xen/gntdev: mark userspace PTEs as special on x86 PV guestsdrivers/xen/gntdev.c include/xen/interface/features.h include/xen/interface/grant_table.h+43 -20 replies
14/14xen/gntdev: provide find_page VMA operationdrivers/xen/gntdev.c+12 -00 replies

Reviews trailers per patch

1 of 14 patches has a Reviewed-by or Acked-by.

PatchDavid S. Miller
1/14
2/14
3/14
4/14
5/14
6/14
7/14
8/14A-b A-b
9/14
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCHv2 00/14] xen: fix many long-standing grant mapping bugs

This series fixes a number of long-standing bugs in the handling of grant maps. Refer to the following for all the details.

http://xenbits.xen.org/people/dvrabel/grant-improvements-C.pdf

In summary, the important uses that this enables are:

1. Block backends can use networked storage safely.

2. Block backends can use network storage provided by other guests on the same host.

3. User space block backends can use direct I/O or asynchronous I/O.

The first two patches are the core MM changes necessary. I shall be sending these to the MM maintainers seperately.

Patches #3 and #4 remove existing (broken) mechanisms. This does temporarily break some previously working use cases, but it does make the subsequent additions much easier to review.

As a happy side effect, performance is also likely to be improved in some areas (but I've not got any measurements yet). User space backends using grant mapping should see some good improvements from reduced overheads and better unmap batching. VIF to VIF network traffic may also see a small improvement.

Finally, thanks to Jenny who did much of the implementation.

Changes in v2:
- Add find_page() VMA op instead of pages field (so struct vm_area_struct doesn't increase in size.
- Make foreign page tracking arch-independant and improve the API.
- Alloc extra memory (for 32-bit archs) for the (domain, gref) when allocating the page (instead of during the map).
- Convert gntdev's lock to a mutex.

David