WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] LTTng-Xen Buffer shared between the hypervisor and a dom0 pr

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] LTTng-Xen Buffer shared between the hypervisor and a dom0 process
From: Mathieu Desnoyers <compudj@xxxxxxxxxxxxxxxxxx>
Date: Wed, 7 Mar 2007 14:24:48 -0500
Delivery-date: Wed, 07 Mar 2007 11:23:58 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.13 (2006-08-11)
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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel