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 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2007-04-30 14:30:56 +08:00
|
|
|
#ifndef _ASM_POWERPC_PGALLOC_32_H
|
|
|
|
#define _ASM_POWERPC_PGALLOC_32_H
|
|
|
|
|
|
|
|
#include <linux/threads.h>
|
2016-12-07 15:47:24 +08:00
|
|
|
#include <linux/slab.h>
|
2007-04-30 14:30:56 +08:00
|
|
|
|
2016-12-07 15:47:24 +08:00
|
|
|
/*
|
|
|
|
* Functions that deal with pagetables that could be at any level of
|
|
|
|
* the table need to be passed an "index_size" so they know how to
|
|
|
|
* handle allocation. For PTE pages (which are linked to a struct
|
|
|
|
* page for now, and drawn from the main get_free_pages() pool), the
|
|
|
|
* allocation size will be (2^index_size * sizeof(pointer)) and
|
|
|
|
* allocations are drawn from the kmem_cache in PGT_CACHE(index_size).
|
|
|
|
*
|
|
|
|
* The maximum index size needs to be big enough to allow any
|
|
|
|
* pagetable sizes we need, but small enough to fit in the low bits of
|
|
|
|
* any page table pointer. In other words all pagetables, even tiny
|
|
|
|
* ones, must be aligned to allow at least enough low 0 bits to
|
|
|
|
* contain this value. This value is also used as a mask, so it must
|
|
|
|
* be one less than a power of two.
|
|
|
|
*/
|
|
|
|
#define MAX_PGTABLE_INDEX_SIZE 0xf
|
2008-11-19 20:50:04 +08:00
|
|
|
|
2007-04-30 14:30:56 +08:00
|
|
|
extern void __bad_pte(pmd_t *pmd);
|
|
|
|
|
2016-12-07 15:47:24 +08:00
|
|
|
extern struct kmem_cache *pgtable_cache[];
|
2018-11-29 22:07:03 +08:00
|
|
|
#define PGT_CACHE(shift) pgtable_cache[shift]
|
2016-12-07 15:47:24 +08:00
|
|
|
|
|
|
|
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
|
|
|
|
{
|
2017-05-02 13:17:05 +08:00
|
|
|
return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
|
|
|
|
pgtable_gfp_flags(mm, GFP_KERNEL));
|
2016-12-07 15:47:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
|
|
|
|
{
|
|
|
|
kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);
|
|
|
|
}
|
2007-04-30 14:30:56 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We don't have any real pmd's, and this code never triggers because
|
|
|
|
* the pgd will always be present..
|
|
|
|
*/
|
2007-05-08 10:46:49 +08:00
|
|
|
/* #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) */
|
2008-02-05 14:29:14 +08:00
|
|
|
#define pmd_free(mm, x) do { } while (0)
|
mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
mm: Pass virtual address to [__]p{te,ud,md}_free_tlb()
Upcoming paches to support the new 64-bit "BookE" powerpc architecture
will need to have the virtual address corresponding to PTE page when
freeing it, due to the way the HW table walker works.
Basically, the TLB can be loaded with "large" pages that cover the whole
virtual space (well, sort-of, half of it actually) represented by a PTE
page, and which contain an "indirect" bit indicating that this TLB entry
RPN points to an array of PTEs from which the TLB can then create direct
entries. Thus, in order to invalidate those when PTE pages are deleted,
we need the virtual address to pass to tlbilx or tlbivax instructions.
The old trick of sticking it somewhere in the PTE page struct page sucks
too much, the address is almost readily available in all call sites and
almost everybody implemets these as macros, so we may as well add the
argument everywhere. I added it to the pmd and pud variants for consistency.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: David Howells <dhowells@redhat.com> [MN10300 & FRV]
Acked-by: Nick Piggin <npiggin@suse.de>
Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> [s390]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-07-22 13:44:28 +08:00
|
|
|
#define __pmd_free_tlb(tlb,x,a) do { } while (0)
|
2007-05-08 10:46:49 +08:00
|
|
|
/* #define pgd_populate(mm, pmd, pte) BUG() */
|
2007-04-30 14:30:56 +08:00
|
|
|
|
|
|
|
#ifndef CONFIG_BOOKE
|
2015-12-01 11:36:35 +08:00
|
|
|
|
|
|
|
static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp,
|
|
|
|
pte_t *pte)
|
|
|
|
{
|
|
|
|
*pmdp = __pmd(__pa(pte) | _PMD_PRESENT);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp,
|
|
|
|
pgtable_t pte_page)
|
|
|
|
{
|
2018-11-29 22:07:01 +08:00
|
|
|
*pmdp = __pmd(__pa(pte_page) | _PMD_USER | _PMD_PRESENT);
|
2015-12-01 11:36:35 +08:00
|
|
|
}
|
|
|
|
|
2018-11-29 22:07:01 +08:00
|
|
|
#define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))
|
2007-04-30 14:30:56 +08:00
|
|
|
#else
|
2015-12-01 11:36:35 +08:00
|
|
|
|
|
|
|
static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp,
|
|
|
|
pte_t *pte)
|
|
|
|
{
|
|
|
|
*pmdp = __pmd((unsigned long)pte | _PMD_PRESENT);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmdp,
|
|
|
|
pgtable_t pte_page)
|
|
|
|
{
|
2018-11-29 22:07:01 +08:00
|
|
|
*pmdp = __pmd((unsigned long)pte_page | _PMD_PRESENT);
|
2015-12-01 11:36:35 +08:00
|
|
|
}
|
|
|
|
|
2018-11-29 22:07:01 +08:00
|
|
|
#define pmd_pgtable(pmd) ((pgtable_t)pmd_page_vaddr(pmd))
|
2007-04-30 14:30:56 +08:00
|
|
|
#endif
|
|
|
|
|
mm: treewide: remove unused address argument from pte_alloc functions
Patch series "Add support for fast mremap".
This series speeds up the mremap(2) syscall by copying page tables at
the PMD level even for non-THP systems. There is concern that the extra
'address' argument that mremap passes to pte_alloc may do something
subtle architecture related in the future that may make the scheme not
work. Also we find that there is no point in passing the 'address' to
pte_alloc since its unused. This patch therefore removes this argument
tree-wide resulting in a nice negative diff as well. Also ensuring
along the way that the enabled architectures do not do anything funky
with the 'address' argument that goes unnoticed by the optimization.
Build and boot tested on x86-64. Build tested on arm64. The config
enablement patch for arm64 will be posted in the future after more
testing.
The changes were obtained by applying the following Coccinelle script.
(thanks Julia for answering all Coccinelle questions!).
Following fix ups were done manually:
* Removal of address argument from pte_fragment_alloc
* Removal of pte_alloc_one_fast definitions from m68k and microblaze.
// Options: --include-headers --no-includes
// Note: I split the 'identifier fn' line, so if you are manually
// running it, please unsplit it so it runs for you.
virtual patch
@pte_alloc_func_def depends on patch exists@
identifier E2;
identifier fn =~
"^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
type T2;
@@
fn(...
- , T2 E2
)
{ ... }
@pte_alloc_func_proto_noarg depends on patch exists@
type T1, T2, T3, T4;
identifier fn =~ "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
@@
(
- T3 fn(T1, T2);
+ T3 fn(T1);
|
- T3 fn(T1, T2, T4);
+ T3 fn(T1, T2);
)
@pte_alloc_func_proto depends on patch exists@
identifier E1, E2, E4;
type T1, T2, T3, T4;
identifier fn =~
"^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
@@
(
- T3 fn(T1 E1, T2 E2);
+ T3 fn(T1 E1);
|
- T3 fn(T1 E1, T2 E2, T4 E4);
+ T3 fn(T1 E1, T2 E2);
)
@pte_alloc_func_call depends on patch exists@
expression E2;
identifier fn =~
"^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
@@
fn(...
-, E2
)
@pte_alloc_macro depends on patch exists@
identifier fn =~
"^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
identifier a, b, c;
expression e;
position p;
@@
(
- #define fn(a, b, c) e
+ #define fn(a, b) e
|
- #define fn(a, b) e
+ #define fn(a) e
)
Link: http://lkml.kernel.org/r/20181108181201.88826-2-joelaf@google.com
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Suggested-by: Kirill A. Shutemov <kirill@shutemov.name>
Acked-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: William Kucharski <william.kucharski@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-01-04 07:28:34 +08:00
|
|
|
extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm);
|
|
|
|
extern pgtable_t pte_alloc_one(struct mm_struct *mm);
|
2018-11-29 22:07:01 +08:00
|
|
|
void pte_frag_destroy(void *pte_frag);
|
mm: treewide: remove unused address argument from pte_alloc functions
Patch series "Add support for fast mremap".
This series speeds up the mremap(2) syscall by copying page tables at
the PMD level even for non-THP systems. There is concern that the extra
'address' argument that mremap passes to pte_alloc may do something
subtle architecture related in the future that may make the scheme not
work. Also we find that there is no point in passing the 'address' to
pte_alloc since its unused. This patch therefore removes this argument
tree-wide resulting in a nice negative diff as well. Also ensuring
along the way that the enabled architectures do not do anything funky
with the 'address' argument that goes unnoticed by the optimization.
Build and boot tested on x86-64. Build tested on arm64. The config
enablement patch for arm64 will be posted in the future after more
testing.
The changes were obtained by applying the following Coccinelle script.
(thanks Julia for answering all Coccinelle questions!).
Following fix ups were done manually:
* Removal of address argument from pte_fragment_alloc
* Removal of pte_alloc_one_fast definitions from m68k and microblaze.
// Options: --include-headers --no-includes
// Note: I split the 'identifier fn' line, so if you are manually
// running it, please unsplit it so it runs for you.
virtual patch
@pte_alloc_func_def depends on patch exists@
identifier E2;
identifier fn =~
"^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
type T2;
@@
fn(...
- , T2 E2
)
{ ... }
@pte_alloc_func_proto_noarg depends on patch exists@
type T1, T2, T3, T4;
identifier fn =~ "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
@@
(
- T3 fn(T1, T2);
+ T3 fn(T1);
|
- T3 fn(T1, T2, T4);
+ T3 fn(T1, T2);
)
@pte_alloc_func_proto depends on patch exists@
identifier E1, E2, E4;
type T1, T2, T3, T4;
identifier fn =~
"^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
@@
(
- T3 fn(T1 E1, T2 E2);
+ T3 fn(T1 E1);
|
- T3 fn(T1 E1, T2 E2, T4 E4);
+ T3 fn(T1 E1, T2 E2);
)
@pte_alloc_func_call depends on patch exists@
expression E2;
identifier fn =~
"^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
@@
fn(...
-, E2
)
@pte_alloc_macro depends on patch exists@
identifier fn =~
"^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
identifier a, b, c;
expression e;
position p;
@@
(
- #define fn(a, b, c) e
+ #define fn(a, b) e
|
- #define fn(a, b) e
+ #define fn(a) e
)
Link: http://lkml.kernel.org/r/20181108181201.88826-2-joelaf@google.com
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Suggested-by: Kirill A. Shutemov <kirill@shutemov.name>
Acked-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: William Kucharski <william.kucharski@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-01-04 07:28:34 +08:00
|
|
|
pte_t *pte_fragment_alloc(struct mm_struct *mm, int kernel);
|
2018-11-29 22:07:01 +08:00
|
|
|
void pte_fragment_free(unsigned long *table, int kernel);
|
2007-04-30 14:30:56 +08:00
|
|
|
|
2013-04-28 17:37:32 +08:00
|
|
|
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
|
|
|
|
{
|
2018-11-29 22:07:01 +08:00
|
|
|
pte_fragment_free((unsigned long *)pte, 1);
|
2013-04-28 17:37:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
|
|
|
|
{
|
2018-11-29 22:07:01 +08:00
|
|
|
pte_fragment_free((unsigned long *)ptepage, 0);
|
2013-04-28 17:37:32 +08:00
|
|
|
}
|
|
|
|
|
2009-10-29 00:27:18 +08:00
|
|
|
static inline void pgtable_free(void *table, unsigned index_size)
|
2008-11-19 20:50:04 +08:00
|
|
|
{
|
2016-12-07 15:47:24 +08:00
|
|
|
if (!index_size) {
|
2018-11-29 22:07:01 +08:00
|
|
|
pte_fragment_free((unsigned long *)table, 0);
|
2016-12-07 15:47:24 +08:00
|
|
|
} else {
|
|
|
|
BUG_ON(index_size > MAX_PGTABLE_INDEX_SIZE);
|
|
|
|
kmem_cache_free(PGT_CACHE(index_size), table);
|
|
|
|
}
|
2008-11-19 20:50:04 +08:00
|
|
|
}
|
2007-04-30 14:30:56 +08:00
|
|
|
|
|
|
|
#define check_pgt_cache() do { } while (0)
|
2018-06-14 18:31:52 +08:00
|
|
|
#define get_hugepd_cache_index(x) (x)
|
2007-04-30 14:30:56 +08:00
|
|
|
|
2013-04-28 17:37:32 +08:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
static inline void pgtable_free_tlb(struct mmu_gather *tlb,
|
|
|
|
void *table, int shift)
|
|
|
|
{
|
|
|
|
unsigned long pgf = (unsigned long)table;
|
|
|
|
BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
|
|
|
|
pgf |= shift;
|
|
|
|
tlb_remove_table(tlb, (void *)pgf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void __tlb_remove_table(void *_table)
|
|
|
|
{
|
|
|
|
void *table = (void *)((unsigned long)_table & ~MAX_PGTABLE_INDEX_SIZE);
|
|
|
|
unsigned shift = (unsigned long)_table & MAX_PGTABLE_INDEX_SIZE;
|
|
|
|
|
|
|
|
pgtable_free(table, shift);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void pgtable_free_tlb(struct mmu_gather *tlb,
|
|
|
|
void *table, int shift)
|
|
|
|
{
|
|
|
|
pgtable_free(table, shift);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
|
|
|
|
unsigned long address)
|
|
|
|
{
|
|
|
|
tlb_flush_pgtable(tlb, address);
|
2018-11-29 22:07:01 +08:00
|
|
|
pgtable_free_tlb(tlb, table, 0);
|
2013-04-28 17:37:32 +08:00
|
|
|
}
|
2007-04-30 14:30:56 +08:00
|
|
|
#endif /* _ASM_POWERPC_PGALLOC_32_H */
|