All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/9] tools/ocaml: use gnttab instead of map_foreign_range
@ 2020-08-27 17:35 Edwin Török
  2020-08-27 17:35 ` [PATCH v1 1/9] tools/ocaml: use common macros for manipulating mmap_interface Edwin Török
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Edwin Török @ 2020-08-27 17:35 UTC (permalink / raw)
  To: xen-devel
  Cc: Edwin Török, Christian Lindig, David Scott, Ian Jackson,
	Wei Liu, Andrew Cooper, Signed-off-by : Juergen Gross

oxenstored currently depends on 2 unstable interfaces from libxenctrl:
* Xenctrl.map_foreign_range
* Xenctrl.domain_getinfo

It is desirable to reduce the use of unstable APIs in xenstored, so that
an update to the hypervisor doesn't break xenstored.

The C version of xenstored has dropped the usage of map_foreign_range in:
38eeb3864de40aa568c48f9f26271c141c62b50b tools/xenstored: Drop mapping of the ring via foreign map
This also made the MFN in oxenstored redundant, which was dropped in:
122b52230aa5b79d65e18b8b77094027faa2f8e2 tools/xenstore: don't store domU's mfn of ring page in xenstored

This series ports those commits and dependencies to oxenstored.

First of all oxenstored currently doesn't have bindings to xengnttab.
There are upstream bindings available at https://github.com/mirage/ocaml-gnt.
A reduced form of that is imported into oxenstored that removes external dependencies
such as Lwt and Io_page.

This also requires changes to xenmmap interface to make it safer: there are now 2 ways to unmap a
Xenmmap.mmap_interface, so we need to use the type system to ensure that we can't call the wrong
one.

Also cleaned up various minor issues in xenmmap bindings (e.g. allocating more bytes than necessary,
due to a confusion between bytes and words in function parameters).

I've tested that I can boot a Linux and Windows VM after these changes.

Note: I thought about replacing Xenmmap.mmap_interface with Bigarray.Array1.t. However Bigarrays
can't be unmapped at arbitrary point in time by design: they can only be GCed.
We require more precise control in oxenstored, so I retained xenmmap as it is, I don't think it can
be simplified further.

A git tree with this and the other series is available at:
https://gitlab.com/edwintorok/xen/-/compare/master...for-upstream

Edwin Török (9):
  tools/ocaml: use common macros for manipulating mmap_interface
  tools/ocaml/libs/mmap: allocate correct number of bytes
  tools/ocaml/libs/mmap: Expose stub_mmap_alloc
  tools/ocaml/libs/xb: import gnttab stubs from mirage
  tools/ocaml: safer Xenmmap interface
  tools/ocaml/xenstored: use gnttab instead of xenctrl's
    foreign_map_range
  tools/ocaml/xenstored: don't store domU's mfn of ring page
  tools/ocaml/libs/mmap: mark mmap/munmap as blocking
  tools/ocaml/libs/mmap: Clean up unused read/write

 tools/ocaml/libs/mmap/mmap_stubs.h    |  11 ++-
 tools/ocaml/libs/mmap/xenmmap.ml      |  17 +++--
 tools/ocaml/libs/mmap/xenmmap.mli     |  13 ++--
 tools/ocaml/libs/mmap/xenmmap_stubs.c |  86 ++++++++-------------
 tools/ocaml/libs/xb/xb.ml             |  10 +--
 tools/ocaml/libs/xb/xb.mli            |   4 +-
 tools/ocaml/libs/xb/xs_ring_stubs.c   |  14 ++--
 tools/ocaml/libs/xc/xenctrl.ml        |   6 +-
 tools/ocaml/libs/xc/xenctrl.mli       |   5 +-
 tools/ocaml/xenstored/Makefile        |  11 ++-
 tools/ocaml/xenstored/domain.ml       |   9 +--
 tools/ocaml/xenstored/domains.ml      |  13 ++--
 tools/ocaml/xenstored/gnt.ml          |  62 +++++++++++++++
 tools/ocaml/xenstored/gnt.mli         |  87 +++++++++++++++++++++
 tools/ocaml/xenstored/gnttab_stubs.c  | 106 ++++++++++++++++++++++++++
 tools/ocaml/xenstored/process.ml      |  16 ++--
 tools/ocaml/xenstored/xenstored.ml    |  11 +--
 17 files changed, 362 insertions(+), 119 deletions(-)
 create mode 100644 tools/ocaml/xenstored/gnt.ml
 create mode 100644 tools/ocaml/xenstored/gnt.mli
 create mode 100644 tools/ocaml/xenstored/gnttab_stubs.c

-- 
2.25.1



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-08-27 17:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-27 17:35 [PATCH v1 0/9] tools/ocaml: use gnttab instead of map_foreign_range Edwin Török
2020-08-27 17:35 ` [PATCH v1 1/9] tools/ocaml: use common macros for manipulating mmap_interface Edwin Török
2020-08-27 17:35 ` [PATCH v1 2/9] tools/ocaml/libs/mmap: allocate correct number of bytes Edwin Török
2020-08-27 17:35 ` [PATCH v1 3/9] tools/ocaml/libs/mmap: Expose stub_mmap_alloc Edwin Török
2020-08-27 17:35 ` [PATCH v1 4/9] tools/ocaml/libs/xb: import gnttab stubs from mirage Edwin Török
2020-08-27 17:35 ` [PATCH v1 5/9] tools/ocaml: safer Xenmmap interface Edwin Török
2020-08-27 17:35 ` [PATCH v1 6/9] tools/ocaml/xenstored: use gnttab instead of xenctrl's foreign_map_range Edwin Török
2020-08-27 17:35 ` [PATCH v1 7/9] tools/ocaml/xenstored: don't store domU's mfn of ring page Edwin Török
2020-08-27 17:35 ` [PATCH v1 8/9] tools/ocaml/libs/mmap: mark mmap/munmap as blocking Edwin Török
2020-08-27 17:36 ` [PATCH v1 9/9] tools/ocaml/libs/mmap: Clean up unused read/write Edwin Török

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.