dd8ec0e0 |
1 | |
2 | |
3 | Xen port notes |
4 | |
5 | Mathieu Desnoyers, April 2006 |
6 | |
7 | Useful files : |
8 | |
9 | common/trace.c |
10 | include/xen/trace.h and the dom0 op in include/public/dom0_ops.h |
11 | |
12 | alloc buffer (alloc_trace_bufs) : |
13 | alloc_xenheap_pages |
14 | |
15 | Shared buffer between dom0 and hypervisor : |
16 | share_xen_page_with_privileged_guests |
17 | |
18 | |
19 | |
20 | trace_create / trace_destroy : |
21 | |
22 | call xen hooks from dom0 to allocate a new buffer, get the newly allocated |
23 | struct trace pointer. |
24 | Share struct traces with dom0 to have offset and consumed counts. |
25 | Share the buffers with dom0 too. |
26 | |
27 | Create a new "xen" channel. |
28 | |
29 | |
30 | Create 4 new xen facilities (see include/public/trace.h) : |
31 | xen_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 |
47 | xen_dom0op (grep TRC_DOM0OP) |
48 | dom0op_enter_base |
49 | dom0op_leave_base |
50 | xen_vmx (grep TRC_VMX) |
51 | vmx_vmexit |
52 | vmx_vmentry |
53 | vmx_timer_intr |
54 | vmx_int |
55 | vmx_io |
56 | xen_mem (grep TRC_MEM) |
57 | mem_page_grant_map |
58 | mem_page_grant_unmap |
59 | mem_page_grant_transfer |
60 | |
61 | |
62 | How to share xen pages efficiently ? |
63 | Pages allocated in xen heap, the shared with dom0. |
64 | |
65 | How buffers are accessed in dom0 ? |
66 | directly from pointers to buffers contained in get_info control information. |
67 | |
68 | do_dom0_op |
69 | |
70 | tbufcontrol -> control info |
71 | int tb_control(dom0_tbufcontrol_t *tbc) |
72 | |
73 | DOM0_TBUF_GET_INFO buffer_mfn __pa(t_bufs[0]) >> PAGE_SHIFT; |
74 | |
75 | |
76 | create trace : |
77 | |
78 | in : |
79 | trace name |
80 | buffer size |
81 | return : 0 success, 1 failure |
82 | do : |
83 | alloc buffer xen |
84 | share with dom0 |
85 | |
86 | destroy trace : |
87 | in : |
88 | trace name |
89 | do : unshare buffer / free. |
90 | |
91 | |
92 | start/stop : |
93 | tb_control that will update the control structure. |
94 | in : trace name |
95 | start : put active to 1 + inc. nb_active traces |
96 | stop : put active to 0 + dec nb_active traces. |
97 | return : 0 success, 1 failure. |
98 | |
99 | consume : |
100 | in : trace name |
101 | tb_control that will update the consumed count. |
102 | in : old count. |
103 | return : 0 success, 1 failure (pushed). |
104 | |
105 | get_info : |
106 | tb_control that returns a fresh copy of trace control info. |
107 | |
108 | |