| .. | .. |
|---|
| 32 | 32 | { |
|---|
| 33 | 33 | struct trace_event_call *call = &event_branch; |
|---|
| 34 | 34 | struct trace_array *tr = branch_tracer; |
|---|
| 35 | + struct trace_buffer *buffer; |
|---|
| 35 | 36 | struct trace_array_cpu *data; |
|---|
| 36 | 37 | struct ring_buffer_event *event; |
|---|
| 37 | 38 | struct trace_branch *entry; |
|---|
| 38 | | - struct ring_buffer *buffer; |
|---|
| 39 | 39 | unsigned long flags; |
|---|
| 40 | 40 | int pc; |
|---|
| 41 | 41 | const char *p; |
|---|
| .. | .. |
|---|
| 55 | 55 | |
|---|
| 56 | 56 | raw_local_irq_save(flags); |
|---|
| 57 | 57 | current->trace_recursion |= TRACE_BRANCH_BIT; |
|---|
| 58 | | - data = this_cpu_ptr(tr->trace_buffer.data); |
|---|
| 58 | + data = this_cpu_ptr(tr->array_buffer.data); |
|---|
| 59 | 59 | if (atomic_read(&data->disabled)) |
|---|
| 60 | 60 | goto out; |
|---|
| 61 | 61 | |
|---|
| 62 | 62 | pc = preempt_count(); |
|---|
| 63 | | - buffer = tr->trace_buffer.buffer; |
|---|
| 63 | + buffer = tr->array_buffer.buffer; |
|---|
| 64 | 64 | event = trace_buffer_lock_reserve(buffer, TRACE_BRANCH, |
|---|
| 65 | 65 | sizeof(*entry), flags, pc); |
|---|
| 66 | 66 | if (!event) |
|---|
| .. | .. |
|---|
| 205 | 205 | void ftrace_likely_update(struct ftrace_likely_data *f, int val, |
|---|
| 206 | 206 | int expect, int is_constant) |
|---|
| 207 | 207 | { |
|---|
| 208 | + unsigned long flags = user_access_save(); |
|---|
| 209 | + |
|---|
| 208 | 210 | /* A constant is always correct */ |
|---|
| 209 | 211 | if (is_constant) { |
|---|
| 210 | 212 | f->constant++; |
|---|
| .. | .. |
|---|
| 223 | 225 | f->data.correct++; |
|---|
| 224 | 226 | else |
|---|
| 225 | 227 | f->data.incorrect++; |
|---|
| 228 | + |
|---|
| 229 | + user_access_restore(flags); |
|---|
| 226 | 230 | } |
|---|
| 227 | 231 | EXPORT_SYMBOL(ftrace_likely_update); |
|---|
| 228 | 232 | |
|---|
| .. | .. |
|---|
| 240 | 244 | return 0; |
|---|
| 241 | 245 | } |
|---|
| 242 | 246 | |
|---|
| 243 | | -static inline long get_incorrect_percent(struct ftrace_branch_data *p) |
|---|
| 247 | +static inline long get_incorrect_percent(const struct ftrace_branch_data *p) |
|---|
| 244 | 248 | { |
|---|
| 245 | 249 | long percent; |
|---|
| 246 | 250 | |
|---|
| .. | .. |
|---|
| 328 | 332 | return p; |
|---|
| 329 | 333 | } |
|---|
| 330 | 334 | |
|---|
| 331 | | -static int annotated_branch_stat_cmp(void *p1, void *p2) |
|---|
| 335 | +static int annotated_branch_stat_cmp(const void *p1, const void *p2) |
|---|
| 332 | 336 | { |
|---|
| 333 | | - struct ftrace_branch_data *a = p1; |
|---|
| 334 | | - struct ftrace_branch_data *b = p2; |
|---|
| 337 | + const struct ftrace_branch_data *a = p1; |
|---|
| 338 | + const struct ftrace_branch_data *b = p2; |
|---|
| 335 | 339 | |
|---|
| 336 | 340 | long percent_a, percent_b; |
|---|
| 337 | 341 | |
|---|