diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2010-12-16 17:33:27 -0500 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2011-07-18 18:43:26 -0400 |
commit | c796f213a6934712ede728d9b53ef0e5066db23a (patch) | |
tree | 30fffcabfad42297b2d4b1f455a5f88ccf91091b /arch/x86/xen/multicalls.c | |
parent | f04e2ee41d3dbeb6eeb3685d1b4c208b898e278f (diff) |
xen/trace: add multicall tracing
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'arch/x86/xen/multicalls.c')
-rw-r--r-- | arch/x86/xen/multicalls.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/arch/x86/xen/multicalls.c b/arch/x86/xen/multicalls.c index b9bf19884bc5..7074c7ebfff2 100644 --- a/arch/x86/xen/multicalls.c +++ b/arch/x86/xen/multicalls.c | |||
@@ -65,6 +65,8 @@ void xen_mc_flush(void) | |||
65 | something in the middle */ | 65 | something in the middle */ |
66 | local_irq_save(flags); | 66 | local_irq_save(flags); |
67 | 67 | ||
68 | trace_xen_mc_flush(b->mcidx, b->argidx, b->cbidx); | ||
69 | |||
68 | if (b->mcidx) { | 70 | if (b->mcidx) { |
69 | #if MC_DEBUG | 71 | #if MC_DEBUG |
70 | memcpy(b->debug, b->entries, | 72 | memcpy(b->debug, b->entries, |
@@ -116,11 +118,15 @@ struct multicall_space __xen_mc_entry(size_t args) | |||
116 | struct multicall_space ret; | 118 | struct multicall_space ret; |
117 | unsigned argidx = roundup(b->argidx, sizeof(u64)); | 119 | unsigned argidx = roundup(b->argidx, sizeof(u64)); |
118 | 120 | ||
121 | trace_xen_mc_entry_alloc(args); | ||
122 | |||
119 | BUG_ON(preemptible()); | 123 | BUG_ON(preemptible()); |
120 | BUG_ON(b->argidx >= MC_ARGS); | 124 | BUG_ON(b->argidx >= MC_ARGS); |
121 | 125 | ||
122 | if (b->mcidx == MC_BATCH || | 126 | if (b->mcidx == MC_BATCH || |
123 | (argidx + args) >= MC_ARGS) { | 127 | (argidx + args) >= MC_ARGS) { |
128 | trace_xen_mc_flush_reason((b->mcidx == MC_BATCH) ? | ||
129 | XEN_MC_FL_BATCH : XEN_MC_FL_ARGS); | ||
124 | xen_mc_flush(); | 130 | xen_mc_flush(); |
125 | argidx = roundup(b->argidx, sizeof(u64)); | 131 | argidx = roundup(b->argidx, sizeof(u64)); |
126 | } | 132 | } |
@@ -145,20 +151,25 @@ struct multicall_space xen_mc_extend_args(unsigned long op, size_t size) | |||
145 | BUG_ON(preemptible()); | 151 | BUG_ON(preemptible()); |
146 | BUG_ON(b->argidx >= MC_ARGS); | 152 | BUG_ON(b->argidx >= MC_ARGS); |
147 | 153 | ||
148 | if (b->mcidx == 0) | 154 | if (unlikely(b->mcidx == 0 || |
149 | return ret; | 155 | b->entries[b->mcidx - 1].op != op)) { |
150 | 156 | trace_xen_mc_extend_args(op, size, XEN_MC_XE_BAD_OP); | |
151 | if (b->entries[b->mcidx - 1].op != op) | 157 | goto out; |
152 | return ret; | 158 | } |
153 | 159 | ||
154 | if ((b->argidx + size) >= MC_ARGS) | 160 | if (unlikely((b->argidx + size) >= MC_ARGS)) { |
155 | return ret; | 161 | trace_xen_mc_extend_args(op, size, XEN_MC_XE_NO_SPACE); |
162 | goto out; | ||
163 | } | ||
156 | 164 | ||
157 | ret.mc = &b->entries[b->mcidx - 1]; | 165 | ret.mc = &b->entries[b->mcidx - 1]; |
158 | ret.args = &b->args[b->argidx]; | 166 | ret.args = &b->args[b->argidx]; |
159 | b->argidx += size; | 167 | b->argidx += size; |
160 | 168 | ||
161 | BUG_ON(b->argidx >= MC_ARGS); | 169 | BUG_ON(b->argidx >= MC_ARGS); |
170 | |||
171 | trace_xen_mc_extend_args(op, size, XEN_MC_XE_OK); | ||
172 | out: | ||
162 | return ret; | 173 | return ret; |
163 | } | 174 | } |
164 | 175 | ||
@@ -167,8 +178,12 @@ void xen_mc_callback(void (*fn)(void *), void *data) | |||
167 | struct mc_buffer *b = &__get_cpu_var(mc_buffer); | 178 | struct mc_buffer *b = &__get_cpu_var(mc_buffer); |
168 | struct callback *cb; | 179 | struct callback *cb; |
169 | 180 | ||
170 | if (b->cbidx == MC_BATCH) | 181 | if (b->cbidx == MC_BATCH) { |
182 | trace_xen_mc_flush_reason(XEN_MC_FL_CALLBACK); | ||
171 | xen_mc_flush(); | 183 | xen_mc_flush(); |
184 | } | ||
185 | |||
186 | trace_xen_mc_callback(fn, data); | ||
172 | 187 | ||
173 | cb = &b->callbacks[b->cbidx++]; | 188 | cb = &b->callbacks[b->cbidx++]; |
174 | cb->fn = fn; | 189 | cb->fn = fn; |