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 14:07:57 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2015-09-08 16:30:00 +00:00
|
|
|
#ifndef __PERF_ENV_H
|
|
|
|
#define __PERF_ENV_H
|
|
|
|
|
2016-02-16 15:01:43 +00:00
|
|
|
#include <linux/types.h>
|
2019-03-12 05:30:42 +00:00
|
|
|
#include <linux/rbtree.h>
|
|
|
|
#include "rwsem.h"
|
2016-02-16 15:01:43 +00:00
|
|
|
|
2019-09-10 15:29:02 +00:00
|
|
|
struct perf_cpu_map;
|
|
|
|
|
2015-09-08 16:30:00 +00:00
|
|
|
struct cpu_topology_map {
|
|
|
|
int socket_id;
|
2019-06-04 22:50:41 +00:00
|
|
|
int die_id;
|
2015-09-08 16:30:00 +00:00
|
|
|
int core_id;
|
|
|
|
};
|
|
|
|
|
2016-02-16 15:01:43 +00:00
|
|
|
struct cpu_cache_level {
|
|
|
|
u32 level;
|
|
|
|
u32 line_size;
|
|
|
|
u32 sets;
|
|
|
|
u32 ways;
|
|
|
|
char *type;
|
|
|
|
char *size;
|
|
|
|
char *map;
|
|
|
|
};
|
|
|
|
|
2016-07-04 12:16:20 +00:00
|
|
|
struct numa_node {
|
|
|
|
u32 node;
|
|
|
|
u64 mem_total;
|
|
|
|
u64 mem_free;
|
2019-07-21 11:23:49 +00:00
|
|
|
struct perf_cpu_map *map;
|
2016-07-04 12:16:20 +00:00
|
|
|
};
|
|
|
|
|
2018-03-07 15:50:08 +00:00
|
|
|
struct memory_node {
|
|
|
|
u64 node;
|
|
|
|
u64 size;
|
|
|
|
unsigned long *set;
|
|
|
|
};
|
|
|
|
|
2015-09-08 16:30:00 +00:00
|
|
|
struct perf_env {
|
|
|
|
char *hostname;
|
|
|
|
char *os_release;
|
|
|
|
char *version;
|
|
|
|
char *arch;
|
|
|
|
int nr_cpus_online;
|
|
|
|
int nr_cpus_avail;
|
|
|
|
char *cpu_desc;
|
|
|
|
char *cpuid;
|
|
|
|
unsigned long long total_mem;
|
2015-09-10 14:03:05 +00:00
|
|
|
unsigned int msr_pmu_type;
|
2020-03-19 20:25:02 +00:00
|
|
|
unsigned int max_branches;
|
2015-09-08 16:30:00 +00:00
|
|
|
|
|
|
|
int nr_cmdline;
|
|
|
|
int nr_sibling_cores;
|
2019-06-04 22:50:41 +00:00
|
|
|
int nr_sibling_dies;
|
2015-09-08 16:30:00 +00:00
|
|
|
int nr_sibling_threads;
|
|
|
|
int nr_numa_nodes;
|
2018-03-07 15:50:08 +00:00
|
|
|
int nr_memory_nodes;
|
2015-09-08 16:30:00 +00:00
|
|
|
int nr_pmu_mappings;
|
|
|
|
int nr_groups;
|
2020-03-19 20:25:02 +00:00
|
|
|
int nr_cpu_pmu_caps;
|
2015-09-08 16:30:00 +00:00
|
|
|
char *cmdline;
|
|
|
|
const char **cmdline_argv;
|
|
|
|
char *sibling_cores;
|
2019-06-04 22:50:41 +00:00
|
|
|
char *sibling_dies;
|
2015-09-08 16:30:00 +00:00
|
|
|
char *sibling_threads;
|
|
|
|
char *pmu_mappings;
|
2020-03-19 20:25:02 +00:00
|
|
|
char *cpu_pmu_caps;
|
2015-09-08 16:30:00 +00:00
|
|
|
struct cpu_topology_map *cpu;
|
2016-02-16 15:01:43 +00:00
|
|
|
struct cpu_cache_level *caches;
|
|
|
|
int caches_cnt;
|
2019-03-18 17:41:02 +00:00
|
|
|
u32 comp_ratio;
|
2019-03-18 17:41:33 +00:00
|
|
|
u32 comp_ver;
|
|
|
|
u32 comp_type;
|
|
|
|
u32 comp_level;
|
|
|
|
u32 comp_mmap_len;
|
2016-07-04 12:16:20 +00:00
|
|
|
struct numa_node *numa_nodes;
|
2018-03-07 15:50:08 +00:00
|
|
|
struct memory_node *memory_nodes;
|
|
|
|
unsigned long long memory_bsize;
|
2020-10-20 18:57:21 +00:00
|
|
|
#ifdef HAVE_LIBBPF_SUPPORT
|
2019-03-12 05:30:42 +00:00
|
|
|
/*
|
|
|
|
* bpf_info_lock protects bpf rbtrees. This is needed because the
|
|
|
|
* trees are accessed by different threads in perf-top
|
|
|
|
*/
|
|
|
|
struct {
|
|
|
|
struct rw_semaphore lock;
|
|
|
|
struct rb_root infos;
|
|
|
|
u32 infos_cnt;
|
2019-03-12 05:30:44 +00:00
|
|
|
struct rb_root btfs;
|
|
|
|
u32 btfs_cnt;
|
2019-03-12 05:30:42 +00:00
|
|
|
} bpf_progs;
|
2020-10-20 18:57:21 +00:00
|
|
|
#endif // HAVE_LIBBPF_SUPPORT
|
2020-03-25 12:45:31 +00:00
|
|
|
/* same reason as above (for perf-top) */
|
|
|
|
struct {
|
|
|
|
struct rw_semaphore lock;
|
|
|
|
struct rb_root tree;
|
|
|
|
} cgroups;
|
|
|
|
|
2019-08-29 11:31:48 +00:00
|
|
|
/* For fast cpu to numa node lookup via perf_env__numa_node */
|
|
|
|
int *numa_map;
|
|
|
|
int nr_numa_map;
|
perf header: Store clock references for -k/--clockid option
Add a new CLOCK_DATA feature that stores reference times when
-k/--clockid option is specified.
It contains the clock id and its reference time together with wall clock
time taken at the 'same time', both values are in nanoseconds.
The format of data is as below:
struct {
u32 version; /* version = 1 */
u32 clockid;
u64 wall_clock_ns;
u64 clockid_time_ns;
};
This clock reference times will be used in following changes to display
wall clock for perf events.
It's available only for recording with clockid specified, because it's
the only case where we can get reference time to wallclock time. It's
can't do that with perf clock yet.
Committer testing:
$ perf record -h -k
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-k, --clockid <clockid>
clockid to use for events, see clock_gettime()
$ perf record -k monotonic sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.017 MB perf.data (8 samples) ]
$ perf report --header-only | grep clockid -A1
# event : name = cycles:u, , id = { 88815, 88816, 88817, 88818, 88819, 88820, 88821, 88822 }, size = 120, { sample_period, sample_freq } = 4000, sample_type = IP|TID|TIME|PERIOD, read_format = ID, disabled = 1, inherit = 1, exclude_kernel = 1, mmap = 1, comm = 1, freq = 1, enable_on_exec = 1, task = 1, precise_ip = 3, sample_id_all = 1, exclude_guest = 1, mmap2 = 1, comm_exec = 1, use_clockid = 1, ksymbol = 1, bpf_event = 1, clockid = 1
# CPU_TOPOLOGY info available, use -I to display
--
# clockid frequency: 1000 MHz
# cpu pmu capabilities: branches=32, max_precise=3, pmu_name=skylake
# clockid: monotonic (1)
# reference time: 2020-08-06 09:40:21.619290 = 1596717621.619290 (TOD) = 21931.077673635 (monotonic)
$
Original-patch-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Geneviève Bastien <gbastien@versatic.net>
Cc: Ian Rogers <irogers@google.com>
Cc: Jeremie Galarneau <jgalar@efficios.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lore.kernel.org/lkml/20200805093444.314999-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-08-05 09:34:40 +00:00
|
|
|
|
|
|
|
/* For real clock time reference. */
|
|
|
|
struct {
|
|
|
|
u64 tod_ns;
|
|
|
|
u64 clockid_ns;
|
2020-08-05 09:34:41 +00:00
|
|
|
u64 clockid_res_ns;
|
perf header: Store clock references for -k/--clockid option
Add a new CLOCK_DATA feature that stores reference times when
-k/--clockid option is specified.
It contains the clock id and its reference time together with wall clock
time taken at the 'same time', both values are in nanoseconds.
The format of data is as below:
struct {
u32 version; /* version = 1 */
u32 clockid;
u64 wall_clock_ns;
u64 clockid_time_ns;
};
This clock reference times will be used in following changes to display
wall clock for perf events.
It's available only for recording with clockid specified, because it's
the only case where we can get reference time to wallclock time. It's
can't do that with perf clock yet.
Committer testing:
$ perf record -h -k
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-k, --clockid <clockid>
clockid to use for events, see clock_gettime()
$ perf record -k monotonic sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.017 MB perf.data (8 samples) ]
$ perf report --header-only | grep clockid -A1
# event : name = cycles:u, , id = { 88815, 88816, 88817, 88818, 88819, 88820, 88821, 88822 }, size = 120, { sample_period, sample_freq } = 4000, sample_type = IP|TID|TIME|PERIOD, read_format = ID, disabled = 1, inherit = 1, exclude_kernel = 1, mmap = 1, comm = 1, freq = 1, enable_on_exec = 1, task = 1, precise_ip = 3, sample_id_all = 1, exclude_guest = 1, mmap2 = 1, comm_exec = 1, use_clockid = 1, ksymbol = 1, bpf_event = 1, clockid = 1
# CPU_TOPOLOGY info available, use -I to display
--
# clockid frequency: 1000 MHz
# cpu pmu capabilities: branches=32, max_precise=3, pmu_name=skylake
# clockid: monotonic (1)
# reference time: 2020-08-06 09:40:21.619290 = 1596717621.619290 (TOD) = 21931.077673635 (monotonic)
$
Original-patch-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Geneviève Bastien <gbastien@versatic.net>
Cc: Ian Rogers <irogers@google.com>
Cc: Jeremie Galarneau <jgalar@efficios.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lore.kernel.org/lkml/20200805093444.314999-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-08-05 09:34:40 +00:00
|
|
|
int clockid;
|
|
|
|
/*
|
|
|
|
* enabled is valid for report mode, and is true if above
|
|
|
|
* values are set, it's set in process_clock_data
|
|
|
|
*/
|
|
|
|
bool enabled;
|
|
|
|
} clock;
|
2015-09-08 16:30:00 +00:00
|
|
|
};
|
|
|
|
|
2019-03-18 17:41:33 +00:00
|
|
|
enum perf_compress_type {
|
|
|
|
PERF_COMP_NONE = 0,
|
|
|
|
PERF_COMP_ZSTD,
|
|
|
|
PERF_COMP_MAX
|
|
|
|
};
|
|
|
|
|
2019-03-12 05:30:42 +00:00
|
|
|
struct bpf_prog_info_node;
|
2019-03-12 05:30:44 +00:00
|
|
|
struct btf_node;
|
2019-03-12 05:30:42 +00:00
|
|
|
|
2015-09-08 19:58:20 +00:00
|
|
|
extern struct perf_env perf_env;
|
|
|
|
|
2015-09-08 16:30:00 +00:00
|
|
|
void perf_env__exit(struct perf_env *env);
|
|
|
|
|
2015-09-08 19:58:20 +00:00
|
|
|
int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]);
|
|
|
|
|
2019-09-30 14:50:15 +00:00
|
|
|
int perf_env__read_cpuid(struct perf_env *env);
|
2015-09-09 13:37:01 +00:00
|
|
|
int perf_env__read_cpu_topology_map(struct perf_env *env);
|
|
|
|
|
2016-02-16 15:01:43 +00:00
|
|
|
void cpu_cache_level__free(struct cpu_cache_level *cache);
|
2017-12-11 17:47:49 +00:00
|
|
|
|
|
|
|
const char *perf_env__arch(struct perf_env *env);
|
2018-05-17 09:21:53 +00:00
|
|
|
const char *perf_env__raw_arch(struct perf_env *env);
|
2018-05-22 10:54:32 +00:00
|
|
|
int perf_env__nr_cpus_avail(struct perf_env *env);
|
2018-05-17 09:21:53 +00:00
|
|
|
|
2019-03-12 05:30:42 +00:00
|
|
|
void perf_env__init(struct perf_env *env);
|
|
|
|
void perf_env__insert_bpf_prog_info(struct perf_env *env,
|
|
|
|
struct bpf_prog_info_node *info_node);
|
|
|
|
struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
|
|
|
|
__u32 prog_id);
|
2019-03-12 05:30:44 +00:00
|
|
|
void perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node);
|
|
|
|
struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id);
|
2019-08-29 11:31:48 +00:00
|
|
|
|
|
|
|
int perf_env__numa_node(struct perf_env *env, int cpu);
|
2015-09-08 16:30:00 +00:00
|
|
|
#endif /* __PERF_ENV_H */
|