Re: [PATCH] [RFC] perf: robustify proc and debugfs file recording

From: Steven Rostedt
Date: Tue Jul 12 2011 - 18:57:03 EST


On Tue, 2011-07-12 at 14:15 -0700, Sonny Rao wrote:
> While attempting to create a timechart of boot up I found
> perf didn't tolerate modules being loaded/unloaded. This patch
> fixes this by reading the file once and then writing the size
> read at the correct point in the file. It also simplifies the
> code somewhat.
>
> Signed-off-by: Sonny Rao <sonnyrao@xxxxxxxxxxxx>

> static bool name_in_tp_list(char *sys, struct tracepoint_path *tps)
> @@ -338,14 +292,8 @@ static void copy_event_system(const char *sys, struct tracepoint_path *tps)
> sprintf(format, "%s/%s/format", sys, dent->d_name);
> ret = stat(format, &st);
>
> - if (ret >= 0) {
> - /* unfortunately, you can not stat debugfs files for size */
> - size = get_size(format);
> - write_or_die(&size, 8);
> - check_size = copy_file(format);
> - if (size != check_size)
> - die("error in size of file '%s'", format);

You mean to tell me that you are hitting a race between the get_size()
and check_size()? This is a very quick action, and this only happens at
start up. Are you starting up perf and loading modules at the same time?

-- Steve

> - }
> + if (ret >= 0)
> + record_file(format, 8);
>
> free(format);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/