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 */
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* S390 version
|
2012-07-20 09:15:04 +00:00
|
|
|
* Copyright IBM Corp. 1999, 2000
|
2005-04-16 22:20:36 +00:00
|
|
|
* Author(s): Hartmut Penner (hp@de.ibm.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _S390_PAGE_H
|
|
|
|
#define _S390_PAGE_H
|
|
|
|
|
2007-10-12 14:11:50 +00:00
|
|
|
#include <linux/const.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/types.h>
|
|
|
|
|
2017-06-16 15:24:39 +00:00
|
|
|
#define _PAGE_SHIFT 12
|
|
|
|
#define _PAGE_SIZE (_AC(1, UL) << _PAGE_SHIFT)
|
|
|
|
#define _PAGE_MASK (~(_PAGE_SIZE - 1))
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* PAGE_SHIFT determines the page size */
|
2017-06-16 15:24:39 +00:00
|
|
|
#define PAGE_SHIFT _PAGE_SHIFT
|
|
|
|
#define PAGE_SIZE _PAGE_SIZE
|
|
|
|
#define PAGE_MASK _PAGE_MASK
|
2005-05-01 15:58:58 +00:00
|
|
|
#define PAGE_DEFAULT_ACC 0
|
|
|
|
#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2015-07-17 23:23:34 +00:00
|
|
|
#define HPAGE_SHIFT 20
|
2008-04-30 11:38:46 +00:00
|
|
|
#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
|
|
|
|
#define HPAGE_MASK (~(HPAGE_SIZE - 1))
|
|
|
|
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
|
2016-07-04 12:47:01 +00:00
|
|
|
#define HUGE_MAX_HSTATE 2
|
2008-04-30 11:38:46 +00:00
|
|
|
|
|
|
|
#define ARCH_HAS_SETCLEAR_HUGE_PTE
|
|
|
|
#define ARCH_HAS_HUGE_PTE_TYPE
|
|
|
|
#define ARCH_HAS_PREPARE_HUGEPAGE
|
|
|
|
#define ARCH_HAS_HUGEPAGE_CLEAR_FLUSH
|
|
|
|
|
s390/mm: fix dynamic pagetable upgrade for hugetlbfs
Commit ee71d16d22bb ("s390/mm: make TASK_SIZE independent from the number
of page table levels") changed the logic of TASK_SIZE and also removed the
arch_mmap_check() implementation for s390. This combination has a subtle
effect on how get_unmapped_area() for hugetlbfs pages works. It is now
possible that a user process establishes a hugetlbfs mapping at an address
above 4 TB, without triggering a dynamic pagetable upgrade from 3 to 4
levels.
This is because hugetlbfs mappings will not use mm->get_unmapped_area, but
rather file->f_op->get_unmapped_area, which currently is the generic
implementation of hugetlb_get_unmapped_area() that does not know about s390
dynamic pagetable upgrades, but with the new definition of TASK_SIZE, it
will now allow mappings above 4 TB.
Subsequent access to such a mapped address above 4 TB will result in a page
fault loop, because the CPU cannot translate such a large address with 3
pagetable levels. The fault handler will try to map in a hugepage at the
address, but due to the folded pagetable logic it will end up with creating
entries in the 3 level pagetable, possibly overwriting existing mappings,
and then it all repeats when the access is retried.
Apart from the page fault loop, this can have various nasty effects, e.g.
kernel panic from one of the BUG_ON() checks in memory management code,
or even data loss if an existing mapping gets overwritten.
Fix this by implementing HAVE_ARCH_HUGETLB_UNMAPPED_AREA support for s390,
providing an s390 version for hugetlb_get_unmapped_area() with pagetable
upgrade support similar to arch_get_unmapped_area(), which will then be
used instead of the generic version.
Fixes: ee71d16d22bb ("s390/mm: make TASK_SIZE independent from the number of page table levels")
Cc: <stable@vger.kernel.org> # 4.12+
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2020-01-16 18:59:04 +00:00
|
|
|
#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
|
|
|
|
|
2015-07-17 23:23:34 +00:00
|
|
|
#include <asm/setup.h>
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2016-06-14 04:55:43 +00:00
|
|
|
void __storage_key_init_range(unsigned long start, unsigned long end);
|
|
|
|
|
2013-10-07 10:12:32 +00:00
|
|
|
static inline void storage_key_init_range(unsigned long start, unsigned long end)
|
|
|
|
{
|
2020-02-14 06:42:07 +00:00
|
|
|
if (PAGE_DEFAULT_KEY != 0)
|
2016-06-14 04:55:43 +00:00
|
|
|
__storage_key_init_range(start, end);
|
2013-10-07 10:12:32 +00:00
|
|
|
}
|
2012-11-02 11:56:43 +00:00
|
|
|
|
s390: let the compiler do page clearing
The hardware folks told me that for page clearing "when you exactly
know what to do, hand written xc+pfd is usally faster then mvcl for
page clearing, as it saves millicode overhead and parameter parsing
and checking" as long as you dont need the cache bypassing.
Turns out that gcc already does a proper xc,pfd loop.
A small test on z196 that does
buff = mmap(NULL, bufsize,PROT_EXEC|PROT_WRITE|PROT_READ,AP_PRIVATE| MAP_ANONYMOUS,0,0);
for ( i = 0; i < bufsize; i+= 256)
buff[i] = 0x5;
gets 20% faster (touches every cache line of a page)
and
buff = mmap(NULL, bufsize,PROT_EXEC|PROT_WRITE|PROT_READ,AP_PRIVATE| MAP_ANONYMOUS,0,0);
for ( i = 0; i < bufsize; i+= 4096)
buff[i] = 0x5;
is within noise ratio (touches one cache line of a page).
As the clear_page is usually called for first memory accesses
we can assume that at least one cache line is used afterwards,
so this change should be always better.
Another benchmark, a make -j 40 of my testsuite in tmpfs with
hot caches on a 32cpu system:
-- unpatched -- -- patched --
real 0m1.017s real 0m0.994s (~2% faster, but in noise)
user 0m5.339s user 0m5.016s (~6% faster)
sys 0m0.691s sys 0m0.632s (~8% faster)
Let use the same define to memset as the asm-generic variant
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-01-30 09:31:13 +00:00
|
|
|
#define clear_page(page) memset((page), 0, PAGE_SIZE)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-11-19 13:25:17 +00:00
|
|
|
/*
|
|
|
|
* copy_page uses the mvcl instruction with 0xb0 padding byte in order to
|
|
|
|
* bypass caches when copying a page. Especially when copying huge pages
|
|
|
|
* this keeps L1 and L2 data caches alive.
|
|
|
|
*/
|
2005-04-16 22:20:36 +00:00
|
|
|
static inline void copy_page(void *to, void *from)
|
|
|
|
{
|
2021-06-09 20:59:13 +00:00
|
|
|
union register_pair dst, src;
|
|
|
|
|
|
|
|
dst.even = (unsigned long) to;
|
|
|
|
dst.odd = 0x1000;
|
|
|
|
src.even = (unsigned long) from;
|
|
|
|
src.odd = 0xb0001000;
|
|
|
|
|
2013-11-19 13:25:17 +00:00
|
|
|
asm volatile(
|
2021-06-09 20:59:13 +00:00
|
|
|
" mvcl %[dst],%[src]"
|
|
|
|
: [dst] "+&d" (dst.pair), [src] "+&d" (src.pair)
|
2013-11-19 13:25:17 +00:00
|
|
|
: : "memory", "cc");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define clear_user_page(page, vaddr, pg) clear_page(page)
|
|
|
|
#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
|
|
|
|
|
2021-06-02 23:52:27 +00:00
|
|
|
#define alloc_zeroed_user_highpage_movable(vma, vaddr) \
|
|
|
|
alloc_page_vma(GFP_HIGHUSER_MOVABLE | __GFP_ZERO, vma, vaddr)
|
|
|
|
#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLE
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* These are used to make use of C type-checking..
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct { unsigned long pgprot; } pgprot_t;
|
2011-05-23 08:24:40 +00:00
|
|
|
typedef struct { unsigned long pgste; } pgste_t;
|
2005-04-16 22:20:36 +00:00
|
|
|
typedef struct { unsigned long pte; } pte_t;
|
|
|
|
typedef struct { unsigned long pmd; } pmd_t;
|
2007-10-22 10:52:48 +00:00
|
|
|
typedef struct { unsigned long pud; } pud_t;
|
2017-04-24 16:19:10 +00:00
|
|
|
typedef struct { unsigned long p4d; } p4d_t;
|
2005-04-16 22:20:36 +00:00
|
|
|
typedef struct { unsigned long pgd; } pgd_t;
|
2008-02-09 17:24:35 +00:00
|
|
|
typedef pte_t *pgtable_t;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-02-09 17:24:35 +00:00
|
|
|
#define pgprot_val(x) ((x).pgprot)
|
2011-05-23 08:24:40 +00:00
|
|
|
#define pgste_val(x) ((x).pgste)
|
2008-02-09 17:24:35 +00:00
|
|
|
#define pte_val(x) ((x).pte)
|
|
|
|
#define pmd_val(x) ((x).pmd)
|
2007-10-22 10:52:48 +00:00
|
|
|
#define pud_val(x) ((x).pud)
|
2017-04-24 16:19:10 +00:00
|
|
|
#define p4d_val(x) ((x).p4d)
|
2005-04-16 22:20:36 +00:00
|
|
|
#define pgd_val(x) ((x).pgd)
|
|
|
|
|
2011-05-23 08:24:40 +00:00
|
|
|
#define __pgste(x) ((pgste_t) { (x) } )
|
2005-04-16 22:20:36 +00:00
|
|
|
#define __pte(x) ((pte_t) { (x) } )
|
|
|
|
#define __pmd(x) ((pmd_t) { (x) } )
|
2011-05-23 08:24:40 +00:00
|
|
|
#define __pud(x) ((pud_t) { (x) } )
|
2017-04-24 16:19:10 +00:00
|
|
|
#define __p4d(x) ((p4d_t) { (x) } )
|
2005-04-16 22:20:36 +00:00
|
|
|
#define __pgd(x) ((pgd_t) { (x) } )
|
|
|
|
#define __pgprot(x) ((pgprot_t) { (x) } )
|
|
|
|
|
2011-05-23 08:24:39 +00:00
|
|
|
static inline void page_set_storage_key(unsigned long addr,
|
|
|
|
unsigned char skey, int mapped)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-10-25 14:10:14 +00:00
|
|
|
if (!mapped)
|
|
|
|
asm volatile(".insn rrf,0xb22b0000,%0,%1,8,0"
|
|
|
|
: : "d" (skey), "a" (addr));
|
|
|
|
else
|
|
|
|
asm volatile("sske %0,%1" : : "d" (skey), "a" (addr));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2011-05-23 08:24:39 +00:00
|
|
|
static inline unsigned char page_get_storage_key(unsigned long addr)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2011-05-23 08:24:39 +00:00
|
|
|
unsigned char skey;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2011-05-23 08:24:39 +00:00
|
|
|
asm volatile("iske %0,%1" : "=d" (skey) : "a" (addr));
|
2005-04-16 22:20:36 +00:00
|
|
|
return skey;
|
|
|
|
}
|
|
|
|
|
2011-05-23 08:24:39 +00:00
|
|
|
static inline int page_reset_referenced(unsigned long addr)
|
|
|
|
{
|
2016-05-10 07:50:21 +00:00
|
|
|
int cc;
|
2011-05-23 08:24:39 +00:00
|
|
|
|
|
|
|
asm volatile(
|
|
|
|
" rrbe 0,%1\n"
|
|
|
|
" ipm %0\n"
|
2016-05-10 07:50:21 +00:00
|
|
|
" srl %0,28\n"
|
|
|
|
: "=d" (cc) : "a" (addr) : "cc");
|
|
|
|
return cc;
|
2011-05-23 08:24:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Bits int the storage key */
|
|
|
|
#define _PAGE_CHANGED 0x02 /* HW changed bit */
|
|
|
|
#define _PAGE_REFERENCED 0x04 /* HW referenced bit */
|
|
|
|
#define _PAGE_FP_BIT 0x08 /* HW fetch protection bit */
|
|
|
|
#define _PAGE_ACC_BITS 0xf0 /* HW access control bits */
|
|
|
|
|
2008-05-07 07:22:59 +00:00
|
|
|
struct page;
|
|
|
|
void arch_free_page(struct page *page, int order);
|
|
|
|
void arch_alloc_page(struct page *page, int order);
|
2016-06-14 10:56:01 +00:00
|
|
|
void arch_set_page_dat(struct page *page, int order);
|
2008-05-07 07:22:59 +00:00
|
|
|
|
2010-11-10 09:05:55 +00:00
|
|
|
static inline int devmem_is_allowed(unsigned long pfn)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-05-07 07:22:59 +00:00
|
|
|
#define HAVE_ARCH_FREE_PAGE
|
|
|
|
#define HAVE_ARCH_ALLOC_PAGE
|
|
|
|
|
2020-01-21 08:48:44 +00:00
|
|
|
#if IS_ENABLED(CONFIG_PGSTE)
|
|
|
|
int arch_make_page_accessible(struct page *page);
|
|
|
|
#define HAVE_ARCH_MAKE_PAGE_ACCESSIBLE
|
|
|
|
#endif
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
|
2017-08-07 13:16:15 +00:00
|
|
|
#define __PAGE_OFFSET 0x0UL
|
|
|
|
#define PAGE_OFFSET 0x0UL
|
|
|
|
|
|
|
|
#define __pa(x) ((unsigned long)(x))
|
|
|
|
#define __va(x) ((void *)(unsigned long)(x))
|
|
|
|
|
2020-02-25 11:44:06 +00:00
|
|
|
#define phys_to_pfn(phys) ((phys) >> PAGE_SHIFT)
|
|
|
|
#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
|
|
|
|
|
|
|
|
#define phys_to_page(phys) pfn_to_page(phys_to_pfn(phys))
|
|
|
|
#define page_to_phys(page) pfn_to_phys(page_to_pfn(page))
|
|
|
|
|
|
|
|
#define pfn_to_virt(pfn) __va(pfn_to_phys(pfn))
|
|
|
|
#define virt_to_pfn(kaddr) (phys_to_pfn(__pa(kaddr)))
|
2017-11-17 10:21:49 +00:00
|
|
|
#define pfn_to_kaddr(pfn) pfn_to_virt(pfn)
|
2017-08-07 13:16:15 +00:00
|
|
|
|
|
|
|
#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
|
2015-11-16 09:45:03 +00:00
|
|
|
#define page_to_virt(page) pfn_to_virt(page_to_pfn(page))
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2020-02-25 11:44:06 +00:00
|
|
|
#define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr))
|
2017-08-07 13:16:15 +00:00
|
|
|
|
2020-04-10 21:33:05 +00:00
|
|
|
#define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_NON_EXEC
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-03-27 09:15:45 +00:00
|
|
|
#include <asm-generic/memory_model.h>
|
2009-05-13 22:56:30 +00:00
|
|
|
#include <asm-generic/getorder.h>
|
2005-09-03 22:54:30 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif /* _S390_PAGE_H */
|