d3a1730c |
1 | |
2 | |
3 | LTTng for Xen |
4 | |
5 | Design document |
6 | |
7 | Mathieu Desnoyers, November 2006 |
8 | |
9 | Last modification : |
10 | |
11 | Only allow a single channel. Directory consumed by a lttd-xen client through |
12 | hypercalls. This design choice is made because there are no RCU lists and there |
13 | is no link between the number of CPUs seen by Xen and number of CPUs in the |
14 | dom0. |
15 | |
16 | Does better than Xentrace : |
17 | Variable size records |
18 | Easily extensible event description |
19 | // not planned : missing RCU list. Multiple active traces |
20 | Reader uses poll()-like mechanism instead of polling the buffers each 100ms. |
21 | |
22 | |
23 | * Dom0 lttd-xen process |
24 | |
25 | Does an hypercall to map the buffers. |
26 | Does an hypercall to poll for data, put to sleep by the OS. |
27 | Uses write from the mapped buffers to a file. |
28 | |
29 | |
30 | * Xen |
31 | |
32 | tb_control (hypercalls seen from dom0 OS) |
33 | - trace_create |
34 | Map a page for control information, return it for mapping by user space. (rw) |
35 | Map multiple pages for buffers. return them for mapping by user space. |
36 | (shared, read-only for consumer) |
37 | - trace_start |
38 | Activate tracing in control information. |
39 | - trace_stop |
40 | Stop tracing in control information. |
41 | - trace_destroy |
42 | wait for pending writers (is the hypervisor preemptible ? not full.) |
43 | Preemption : not full -> spinlock does not disable preemption : would deadlock |
44 | for the non irq_disable case. |
45 | volountary : poll call -> volountary. explicit __schedule call., do_yield(). |
46 | Quiescent state detection. |
47 | for_each_domain( d ) |
48 | for_each_vcpu( d, v ) |
49 | vcpu_sleep_sync(v); |
50 | destroy the channels |
51 | |
52 | Events coming from xen : |
53 | - Buffer switch |
54 | through virq sent to dom0 |
55 | |
56 | |
57 | |
58 | * Dom0 Linux OS |
59 | |
60 | Receive virq upon buffer switch. |
61 | xen_wakeup_readers handler : wakes up the readers for the channel. |
62 | |
63 | Hypercalls are autonomous from LTTng linux kernel tracing. |
64 | |
65 | on lttngxentrace create, hypercall channel_create |
66 | on lttngxentrace start, hypercall channel_start |
67 | on lttngxentrace stop, hypercall channel_stop |
68 | on lttngxentrace destroy, hypercall channel_destroy |
69 | |
70 | |
71 | * Facilities |
72 | |
73 | Export a facilities per cpu channel too. |
74 | |
75 | |
76 | Q1 : In Xen preemptible ? Full ? Volountary ? Volountary X |
77 | Q2 : How to synchronize to wait for writers to finish writing ? X |
78 | |
79 | |
80 | Number of CPUs in dom0 != number of CPUs in Xen. |
81 | CPU hotplug in kernel tracing ? Done. |
82 | |
83 | |