License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 15:07:57 +01:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-24 15:14:12 -03:00
|
|
|
|
2017-04-18 12:26:44 -03:00
|
|
|
|
2017-04-18 10:46:11 -03:00
|
|
|
|
2010-05-20 12:15:33 -03:00
|
|
|
|
2017-04-19 20:57:47 -03:00
|
|
|
|
|
|
|
|
|
2019-09-24 15:14:12 -03:00
|
|
|
|
2019-08-30 09:43:25 -03:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
|
|
|
|
|
2019-01-22 11:24:34 -02:00
|
|
|
|
2019-01-27 13:42:37 +01:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
2017-04-19 21:34:35 -03:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
2010-07-30 18:28:42 -03:00
|
|
|
|
2011-11-25 08:19:45 -02:00
|
|
|
|
2011-11-28 08:30:20 -02:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2017-04-18 11:33:48 -03:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
2017-04-18 10:57:25 -03:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
2020-08-13 10:22:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tools perf: Move from sane_ctype.h obtained from git to the Linux's original
We got the sane_ctype.h headers from git and kept using it so far, but
since that code originally came from the kernel sources to the git
sources, perhaps its better to just use the one in the kernel, so that
we can leverage tools/perf/check_headers.sh to be notified when our copy
gets out of sync, i.e. when fixes or goodies are added to the code we've
copied.
This will help with things like tools/lib/string.c where we want to have
more things in common with the kernel, such as strim(), skip_spaces(),
etc so as to go on removing the things that we have in tools/perf/util/
and instead using the code in the kernel, indirectly and removing things
like EXPORT_SYMBOL(), etc, getting notified when fixes and improvements
are made to the original code.
Hopefully this also should help with reducing the difference of code
hosted in tools/ to the one in the kernel proper.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-7k9868l713wqtgo01xxygn12@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-06-25 17:27:31 -03:00
|
|
|
|
2019-07-04 11:32:27 -03:00
|
|
|
|
2020-11-26 18:00:08 +01:00
|
|
|
|
2020-10-13 21:24:36 +02:00
|
|
|
|
2014-11-07 22:57:56 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-12 13:46:55 -07:00
|
|
|
|
2012-08-07 16:56:05 +04:00
|
|
|
|
2013-08-27 11:23:06 +03:00
|
|
|
|
2025-07-24 09:32:44 -07:00
|
|
|
|
2012-08-07 16:56:05 +04:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
|
|
|
|
|
2013-08-27 11:23:06 +03:00
|
|
|
|
2014-05-12 09:56:42 +09:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-08 16:28:03 -07:00
|
|
|
|
2018-04-24 11:58:56 -03:00
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
2023-06-08 16:28:03 -07:00
|
|
|
|
2025-07-24 09:32:44 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
perf machine: Protect the machine->threads with a rwlock
In addition to using refcounts for the struct thread lifetime
management, we need to protect access to machine->threads from
concurrent access.
That happens in 'perf top', where a thread processes events, inserting
and deleting entries from that rb_tree while another thread decays
hist_entries, that end up dropping references and ultimately deleting
threads from the rb_tree and releasing its resources when no further
hist_entry (or other data structures, like in 'perf sched') references
it.
So the rule is the same for refcounts + protected trees in the kernel,
get the tree lock, find object, bump the refcount, drop the tree lock,
return, use object, drop the refcount if no more use of it is needed,
keep it if storing it in some other data structure, drop when releasing
that data structure.
I.e. pair "t = machine__find(new)_thread()" with a "thread__put(t)", and
"perf_event__preprocess_sample(&al)" with "addr_location__put(&al)".
The addr_location__put() one is because as we return references to
several data structures, we may end up adding more reference counting
for the other data structures and then we'll drop it at
addr_location__put() time.
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-bs9rt4n0jw3hi9f3zxyy3xln@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-04-06 20:43:22 -03:00
|
|
|
|
2010-02-03 16:52:04 -02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2012-10-27 23:18:28 +02:00
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2012-10-27 23:18:28 +02:00
|
|
|
|
2025-09-18 10:24:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
|
|
|
|
|
2020-11-02 00:31:02 +01:00
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2012-10-27 23:18:28 +02:00
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2015-08-15 20:42:59 +09:00
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:45 -07:00
|
|
|
|
2015-08-15 20:42:59 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 21:24:35 +02:00
|
|
|
|
2015-08-15 20:42:59 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2015-08-15 20:42:59 +09:00
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2015-08-15 20:42:59 +09:00
|
|
|
|
2025-07-24 09:32:45 -07:00
|
|
|
|
2015-08-15 20:42:59 +09:00
|
|
|
|
|
|
|
|
|
2025-11-24 10:59:08 +00:00
|
|
|
|
2015-08-15 20:42:59 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2015-08-15 20:42:59 +09:00
|
|
|
|
|
|
|
|
|
2015-02-10 18:18:53 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-07 03:54:38 +00:00
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-07 03:54:38 +00:00
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
2015-02-10 18:18:53 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-16 16:05:46 +08:00
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-22 15:06:20 +02:00
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-22 15:06:20 +02:00
|
|
|
|
|
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
2017-03-22 15:06:20 +02:00
|
|
|
|
|
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-12 19:04:54 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2016-07-12 19:04:54 +09:00
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2016-07-12 19:04:54 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:13 +01:00
|
|
|
|
|
|
|
|
|
2010-05-20 12:15:33 -03:00
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-20 12:15:33 -03:00
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
2010-05-20 12:15:33 -03:00
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:46 -07:00
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-20 12:15:33 -03:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2020-11-26 18:00:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 21:24:39 +02:00
|
|
|
|
2017-07-17 21:25:39 -07:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2019-08-28 15:57:16 +02:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2024-11-26 19:13:31 -08:00
|
|
|
|
2024-09-09 13:37:37 -07:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2020-10-13 21:24:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2024-11-26 19:13:31 -08:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2017-07-17 21:25:38 -07:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
|
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
|
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
|
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
|
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
2025-07-24 09:32:46 -07:00
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2015-05-28 13:06:42 -03:00
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
|
|
|
|
|
2015-05-28 13:06:42 -03:00
|
|
|
|
|
|
|
|
|
2024-04-09 23:42:05 -07:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2017-07-17 21:25:39 -07:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-06 11:18:14 -08:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-07 22:57:56 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
2017-04-18 12:20:19 -03:00
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-04-18 12:20:19 -03:00
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-10 14:17:25 -05:00
|
|
|
|
|
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
2016-07-12 19:04:54 +09:00
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-12 19:04:54 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-02-10 14:17:25 -05:00
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
2016-07-12 19:04:54 +09:00
|
|
|
|
|
|
|
|
|
2016-07-01 17:03:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
perf probe: Support @BUILDID or @FILE suffix for SDT events
Support @BUILDID or @FILE suffix for SDT events. This allows perf to add
probes on SDTs/pre-cached events on given FILE or the file which has
given BUILDID (also, this complements BUILDID.)
For example, both gcc and libstdc++ has same SDTs as below. If you
would like to add a probe on sdt_libstdcxx:catch on gcc, you can do as
below.
----
# perf list sdt | tail -n 6
sdt_libstdcxx:catch@/usr/bin/gcc(0cc207fc4b27) [SDT event]
sdt_libstdcxx:catch@/usr/lib64/libstdc++.so.6.0.20(91c7a88fdf49)
sdt_libstdcxx:rethrow@/usr/bin/gcc(0cc207fc4b27) [SDT event]
sdt_libstdcxx:rethrow@/usr/lib64/libstdc++.so.6.0.20(91c7a88fdf49)
sdt_libstdcxx:throw@/usr/bin/gcc(0cc207fc4b27) [SDT event]
sdt_libstdcxx:throw@/usr/lib64/libstdc++.so.6.0.20(91c7a88fdf49)
# perf probe -a %sdt_libstdcxx:catch@0cc
Added new event:
sdt_libstdcxx:catch (on %catch in /usr/bin/gcc)
You can now use it in all perf tools, such as:
perf record -e sdt_libstdcxx:catch -aR sleep 1
----
Committer note:
Doing the full sequence of steps to get the results above:
With a clean build-id cache:
[root@jouet ~]# rm -rf ~/.debug/
[root@jouet ~]# perf list sdt
List of pre-defined events (to be used in -e):
[root@jouet ~]#
No events whatsoever, then, we can add all events in gcc to the build-id
cache, doing a --add + --dry-run:
[root@jouet ~]# perf probe --dry-run --cache -x /usr/bin/gcc --add %sdt_libstdcxx:\*
Added new events:
sdt_libstdcxx:throw (on %* in /usr/bin/gcc)
sdt_libstdcxx:rethrow (on %* in /usr/bin/gcc)
sdt_libstdcxx:catch (on %* in /usr/bin/gcc)
You can now use it in all perf tools, such as:
perf record -e sdt_libstdcxx:catch -aR sleep 1
[root@jouet ~]#
It really didn't add any events, it just cached them:
[root@jouet ~]# perf probe -l
[root@jouet ~]#
We can see that it was cached as:
[root@jouet ~]# ls -la ~/.debug/usr/bin/gcc/9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2/
total 976
drwxr-xr-x. 2 root root 4096 Jul 13 21:47 .
drwxr-xr-x. 3 root root 4096 Jul 13 21:47 ..
-rwxr-xr-x. 4 root root 985912 Jun 22 18:52 elf
-rw-r--r--. 1 root root 303 Jul 13 21:47 probes
[root@jouet ~]# file ~/.debug/usr/bin/gcc/9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2/elf
/root/.debug/usr/bin/gcc/9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2/elf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2, stripped
[root@jouet ~]# cat ~/.debug/usr/bin/gcc/9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2/probes
%sdt_libstdcxx:throw=throw
p:sdt_libstdcxx/throw /usr/bin/gcc:0x71ffd
%sdt_libstdcxx:rethrow=rethrow
p:sdt_libstdcxx/rethrow /usr/bin/gcc:0x720b8
%sdt_libstdcxx:catch=catch
p:sdt_libstdcxx/catch /usr/bin/gcc:0x7307f
%sdt_libgcc:unwind=unwind
p:sdt_libgcc/unwind /usr/bin/gcc:0x7eec0
#sdt_libstdcxx:*=%*
[root@jouet ~]#
Ok, now we can use 'perf probe' to refer to those cached entries as:
Humm, nope, doing as above we end up with:
[root@jouet ~]# perf probe -a %sdt_libstdcxx:catch
Semantic error :* is bad for event name -it must follow C symbol-naming rule.
Error: Failed to add events.
[root@jouet ~]#
But it worked at some point, lets try not using --dry-run:
Resetting everything:
# rm -rf ~/.debug/
# perf probe -d *:*
# perf probe -l
# perf list sdt
List of pre-defined events (to be used in -e):
#
Ok, now it cached everything, even things we haven't asked it to
(sdt_libgcc:unwind):
[root@jouet ~]# perf probe -x /usr/bin/gcc --add %sdt_libstdcxx:\*
Added new events:
sdt_libstdcxx:throw (on %* in /usr/bin/gcc)
sdt_libstdcxx:rethrow (on %* in /usr/bin/gcc)
sdt_libstdcxx:catch (on %* in /usr/bin/gcc)
You can now use it in all perf tools, such as:
perf record -e sdt_libstdcxx:catch -aR sleep 1
[root@jouet ~]# perf list sdt
List of pre-defined events (to be used in -e):
sdt_libgcc:unwind [SDT event]
sdt_libstdcxx:catch [SDT event]
sdt_libstdcxx:rethrow [SDT event]
sdt_libstdcxx:throw [SDT event]
[root@jouet ~]#
And we have the events in place:
[root@jouet ~]# perf probe -l
sdt_libstdcxx:catch (on execute_cfa_program+1551@../../../libgcc/unwind-dw2.c in /usr/bin/gcc)
sdt_libstdcxx:rethrow (on d_print_subexpr+280@libsupc++/cp-demangle.c in /usr/bin/gcc)
sdt_libstdcxx:throw (on d_print_subexpr+93@libsupc++/cp-demangle.c in /usr/bin/gcc)
[root@jouet ~]#
And trying to use them at least has 'perf trace --event sdt*:*' working.
Then, if we try to add the ones in libstdc++:
[root@jouet ~]# perf probe -x /usr/lib64/libstdc++.so.6 -a %sdt_libstdcxx:\*
Error: event "catch" already exists.
Hint: Remove existing event by 'perf probe -d'
or force duplicates by 'perf probe -f'
or set 'force=yes' in BPF source.
Error: Failed to add events.
[root@jouet ~]#
Doesn't work, dups, but at least this served to, unbeknownst to the user, add
the SDT probes in /usr/lib64/libstdc++.so.6!
[root@jouet ~]# perf list sdt
List of pre-defined events (to be used in -e):
sdt_libgcc:unwind [SDT event]
sdt_libstdcxx:catch@/usr/bin/gcc(9a0730e2bcc6) [SDT event]
sdt_libstdcxx:catch@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
sdt_libstdcxx:rethrow@/usr/bin/gcc(9a0730e2bcc6) [SDT event]
sdt_libstdcxx:rethrow@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
sdt_libstdcxx:throw@/usr/bin/gcc(9a0730e2bcc6) [SDT event]
sdt_libstdcxx:throw@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
[root@jouet ~]#
Now we should be able to get to the original cset comment, if we remove all
SDTs events in place, not from the cache, from the kernel, where it was set up as:
[root@jouet ~]# ls -la /sys/kernel/debug/tracing/events/sdt_libstdcxx/
total 0
drwxr-xr-x. 5 root root 0 Jul 13 22:00 .
drwxr-xr-x. 80 root root 0 Jul 13 21:56 ..
drwxr-xr-x. 2 root root 0 Jul 13 22:00 catch
-rw-r--r--. 1 root root 0 Jul 13 22:00 enable
-rw-r--r--. 1 root root 0 Jul 13 22:00 filter
drwxr-xr-x. 2 root root 0 Jul 13 22:00 rethrow
drwxr-xr-x. 2 root root 0 Jul 13 22:00 throw
[root@jouet ~]#
[root@jouet ~]# head -2 /sys/kernel/debug/tracing/events/sdt_libstdcxx/throw/format
name: throw
ID: 2059
[root@jouet ~]#
Now to remove it:
[root@jouet ~]# perf probe -d sdt_libstdc*:*
Removed event: sdt_libstdcxx:catch
Removed event: sdt_libstdcxx:rethrow
Removed event: sdt_libstdcxx:throw
[root@jouet ~]#
Which caused:
[root@jouet ~]# ls -la /sys/kernel/debug/tracing/events/sdt_libstdcxx/
ls: cannot access '/sys/kernel/debug/tracing/events/sdt_libstdcxx/': No such file or directory
[root@jouet ~]#
Ok, now we can do:
[root@jouet ~]# perf list sdt_libstdcxx:catch
List of pre-defined events (to be used in -e):
sdt_libstdcxx:catch@/usr/bin/gcc(9a0730e2bcc6) [SDT event]
sdt_libstdcxx:catch@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
[root@jouet ~]#
So, these are not really 'pre-defined events', i.e. we can't use them with
'perf record --event':
[root@jouet ~]# perf record --event sdt_libstdcxx:catch*
event syntax error: 'sdt_libstdcxx:catch*'
\___ unknown tracepoint
Error: File /sys/kernel/debug/tracing/events/sdt_libstdcxx/catch* not found.
Hint: Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
<SNIP>
[root@jouet ~]#
To have it really pre-defined we must use perf probe to get its definition from
the cache and set it up in the kernel, creating the tracepoint to _then_ use it
with 'perf record --event':
[root@jouet ~]# perf probe -a sdt_libstdcxx:catch
Semantic error :There is non-digit char in line number.
<SNIP>
Oops, there is another gotcha here, we need that pesky '%' character:
[root@jouet ~]# perf probe -a %sdt_libstdcxx:catch
Added new events:
sdt_libstdcxx:catch (on %catch in /usr/bin/gcc)
sdt_libstdcxx:catch_1 (on %catch in /usr/lib64/libstdc++.so.6.0.22)
You can now use it in all perf tools, such as:
perf record -e sdt_libstdcxx:catch_1 -aR sleep 1
[root@jouet ~]#
But then we added _two_ events, one with the name we expected, the other one
with a _ added, when doing the analysis we need to pay attention to who maps to
who.
And here is where we get to the point of this patch, which is to be able to
disambiguate those definitions for 'catch' in the build-id cache, but first we need
remove those events we just added:
[root@jouet ~]# perf probe -d %sdt_libstdcxx:catch
Oops, that didn't remove anything, we need to _remove_ that % char in this case:
[root@jouet ~]# perf probe -d sdt_libstdcxx:catch
Removed event: sdt_libstdcxx:catch
And we need to remove the other event added, i.e. I forgot to add a * at the end:
[root@jouet ~]# perf probe -d sdt_libstdcxx:catch*
Removed event: sdt_libstdcxx:catch_1
[root@jouet ~]#
Ok, disambiguating it using what is in this patch:
[root@jouet ~]# perf list sdt_libstdcxx:catch
List of pre-defined events (to be used in -e):
sdt_libstdcxx:catch@/usr/bin/gcc(9a0730e2bcc6) [SDT event]
sdt_libstdcxx:catch@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
[root@jouet ~]#
[root@jouet ~]# perf probe -a %sdt_libstdcxx:catch@9a07
Added new event:
sdt_libstdcxx:catch (on %catch in /usr/bin/gcc)
You can now use it in all perf tools, such as:
perf record -e sdt_libstdcxx:catch -aR sleep 1
[root@jouet ~]# perf probe -l
sdt_libstdcxx:catch (on execute_cfa_program+1551@../../../libgcc/unwind-dw2.c in /usr/bin/gcc)
[root@jouet ~]#
Yeah, it works! But we need to try and simplify this :-)
Update: Some aspects of this simplification take place in the following
patches.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831793746.17065.13065062753978236612.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-12 19:05:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-08 18:29:30 +09:00
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
|
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
2023-08-24 19:40:01 -07:00
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
|
|
|
|
|
2022-07-11 12:31:52 +03:00
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
2022-07-11 12:31:52 +03:00
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
|
|
|
|
|
2023-08-24 19:40:01 -07:00
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2016-05-11 22:52:17 +09:00
|
|
|
|
|
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
2016-05-11 22:52:17 +09:00
|
|
|
|
|
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-12 12:19:09 -03:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
|
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
2016-09-23 17:38:40 +03:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-13 10:22:04 +02:00
|
|
|
|
|
|
|
|
|
2022-08-12 13:42:56 +02:00
|
|
|
|
2022-08-12 13:43:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-12 13:42:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-13 10:22:04 +02:00
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:22 +01:00
|
|
|
|
|
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:22 +01:00
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
|
|
|
|
|
2022-02-11 02:34:06 -08:00
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
perf buildid-cache: Fix the file mode with copyfile() while adding file to build-id cache
The test "build id cache operations" fails on powerpc as below:
Adding 5a0fd882b53084224ba47b624c55a469 ./tests/shell/../pe-file.exe: Ok
build id: 5a0fd882b53084224ba47b624c55a469
link: /tmp/perf.debug.ZTu/.build-id/5a/0fd882b53084224ba47b624c55a469
file: /tmp/perf.debug.ZTu/.build-id/5a/../../root/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf
failed: file /tmp/perf.debug.ZTu/.build-id/5a/../../root/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf does not exist
test child finished with -1
---- end ----
build id cache operations: FAILED!
The failing test is when trying to add pe-file.exe to build id cache.
'perf buildid-cache' can be used to add/remove/manage files from the
build-id cache. "-a" option is used to add a file to the build-id cache.
Simple command to do so for a PE exe file:
# ls -ltr tests/pe-file.exe
-rw-r--r--. 1 root root 75595 Jan 10 23:35 tests/pe-file.exe
The file is in home directory.
# mkdir /tmp/perf.debug.TeY1
# perf --buildid-dir /tmp/perf.debug.TeY1 buildid-cache -v -a tests/pe-file.exe
The above will create ".build-id" folder in build id directory, which is
/tmp/perf.debug.TeY1. Also adds file to this folder under build id.
Example:
# ls -ltr /tmp/perf.debug.TeY1/.build-id/5a/0fd882b53084224ba47b624c55a469/
total 76
-rw-r--r--. 1 root root 0 Jan 11 00:38 probes
-rwxr-xr-x. 1 root root 75595 Jan 11 00:38 elf
We can see in the results that file mode for original file and file in
build id directory is different. ie, build id file has executable
permission whereas original file doesn’t have.
The code path and function (build_id_cache__add to add a file to the
cache is in "util/build-id.c". In build_id_cache__add() function, it
first attempts to link the original file to destination cache folder.
If linking the file fails (which can happen if the destination and
source is on a different mount points), it will copy the file to
destination. Here copyfile() routine explicitly uses mode as "755" and
hence file in the destination will have executable permission.
Code snippet:
if (link(realname, filename) && errno != EEXIST && copyfile(name, filename))
strace logs:
172285 link("/home/<user_name>/linux/tools/perf/tests/pe-file.exe", "/tmp/perf.debug.TeY1/home/<user_name>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/elf") = -1 EXDEV (Invalid cross-device link)
172285 newfstatat(AT_FDCWD, "tests/pe-file.exe", {st_mode=S_IFREG|0644, st_size=75595, ...}, 0) = 0
172285 openat(AT_FDCWD, "/tmp/perf.debug.TeY1/home/<user_name>/linux/tools/perf/tests/pe-file.exe/5a0fd882b53084224ba47b624c55a469/.elf.KbAnsl", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
172285 fchmod(3, 0755) = 0
172285 openat(AT_FDCWD, "tests/pe-file.exe", O_RDONLY) = 4
172285 mmap(NULL, 75595, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7fffa5cd0000
172285 pwrite64(3, "MZ\220\0\3\0\0\0\4\0\0\0\377\377\0\0\270\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 75595, 0) = 75595
Whereas if the link succeeds, it succeeds in the first attempt itself
and the file in the build-id dir will have same permission as original
file.
Example, above uses /tmp. Instead if we use "--buildid-dir /home/build",
linking will work here since mount points are same. Hence the
destination file will not have executable permission.
Since the testcase "tests/shell/buildid.sh" always looks for executable
file, test fails in powerpc environment when test is run from /root.
The patch adds a change in build_id_cache__add() to use copyfile_mode()
which also passes the file’s original mode as argument. This way the
destination file mode also will be same as original file.
Signed-off-by: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Disha Goel <disgoel@linux.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20230116050131.17221-1-atrajeev@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2023-01-16 10:31:30 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-11 02:34:06 -08:00
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
2015-02-10 18:18:53 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-10 18:18:53 +09:00
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2020-11-26 18:00:11 +01:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2020-11-26 18:00:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-16 23:24:52 +00:00
|
|
|
|
2020-11-26 18:00:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
|
|
|
|
|
2016-09-23 17:38:40 +03:00
|
|
|
|
2016-07-01 17:04:10 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2017-07-05 18:48:13 -07:00
|
|
|
|
2015-02-27 13:50:26 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 21:24:36 +02:00
|
|
|
|
2017-07-05 18:48:11 -07:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2015-07-15 18:14:28 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2025-07-24 09:32:43 -07:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2015-02-26 15:54:40 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
2015-02-26 15:54:40 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-10 18:18:51 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-10 18:18:53 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
2015-02-10 18:18:53 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-10 18:18:53 +09:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-21 15:51:44 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-24 10:59:08 +00:00
|
|
|
|
2022-06-21 15:51:44 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:45 -07:00
|
|
|
|
2022-08-26 09:42:38 -07:00
|
|
|
|
2022-06-21 15:51:44 +03:00
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
|
|
|
|
|
2022-08-26 09:42:38 -07:00
|
|
|
|
2022-06-21 15:51:44 +03:00
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
2022-08-26 09:42:38 -07:00
|
|
|
|
|
|
|
|
|
2022-06-21 15:51:44 +03:00
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:19 +01:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2016-05-29 00:15:37 +09:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2025-07-31 00:03:30 -07:00
|
|
|
|
2020-11-26 18:00:19 +01:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2018-02-15 13:26:30 +01:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2022-06-21 15:51:44 +03:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-21 15:51:44 +03:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
|
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
2024-05-04 14:38:01 -07:00
|
|
|
|
2022-07-11 12:31:51 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:19 +01:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2020-11-26 18:00:19 +01:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2020-11-26 18:00:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2020-11-26 18:00:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:20 +01:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
2014-11-07 22:57:56 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-12-01 20:06:23 +01:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-09 23:42:07 -07:00
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-06 11:18:14 -08:00
|
|
|
|
|
|
|
|
|
2014-11-04 10:14:30 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 21:24:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-24 09:32:42 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 21:24:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-26 18:00:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|