Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 788b94ba authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'perf-core-for-mingo' of...

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

 into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

User visible changes:

  - Fix SIGBUS failures due to misaligned accesses in Sparc64 (David Ahern)

  - Fix branch stack mode in 'perf report' (He Kuang)

  - Fix a 'perf probe' operator precedence bug (He Kuang)

  - Fix Support for different binaries with same name in 'perf diff' (Kan Liang)

  - Check kprobes blacklist when adding new events via 'perf probe' (Masami Hiramatsu)

  - Add --purge FILE to remove all caches of FILE in 'perf buildid-cache' (Masami Hiramatsu)

  - Show usage with some incorrect params (Masami Hiramatsu)

  - Add new buildid cache if update target is not cached in 'buildid-cache' (Masami Hiramatsu)

  - Allow listing events with 'tracepoint' prefix in 'perf list' (Yunlong Song)

  - Sort the output of 'perf list' (Yunlong Song)

  - Fix bash completion of 'perf --' (Yunlong Song)

Developer Zone:

  - Handle strdup() failure path in 'perf probe' (Arnaldo Carvalho de Melo)

  - Fix get_real_path to free allocated memory in error path in 'perf probe' (Masami Hiramatsu)

  - Use pr_debug instead of verbose && pr_info perf buildid-cache (Masami Hiramatsu)

  - Fix building of 'perf data' with some gcc versions due to incorrect array struct
    entry (Yunlong Song)

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 0afb1704 fefd2d96
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -12,9 +12,9 @@ SYNOPSIS

DESCRIPTION
-----------
This command manages the build-id cache. It can add and remove files to/from
the cache. In the future it should as well purge older entries, set upper
limits for the space used by the cache, etc.
This command manages the build-id cache. It can add, remove, update and purge
files to/from the cache. In the future it should as well set upper limits for
the space used by the cache, etc.

OPTIONS
-------
@@ -36,14 +36,24 @@ OPTIONS
        actually made.
-r::
--remove=::
        Remove specified file from the cache.
        Remove a cached binary which has same build-id of specified file
        from the cache.
-p::
--purge=::
        Purge all cached binaries including older caches which have specified
	path from the cache.
-M::
--missing=::
	List missing build ids in the cache for the specified file.
-u::
--update::
	Update specified file of the cache. It can be used to update kallsyms
	kernel dso to vmlinux in order to support annotation.
--update=::
	Update specified file of the cache. Note that this doesn't remove
	older entires since those may be still needed for annotating old
	(or remote) perf.data. Only if there is already a cache which has
	exactly same build-id, that is replaced by new one. It can be used
	to update kallsyms and kernel dso to vmlinux in order to support
	annotation.

-v::
--verbose::
	Be more verbose.
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,11 @@ If no parameters are passed it will assume perf.data.old and perf.data.
The differential profile is displayed only for events matching both
specified perf.data files.

If no parameters are passed the samples will be sorted by dso and symbol.
As the perf.data files could come from different binaries, the symbols addresses
could vary. So perf diff is based on the comparison of the files and
symbols name.

OPTIONS
-------
-D::
+6 −0
Original line number Diff line number Diff line
@@ -127,6 +127,12 @@ To limit the list use:
One or more types can be used at the same time, listing the events for the
types specified.

Support raw format:

. '--raw-dump', shows the raw-dump of all the events.
. '--raw-dump [hw|sw|cache|tracepoint|pmu|event_glob]', shows the raw-dump of
  a certain kind of events.

SEE ALSO
--------
linkperf:perf-stat[1], linkperf:perf-top[1],
+61 −11
Original line number Diff line number Diff line
@@ -196,8 +196,7 @@ static int build_id_cache__add_file(const char *filename)
	build_id__sprintf(build_id, sizeof(build_id), sbuild_id);
	err = build_id_cache__add_s(sbuild_id, filename,
				    false, false);
	if (verbose)
		pr_info("Adding %s %s: %s\n", sbuild_id, filename,
	pr_debug("Adding %s %s: %s\n", sbuild_id, filename,
		 err ? "FAIL" : "Ok");
	return err;
}
@@ -216,13 +215,37 @@ static int build_id_cache__remove_file(const char *filename)

	build_id__sprintf(build_id, sizeof(build_id), sbuild_id);
	err = build_id_cache__remove_s(sbuild_id);
	if (verbose)
		pr_info("Removing %s %s: %s\n", sbuild_id, filename,
	pr_debug("Removing %s %s: %s\n", sbuild_id, filename,
		 err ? "FAIL" : "Ok");

	return err;
}

