Skip to content

Commit

Permalink
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/acme/linux into perf/urgent

Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

  * Tag thread comm as overriden, showing the right comm for threads after forks.
    (Frederic Weisbecker)

  * Fix memory leak when processing perf.data file header. (Namhyung Kim.)

  * Don't try to free string constant used for anonymous event groups. (Namhyung Kim)

  * Fix use of multiple options in processing field in libtraceevent. (Steven Rostedt)

  * Fix conversion of pointer to integer of different size in libtraceevent.
    (Arnaldo Carvalho de Melo)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Nov 20, 2013
2 parents 0022ced + 6b5fa0b commit e98a6e5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
25 changes: 22 additions & 3 deletions tools/lib/traceevent/event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,24 @@ process_arg(struct event_format *event, struct print_arg *arg, char **tok)
static enum event_type
process_op(struct event_format *event, struct print_arg *arg, char **tok);

/*
* For __print_symbolic() and __print_flags, we need to completely
* evaluate the first argument, which defines what to print next.
*/
static enum event_type
process_field_arg(struct event_format *event, struct print_arg *arg, char **tok)
{
enum event_type type;

type = process_arg(event, arg, tok);

while (type == EVENT_OP) {
type = process_op(event, arg, tok);
}

return type;
}

static enum event_type
process_cond(struct event_format *event, struct print_arg *top, char **tok)
{
Expand Down Expand Up @@ -2371,7 +2389,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
goto out_free;
}

type = process_arg(event, field, &token);
type = process_field_arg(event, field, &token);

/* Handle operations in the first argument */
while (type == EVENT_OP)
Expand Down Expand Up @@ -2424,7 +2442,8 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
goto out_free;
}

type = process_arg(event, field, &token);
type = process_field_arg(event, field, &token);

if (test_type_token(type, token, EVENT_DELIM, ","))
goto out_free_field;

Expand Down Expand Up @@ -3446,7 +3465,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
* is in the bottom half of the 32 bit field.
*/
offset &= 0xffff;
val = (unsigned long long)(data + offset);
val = (unsigned long long)((unsigned long)data + offset);
break;
default: /* not sure what to do there */
return 0;
Expand Down
6 changes: 4 additions & 2 deletions tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -2078,8 +2078,10 @@ static int process_group_desc(struct perf_file_section *section __maybe_unused,
if (evsel->idx == (int) desc[i].leader_idx) {
evsel->leader = evsel;
/* {anon_group} is a dummy name */
if (strcmp(desc[i].name, "{anon_group}"))
if (strcmp(desc[i].name, "{anon_group}")) {
evsel->group_name = desc[i].name;
desc[i].name = NULL;
}
evsel->nr_members = desc[i].nr_members;

if (i >= nr_groups || nr > 0) {
Expand All @@ -2105,7 +2107,7 @@ static int process_group_desc(struct perf_file_section *section __maybe_unused,

ret = 0;
out_free:
while ((int) --i >= 0)
for (i = 0; i < nr_groups; i++)
free(desc[i].name);
free(desc);

Expand Down
11 changes: 5 additions & 6 deletions tools/perf/util/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,13 @@ int thread__set_comm(struct thread *thread, const char *str, u64 timestamp)
/* Override latest entry if it had no specific time coverage */
if (!curr->start) {
comm__override(curr, str, timestamp);
return 0;
} else {
new = comm__new(str, timestamp);
if (!new)
return -ENOMEM;
list_add(&new->list, &thread->comm_list);
}

new = comm__new(str, timestamp);
if (!new)
return -ENOMEM;

list_add(&new->list, &thread->comm_list);
thread->comm_set = true;

return 0;
Expand Down

0 comments on commit e98a6e5

Please sign in to comment.