update compat
[lttv.git] / doc / developer / xen-port.txt
CommitLineData
dd8ec0e0 1
2
3Xen port notes
4
5Mathieu Desnoyers, April 2006
6
7Useful files :
8
9common/trace.c
10include/xen/trace.h and the dom0 op in include/public/dom0_ops.h
11
12alloc buffer (alloc_trace_bufs) :
13alloc_xenheap_pages
14
15Shared buffer between dom0 and hypervisor :
16share_xen_page_with_privileged_guests
17
18
19
20trace_create / trace_destroy :
21
22call xen hooks from dom0 to allocate a new buffer, get the newly allocated
23struct trace pointer.
24Share struct traces with dom0 to have offset and consumed counts.
25Share the buffers with dom0 too.
26
27Create a new "xen" channel.
28
29
30Create 4 new xen facilities (see include/public/trace.h) :
31xen_sched (grep TRC_SCHED)
32 sched_dom_add
33 sched_dom_rem
34 sched_sleep
35 sched_wake
36 sched_yield
37 sched_block
38 sched_shutdown
39 sched_ctl
40 sched_switch
41 sched_s_timer_fn
42 sched_t_timer_fn
43 sched_dom_timer_fn
44 sched_dom_timer_fn
45 sched_switch_infprev
46 sched_switch_infnext
47xen_dom0op (grep TRC_DOM0OP)
48 dom0op_enter_base
49 dom0op_leave_base
50xen_vmx (grep TRC_VMX)
51 vmx_vmexit
52 vmx_vmentry
53 vmx_timer_intr
54 vmx_int
55 vmx_io
56xen_mem (grep TRC_MEM)
57 mem_page_grant_map
58 mem_page_grant_unmap
59 mem_page_grant_transfer
60
61
62How to share xen pages efficiently ?
63Pages allocated in xen heap, the shared with dom0.
64
65How buffers are accessed in dom0 ?
66directly from pointers to buffers contained in get_info control information.
67
68do_dom0_op
69
70tbufcontrol -> control info
71 int tb_control(dom0_tbufcontrol_t *tbc)
72
73DOM0_TBUF_GET_INFO buffer_mfn __pa(t_bufs[0]) >> PAGE_SHIFT;
74
75
76create trace :
77
78in :
79trace name
80buffer size
81return : 0 success, 1 failure
82do :
83alloc buffer xen
84share with dom0
85
86destroy trace :
87in :
88trace name
89do : unshare buffer / free.
90
91
92start/stop :
93tb_control that will update the control structure.
94in : trace name
95start : put active to 1 + inc. nb_active traces
96stop : put active to 0 + dec nb_active traces.
97return : 0 success, 1 failure.
98
99consume :
100in : trace name
101tb_control that will update the consumed count.
102in : old count.
103return : 0 success, 1 failure (pushed).
104
105get_info :
106tb_control that returns a fresh copy of trace control info.
107
108
da5d36a5 109
110NOTE 8-11-2006
111
112Xen 3.0.3
113Only one init of buffers (cannot change buffer size)
114tbc->buffer_mfn = opt_tbuf_size ? virt_to_mfn(per_cpu(t_bufs, 0)) : 0;
115/* Convert between Xen-heap virtual addresses and machine frame numbers. */
116#define virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT)
117
118struct t_buf *tbufs_mapped;
119
120 tbufs_mapped = xc_map_foreign_range(xc_handle, DOMID_XEN,
121 size * num, PROT_READ | PROT_WRITE,
122 tbufs_mfn);
123
124int fd = open("/proc/xen/privcmd", O_RDWR);
125
126/* sleep for this long (milliseconds) between checking the trace buffers */
127#define POLL_SLEEP_MILLIS 100
128
129
130netfront.c
131xenbus_alloc_evtchn
132bind_evtchn_to_irqhandler
133
134
135virq :
136
137include/public/xen.h VIRQ_TBUF
138 /* G. (DOM0) Trace buffer has records available. */
139
140trace_notify_guest : send_guest_global_virq(dom0, VIRQ_TBUF);
141
142see arch/i386/oprofile/xenoprof.c
143bind_virq
144
145
146
This page took 0.069173 seconds and 4 git commands to generate.