From: Ian Campbell <ian.campbell@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>,
Roger Pau Monne <roger.pau@citrix.com>,
wei.liu2@citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH XEN v6 25/32] tools/libs/gnttab: Extensive updates to API documentation.
Date: Mon, 14 Dec 2015 11:29:06 +0000 [thread overview]
Message-ID: <1450092546.16856.38.camel@citrix.com> (raw)
In-Reply-To: <1449855359.30975.90.camel@citrix.com>
On Fri, 2015-12-11 at 17:35 +0000, Ian Campbell wrote:
> On Fri, 2015-12-11 at 17:19 +0000, Ian Jackson wrote:
> > Ian Campbell writes ("Re: [Xen-devel] [PATCH XEN v6 25/32]
> > tools/libs/gnttab: Extensive updates to API documentation."):
> > > I'm currently intending to write something very similar for each of
> > > the
> > > xen*_open (gntshr, gnttab, foreignmemory, evtchn and probably call
> > > too)
> > > functions. I don't really like repeating the same thing like this,
> > > but
> > > I
> > > also don't really like API documentation which makes you play follow
> > > the
> > > piece of string to the docs of other libraries to find out what is
> > > going
> > > on.
> >
> > That would be fine by me. But do these other functions suffer from
> > the same problem ?
> >
> > Ie, can we for gntshr et al, tell the user that they should call
> > blah_unmap ? This is not practical in a multithreaded program for
> > hypercall memory but it might well be practical for other kinds of
> > borrowed memory.
>
> Good point, I think most of the rest of them probably can support unmap
> after fork, but I've not checked (I will before I write anything).
Good thing I did.
On Linux both the gnttab and privcmd foreign mappings set VMA_DONTCOPY on
the mappings from the driver, which is the same effect as the
madvise(DONTFORK) in the hypercall buffer allocation has.
For gnttab this is obvious now I think about it, since you cannot unmap or
otherwise operate on a gntmap with normal PTE updates, you have to use
gntmap hypercalls, which core OS code like CoW handling obviously won't.
The same could be true for privcmd foreign mappings for PV guests, I think,
since the PTE update hypercall needs the foreign domid in it, which common
code wouldn't have.
So those memory regions simply won't exist in the child, and munmap would
therefore either fail or unmap whatever new thing has shown up at an
address.
So I think at least call, foreignmemory and gnttab need a
restriction/caveat like the above, which is that on fork but not exec you
can call close() and hope it does something, but unmap is off the table.
gntshr might be ok, although TBH I'm not really sure what the effect of
cow-wing memory which has been granted, nor how one ensures the desired
child/parent ends up with the actually granted memory and not a copy (IOW
it's not clear why VMA_DONTCOPY isn't applied here too). On that basis I'd
be inclined to give gntshr the same semantics as the others.
evtchn doesn't actually involve any memory mappings, and in that case
closing the fd is always fine and sufficient AFAICT, no need to disable
individual irqs first. I'm not entirely sure what the semantics of a poll
or read from both parent and child would be. I'm slightly inclined to
outlaw use in the child at the library API level. A slightly less draconian
rule would be one or the other may continue to use it, but never both.
That's all based on the Linux implementation, but the libraries need to be
LCD and so far that's pretty low... I looked at the FreeBSD privcmd, and it
didn't seem to have any obvious equivalent to VMA_DONTCOPY, but I might be
missing something (and it doesn't really matter for the library API given
Linux).
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-12-14 11:29 UTC|newest]
Thread overview: 134+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 11:21 [Qemu-devel] [Minios-devel] [PATCH v6 0/<VARIOUS>] Begin to disentangle libxenctrl and provide some stable libraries Ian Campbell
2015-12-03 11:21 ` [PATCH XEN v6 00/32] " Ian Campbell
2015-12-03 11:21 ` [PATCH XEN v6 01/32] x86/libxc: add an arch domain config parameter to xc_domain_create Ian Campbell
2015-12-09 12:21 ` Wei Liu
2015-12-03 11:21 ` [PATCH XEN v6 02/32] mce-test: do not include libxenguest internal headers Ian Campbell
2015-12-03 12:48 ` Andrew Cooper
2015-12-09 12:22 ` Wei Liu
2015-12-03 11:22 ` [PATCH XEN v6 03/32] tools/ocaml: simplify compile/link of test apps Ian Campbell
2015-12-03 11:59 ` David Scott
2015-12-09 12:22 ` Wei Liu
2015-12-03 11:22 ` [PATCH XEN v6 04/32] tools/Rules.mk: Properly handle libraries with recursive dependencies Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 05/32] tools: Refactor "xentoollog" into its own library Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 06/32] tools/libxc: Remove osdep indirection for xc_evtchn Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 07/32] tools: Refactor /dev/xen/evtchn wrappers into libxenevtchn Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 08/32] tools: Arrange to check public headers for ANSI compatiblity Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 09/32] tools/libxc: Remove osdep indirection for xc_gnt{shr, tab} Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 10/32] tools: Refactor /dev/xen/gnt{dev, shr} wrappers into libxengnttab Ian Campbell
2015-12-14 14:07 ` Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 11/32] tools/libxc: Remove osdep indirection for privcmd Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 12/32] tools: Refactor hypercall calling wrappers into libxencall Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 13/32] tools/libxc: drop xc_map_foreign_bulk_compat wrappers Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 14/32] tools: Remove xc_map_foreign_batch Ian Campbell
2015-12-09 12:22 ` Wei Liu
2015-12-10 15:21 ` George Dunlap
2015-12-11 15:42 ` Ian Campbell
2015-12-11 16:04 ` George Dunlap
2015-12-03 11:22 ` [PATCH XEN v6 15/32] tools: Implement xc_map_foreign_range(s) in terms of common helper Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 16/32] tools: Refactor foreign memory mapping into libxenforeignmemory Ian Campbell
2015-12-09 15:38 ` Ian Jackson
2015-12-03 11:22 ` [PATCH XEN v6 17/32] tools/libs/foreignmemory: provide xenforeignmemory_unmap Ian Campbell
2015-12-09 15:38 ` Ian Jackson
2015-12-03 11:22 ` [PATCH XEN v6 18/32] tools/libs/foreignmemory: use size_t for size arguments Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 19/32] tools/libs/foreignmemory: Mention restrictions on fork in docs Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 20/32] tools/libs/foreignmemory: Support err == NULL to map Ian Campbell
2015-12-09 12:22 ` Wei Liu
2015-12-09 12:31 ` Egger, Christoph
2015-12-09 12:45 ` Ian Campbell
2015-12-09 12:41 ` Ian Campbell
2015-12-09 12:56 ` Wei Liu
2015-12-09 13:15 ` Ian Campbell
2015-12-09 16:16 ` Wei Liu
2015-12-09 15:40 ` Ian Jackson
2015-12-03 11:22 ` [PATCH XEN v6 21/32] tools/libs/foreignmemory: pull array length argument to map forward Ian Campbell
2015-12-09 12:22 ` Wei Liu
2015-12-09 15:41 ` Ian Jackson
2015-12-03 11:22 ` [PATCH XEN v6 22/32] tools/libs/foreignmemory: optimise map(num==1, err==NULL) case Ian Campbell
2015-12-09 15:42 ` Ian Jackson
2015-12-11 15:56 ` Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 23/32] tools/libs/evtchn: Review and update doc comments Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 24/32] tools/libs: Clean up hard tabs Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 25/32] tools/libs/gnttab: Extensive updates to API documentation Ian Campbell
2015-12-03 18:08 ` Daniel De Graaf
2015-12-04 10:06 ` Ian Campbell
2015-12-09 12:41 ` Wei Liu
2015-12-09 13:00 ` Ian Campbell
2015-12-09 13:37 ` Wei Liu
2015-12-09 13:50 ` Andrew Cooper
2015-12-09 14:03 ` Ian Campbell
2015-12-09 16:14 ` Ian Jackson
2015-12-09 16:09 ` Ian Jackson
2015-12-09 16:25 ` Ian Campbell
2015-12-09 16:28 ` Ian Jackson
2015-12-09 17:08 ` Ian Campbell
2015-12-11 17:14 ` Ian Campbell
2015-12-11 17:19 ` Ian Jackson
2015-12-11 17:35 ` Ian Campbell
2015-12-14 11:29 ` Ian Campbell [this message]
2015-12-14 11:55 ` Ian Jackson
2015-12-03 11:22 ` [PATCH XEN v6 26/32] tools/libs/call: Update some log messages to not refer to xc Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 27/32] tools/libs/call: Describe return values and error semantics for xencall* Ian Campbell
2015-12-09 12:22 ` Wei Liu
2015-12-09 16:15 ` Ian Jackson
2015-12-03 11:22 ` [PATCH XEN v6 28/32] tools/libs/call: Avoid xc_memalign in netbsd and solaris backends Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 29/32] tools/libs/call: Use O_CLOEXEC when opening /dev/xen/privcmd on Linux Ian Campbell
2015-12-09 12:22 ` Wei Liu
2015-12-09 16:17 ` Ian Jackson
2015-12-11 17:22 ` Ian Campbell
2015-12-12 10:55 ` Roger Pau Monné
2015-12-03 11:22 ` [PATCH XEN v6 30/32] tools/libs/call: linux: avoid forking between mmap and madvise Ian Campbell
2015-12-09 12:22 ` Wei Liu
2015-12-09 16:18 ` Ian Jackson
2015-12-11 17:16 ` Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 31/32] tools: Update CFLAGS for qemu-xen to allow it to use new libraries Ian Campbell
2015-12-03 11:22 ` [PATCH XEN v6 32/32] HACK: Update Config.mk to pull all the right bits from my xenbits trees Ian Campbell
2015-12-03 11:23 ` [PATCH QEMU-XEN v6 0/8] Begin to disentangle libxenctrl and provide some stable libraries Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] " Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 1/8] xen_console: correctly cleanup primary console on teardown Ian Campbell
2015-12-03 11:23 ` Ian Campbell
2015-12-03 11:23 ` [PATCH QEMU-XEN v6 2/8] xen: Switch to libxenevtchn interface for compat shims Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] " Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 3/8] xen: Switch to libxengnttab " Ian Campbell
2015-12-03 11:23 ` Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 4/8] xen: Switch uses of xc_map_foreign_range into xc_map_foreign_pages Ian Campbell
2015-12-03 11:23 ` Ian Campbell
2015-12-04 15:26 ` [Qemu-devel] " Stefano Stabellini
2015-12-04 15:26 ` Stefano Stabellini
2015-12-09 13:41 ` Ian Campbell
2015-12-09 13:41 ` [Qemu-devel] " Ian Campbell
2015-12-09 13:56 ` Andrew Cooper
2015-12-09 13:56 ` [Qemu-devel] [Xen-devel] " Andrew Cooper
2015-12-09 14:05 ` Ian Campbell
2015-12-09 14:05 ` Ian Campbell
2015-12-11 14:26 ` Stefano Stabellini
2015-12-11 14:26 ` [Qemu-devel] " Stefano Stabellini
2015-12-11 15:23 ` Ian Campbell
2015-12-11 15:23 ` Ian Campbell
2015-12-11 16:42 ` Stefano Stabellini
2015-12-11 16:42 ` [Qemu-devel] " Stefano Stabellini
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 5/8] xen: Switch uses of xc_map_foreign_{pages, bulk} to use libxenforeignmemory API Ian Campbell
2015-12-03 11:23 ` Ian Campbell
2015-12-04 15:26 ` Stefano Stabellini
2015-12-04 15:26 ` [Qemu-devel] " Stefano Stabellini
2015-12-03 11:23 ` [PATCH QEMU-XEN v6 6/8] xen: Use stable library interfaces when they are available Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] " Ian Campbell
2015-12-04 15:31 ` Stefano Stabellini
2015-12-04 15:31 ` Stefano Stabellini
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 7/8] xen: domainbuild: reopen libxenctrl interface after forking for domain watcher Ian Campbell
2015-12-03 11:23 ` Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 8/8] xen: make it possible to build without the Xen PV domain builder Ian Campbell
2015-12-03 11:23 ` Ian Campbell
2015-12-03 11:23 ` [PATCH QEMU-XEN-TRADITIONAL v6 0/5] Begin to disentangle libxenctrl and provide some stable libraries Ian Campbell
2015-12-03 11:23 ` [PATCH QEMU-XEN-TRADITIONAL v6 1/5] qemu-xen-traditional: Use xentoollog as a separate library Ian Campbell
2015-12-03 11:23 ` [PATCH QEMU-XEN-TRADITIONAL v6 2/5] qemu-xen-traditional: Use libxenevtchn Ian Campbell
2015-12-03 11:23 ` [PATCH QEMU-XEN-TRADITIONAL v6 3/5] qemu-xen-traditional: Use libxengnttab Ian Campbell
2015-12-03 11:23 ` [PATCH QEMU-XEN-TRADITIONAL v6 4/5] qemu-xen-traditional: Add libxencall to rpath-link Ian Campbell
2015-12-03 11:23 ` [PATCH QEMU-XEN-TRADITIONAL v6 5/5] qemu-xen-traditional: Add libxenforeignmemory " Ian Campbell
2015-12-03 11:23 ` [PATCH MINI-OS v6 0/5] Begin to disentangle libxenctrl and provide some stable libraries Ian Campbell
2015-12-03 11:23 ` [PATCH MINI-OS v6 1/5] mini-os: Include libxentoollog with libxc Ian Campbell
2015-12-03 11:23 ` [PATCH MINI-OS v6 2/5] mini-os: Include libxenevtchn " Ian Campbell
2015-12-03 11:23 ` [PATCH MINI-OS v6 3/5] mini-os: Include libxengnttab " Ian Campbell
2015-12-03 11:23 ` [PATCH MINI-OS v6 4/5] mini-os: Include libxencall " Ian Campbell
2015-12-03 11:23 ` [PATCH MINI-OS v6 5/5] mini-os: Include libxenforeignmemory " Ian Campbell
2015-12-09 12:37 ` [Qemu-devel] [Minios-devel] [PATCH v6 0/<VARIOUS>] Begin to disentangle libxenctrl and provide some stable libraries Ian Campbell
2015-12-09 12:37 ` Ian Campbell
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=1450092546.16856.38.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=dgdegra@tycho.nsa.gov \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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.