From: Mathieu Desnoyers <compudj@krystal.dyndns.org>
To: xen-devel@lists.xensource.com
Subject: LTTng-Xen Buffer shared between the hypervisor and a dom0 process
Date: Wed, 7 Mar 2007 14:24:48 -0500 [thread overview]
Message-ID: <20070307192448.GA23656@Krystal> (raw)
Hi,
My LTTng-for-Xen implementation is almost ready, except for one detail :
I would like to free a memory region shared between the hypervisor and
lttd-xen (a dom0 process). Ideally, it should be freed when the process
unmaps the memory, is killed or exits.
In my current implementation,
The hypervisor allocates the buffer upon trace creation hypercall :
/* Share pages so that lttd-xen can map them. */
for ( i = 0; i < nr_pages; i++ )
share_xen_page_with_privileged_guests(
virt_to_page(rawbuf) + i, XENSHARE_writable);
the process maps the memory with :
buffer = xc_map_foreign_range(xc_handle, DOMID_XEN,
pair->num_cpus * pair->n_subbufs * pair->subbuf_size,
PROT_READ, pair->mfn);
Then, I would like to release some kind of reference count of this
mapping from the hypervisor. I do the following which results in page
faults (probably because it tries to free memory still accessed by
lttd-xen) :
free_xenheap_pages(
rawbuf,
get_order_from_bytes(chan->alloc_size * num_possible_cpus()));
And then, when we are sure that no more data can be written in the
buffer, lttd-xen is ready to exit. It unmaps the buffer just before exit :
err_ret = munmap(pair->mmap, pair->subbuf_size * pair->n_subbufs);
Do you know any proper way to achieve what I am looking for ?
Thanks,
Mathieu
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next reply other threads:[~2007-03-07 19:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-07 19:24 Mathieu Desnoyers [this message]
2007-03-08 7:51 ` LTTng-Xen Buffer shared between the hypervisor and a dom0 process Keir Fraser
2007-03-08 9:26 ` Mathieu Desnoyers
2007-03-08 10:02 ` Keir Fraser
2007-03-08 19:30 ` Mathieu Desnoyers
2007-03-09 9:11 ` Keir Fraser
2007-03-10 3:02 ` Mathieu Desnoyers
2007-03-10 17:18 ` Keir Fraser
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=20070307192448.GA23656@Krystal \
--to=compudj@krystal.dyndns.org \
--cc=xen-devel@lists.xensource.com \
/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.