All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Edwin Török" <edvin.torok@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: "Edwin Török" <edvin.torok@citrix.com>,
	"Christian Lindig" <christian.lindig@citrix.com>,
	"David Scott" <dave@recoil.org>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>, "Wei Liu" <wl@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Signed-off-by : Juergen Gross" <jgross@suse.com>
Subject: [PATCH v1 0/9] tools/ocaml: use gnttab instead of map_foreign_range
Date: Thu, 27 Aug 2020 18:35:51 +0100	[thread overview]
Message-ID: <cover.1598548832.git.edvin.torok@citrix.com> (raw)

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



             reply	other threads:[~2020-08-27 17:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 17:35 Edwin Török [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1598548832.git.edvin.torok@citrix.com \
    --to=edvin.torok@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=christian.lindig@citrix.com \
    --cc=dave@recoil.org \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jgross@suse.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.