static int build_id_cache__purge_path(const char *pathname)
{
	struct strlist *list;
	struct str_node *pos;
	int err;

	err = build_id_cache__list_build_ids(pathname, &list);
	if (err)
		goto out;

	strlist__for_each(pos, list) {
		err = build_id_cache__remove_s(pos->s);
		pr_debug("Removing %s %s: %s\n", pos->s, pathname,
			 err ? "FAIL" : "Ok");
		if (err)
			break;
	}
	strlist__delete(list);

out:
	pr_debug("Purging %s: %s\n", pathname, err ? "FAIL" : "Ok");

	return err;
}

static bool dso__missing_buildid_cache(struct dso *dso, int parm __maybe_unused)
{
	char filename[PATH_MAX];
@@ -255,7 +278,7 @@ static int build_id_cache__update_file(const char *filename)
	u8 build_id[BUILD_ID_SIZE];
	char sbuild_id[BUILD_ID_SIZE * 2 + 1];

	int err;
	int err = 0;

	if (filename__read_build_id(filename, &build_id, sizeof(build_id)) < 0) {
		pr_debug("Couldn't read a build-id in %s\n", filename);
@@ -263,12 +286,13 @@ static int build_id_cache__update_file(const char *filename)
	}

	build_id__sprintf(build_id, sizeof(build_id), sbuild_id);
	if (build_id_cache__cached(sbuild_id))
		err = build_id_cache__remove_s(sbuild_id);

	if (!err)
		err = build_id_cache__add_s(sbuild_id, filename, false, false);

	if (verbose)
		pr_info("Updating %s %s: %s\n", sbuild_id, filename,
	pr_debug("Updating %s %s: %s\n", sbuild_id, filename,
		 err ? "FAIL" : "Ok");

	return err;
@@ -283,6 +307,7 @@ int cmd_buildid_cache(int argc, const char **argv,
	bool force = false;
	char const *add_name_list_str = NULL,
		   *remove_name_list_str = NULL,
		   *purge_name_list_str = NULL,
		   *missing_filename = NULL,
		   *update_name_list_str = NULL,
		   *kcore_filename = NULL;
@@ -300,6 +325,8 @@ int cmd_buildid_cache(int argc, const char **argv,
		   "file", "kcore file to add"),
	OPT_STRING('r', "remove", &remove_name_list_str, "file list",
		    "file(s) to remove"),
	OPT_STRING('p', "purge", &purge_name_list_str, "path list",
		    "path(s) to remove (remove old caches too)"),
	OPT_STRING('M', "missing", &missing_filename, "file",
		   "to find missing build ids in the cache"),
	OPT_BOOLEAN('f', "force", &force, "don't complain, do it"),
@@ -316,6 +343,11 @@ int cmd_buildid_cache(int argc, const char **argv,
	argc = parse_options(argc, argv, buildid_cache_options,
			     buildid_cache_usage, 0);

	if (argc || (!add_name_list_str && !kcore_filename &&
		     !remove_name_list_str && !purge_name_list_str &&
		     !missing_filename && !update_name_list_str))
		usage_with_options(buildid_cache_usage, buildid_cache_options);

	if (missing_filename) {
		file.path = missing_filename;
		file.force = force;
@@ -366,6 +398,24 @@ int cmd_buildid_cache(int argc, const char **argv,
		}
	}

	if (purge_name_list_str) {
		list = strlist__new(true, purge_name_list_str);
		if (list) {
			strlist__for_each(pos, list)
				if (build_id_cache__purge_path(pos->s)) {
					if (errno == ENOENT) {
						pr_debug("%s wasn't in the cache\n",
							 pos->s);
						continue;
					}
					pr_warning("Couldn't remove %s: %s\n",
						   pos->s, strerror_r(errno, sbuf, sizeof(sbuf)));
				}

			strlist__delete(list);
		}
	}

	if (missing_filename)
		ret = build_id_cache__fprintf_missing(session, stdout);

+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ static int cmd_data_convert(int argc, const char **argv,

static struct data_cmd data_cmds[] = {
	{ "convert", "converts data file between formats", cmd_data_convert },
	{ NULL },
	{ .name = NULL, },
};

int cmd_data(int argc, const char **argv, const char *prefix)
Loading