mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 02:35:16 +07:00
b24413180f
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>
188 lines
5.1 KiB
C
188 lines
5.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* kernel/lockdep_internals.h
|
|
*
|
|
* Runtime locking correctness validator
|
|
*
|
|
* lockdep subsystem internal functions and variables.
|
|
*/
|
|
|
|
/*
|
|
* Lock-class usage-state bits:
|
|
*/
|
|
enum lock_usage_bit {
|
|
#define LOCKDEP_STATE(__STATE) \
|
|
LOCK_USED_IN_##__STATE, \
|
|
LOCK_USED_IN_##__STATE##_READ, \
|
|
LOCK_ENABLED_##__STATE, \
|
|
LOCK_ENABLED_##__STATE##_READ,
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
LOCK_USED,
|
|
LOCK_USAGE_STATES
|
|
};
|
|
|
|
/*
|
|
* Usage-state bitmasks:
|
|
*/
|
|
#define __LOCKF(__STATE) LOCKF_##__STATE = (1 << LOCK_##__STATE),
|
|
|
|
enum {
|
|
#define LOCKDEP_STATE(__STATE) \
|
|
__LOCKF(USED_IN_##__STATE) \
|
|
__LOCKF(USED_IN_##__STATE##_READ) \
|
|
__LOCKF(ENABLED_##__STATE) \
|
|
__LOCKF(ENABLED_##__STATE##_READ)
|
|
#include "lockdep_states.h"
|
|
#undef LOCKDEP_STATE
|
|
__LOCKF(USED)
|
|
};
|
|
|
|
#define LOCKF_ENABLED_IRQ (LOCKF_ENABLED_HARDIRQ | LOCKF_ENABLED_SOFTIRQ)
|
|
#define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ)
|
|
|
|
#define LOCKF_ENABLED_IRQ_READ \
|
|
(LOCKF_ENABLED_HARDIRQ_READ | LOCKF_ENABLED_SOFTIRQ_READ)
|
|
#define LOCKF_USED_IN_IRQ_READ \
|
|
(LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
|
|
|
|
/*
|
|
* CONFIG_LOCKDEP_SMALL is defined for sparc. Sparc requires .text,
|
|
* .data and .bss to fit in required 32MB limit for the kernel. With
|
|
* CONFIG_LOCKDEP we could go over this limit and cause system boot-up problems.
|
|
* So, reduce the static allocations for lockdeps related structures so that
|
|
* everything fits in current required size limit.
|
|
*/
|
|
#ifdef CONFIG_LOCKDEP_SMALL
|
|
/*
|
|
* MAX_LOCKDEP_ENTRIES is the maximum number of lock dependencies
|
|
* we track.
|
|
*
|
|
* We use the per-lock dependency maps in two ways: we grow it by adding
|
|
* every to-be-taken lock to all currently held lock's own dependency
|
|
* table (if it's not there yet), and we check it for lock order
|
|
* conflicts and deadlocks.
|
|
*/
|
|
#define MAX_LOCKDEP_ENTRIES 16384UL
|
|
#define MAX_LOCKDEP_CHAINS_BITS 15
|
|
#define MAX_STACK_TRACE_ENTRIES 262144UL
|
|
#else
|
|
#define MAX_LOCKDEP_ENTRIES 32768UL
|
|
|
|
#define MAX_LOCKDEP_CHAINS_BITS 16
|
|
|
|
/*
|
|
* Stack-trace: tightly packed array of stack backtrace
|
|
* addresses. Protected by the hash_lock.
|
|
*/
|
|
#define MAX_STACK_TRACE_ENTRIES 524288UL
|
|
#endif
|
|
|
|
#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
|
|
|
|
#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
|
|
|
|
extern struct list_head all_lock_classes;
|
|
extern struct lock_chain lock_chains[];
|
|
|
|
#define LOCK_USAGE_CHARS (1+LOCK_USAGE_STATES/2)
|
|
|
|
extern void get_usage_chars(struct lock_class *class,
|
|
char usage[LOCK_USAGE_CHARS]);
|
|
|
|
extern const char * __get_key_name(struct lockdep_subclass_key *key, char *str);
|
|
|
|
struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i);
|
|
|
|
extern unsigned long nr_lock_classes;
|
|
extern unsigned long nr_list_entries;
|
|
extern unsigned long nr_lock_chains;
|
|
extern int nr_chain_hlocks;
|
|
extern unsigned long nr_stack_trace_entries;
|
|
|
|
extern unsigned int nr_hardirq_chains;
|
|
extern unsigned int nr_softirq_chains;
|
|
extern unsigned int nr_process_chains;
|
|
extern unsigned int max_lockdep_depth;
|
|
extern unsigned int max_recursion_depth;
|
|
|
|
extern unsigned int max_bfs_queue_depth;
|
|
|
|
#ifdef CONFIG_PROVE_LOCKING
|
|
extern unsigned long lockdep_count_forward_deps(struct lock_class *);
|
|
extern unsigned long lockdep_count_backward_deps(struct lock_class *);
|
|
#else
|
|
static inline unsigned long
|
|
lockdep_count_forward_deps(struct lock_class *class)
|
|
{
|
|
return 0;
|
|
}
|
|
static inline unsigned long
|
|
lockdep_count_backward_deps(struct lock_class *class)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_DEBUG_LOCKDEP
|
|
|
|
#include <asm/local.h>
|
|
/*
|
|
* Various lockdep statistics.
|
|
* We want them per cpu as they are often accessed in fast path
|
|
* and we want to avoid too much cache bouncing.
|
|
*/
|
|
struct lockdep_stats {
|
|
int chain_lookup_hits;
|
|
int chain_lookup_misses;
|
|
int hardirqs_on_events;
|
|
int hardirqs_off_events;
|
|
int redundant_hardirqs_on;
|
|
int redundant_hardirqs_off;
|
|
int softirqs_on_events;
|
|
int softirqs_off_events;
|
|
int redundant_softirqs_on;
|
|
int redundant_softirqs_off;
|
|
int nr_unused_locks;
|
|
int nr_redundant_checks;
|
|
int nr_redundant;
|
|
int nr_cyclic_checks;
|
|
int nr_cyclic_check_recursions;
|
|
int nr_find_usage_forwards_checks;
|
|
int nr_find_usage_forwards_recursions;
|
|
int nr_find_usage_backwards_checks;
|
|
int nr_find_usage_backwards_recursions;
|
|
};
|
|
|
|
DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats);
|
|
|
|
#define __debug_atomic_inc(ptr) \
|
|
this_cpu_inc(lockdep_stats.ptr);
|
|
|
|
#define debug_atomic_inc(ptr) { \
|
|
WARN_ON_ONCE(!irqs_disabled()); \
|
|
__this_cpu_inc(lockdep_stats.ptr); \
|
|
}
|
|
|
|
#define debug_atomic_dec(ptr) { \
|
|
WARN_ON_ONCE(!irqs_disabled()); \
|
|
__this_cpu_dec(lockdep_stats.ptr); \
|
|
}
|
|
|
|
#define debug_atomic_read(ptr) ({ \
|
|
struct lockdep_stats *__cpu_lockdep_stats; \
|
|
unsigned long long __total = 0; \
|
|
int __cpu; \
|
|
for_each_possible_cpu(__cpu) { \
|
|
__cpu_lockdep_stats = &per_cpu(lockdep_stats, __cpu); \
|
|
__total += __cpu_lockdep_stats->ptr; \
|
|
} \
|
|
__total; \
|
|
})
|
|
#else
|
|
# define __debug_atomic_inc(ptr) do { } while (0)
|
|
# define debug_atomic_inc(ptr) do { } while (0)
|
|
# define debug_atomic_dec(ptr) do { } while (0)
|
|
# define debug_atomic_read(ptr) 0
|
|
#endif
|