mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 20:16:23 +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>
213 lines
6.1 KiB
ArmAsm
213 lines
6.1 KiB
ArmAsm
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* This routine clears to zero a linear memory buffer in user space.
|
|
*
|
|
* Inputs:
|
|
* in0: address of buffer
|
|
* in1: length of buffer in bytes
|
|
* Outputs:
|
|
* r8: number of bytes that didn't get cleared due to a fault
|
|
*
|
|
* Copyright (C) 1998, 1999, 2001 Hewlett-Packard Co
|
|
* Stephane Eranian <eranian@hpl.hp.com>
|
|
*/
|
|
|
|
#include <asm/asmmacro.h>
|
|
#include <asm/export.h>
|
|
|
|
//
|
|
// arguments
|
|
//
|
|
#define buf r32
|
|
#define len r33
|
|
|
|
//
|
|
// local registers
|
|
//
|
|
#define cnt r16
|
|
#define buf2 r17
|
|
#define saved_lc r18
|
|
#define saved_pfs r19
|
|
#define tmp r20
|
|
#define len2 r21
|
|
#define len3 r22
|
|
|
|
//
|
|
// Theory of operations:
|
|
// - we check whether or not the buffer is small, i.e., less than 17
|
|
// in which case we do the byte by byte loop.
|
|
//
|
|
// - Otherwise we go progressively from 1 byte store to 8byte store in
|
|
// the head part, the body is a 16byte store loop and we finish we the
|
|
// tail for the last 15 bytes.
|
|
// The good point about this breakdown is that the long buffer handling
|
|
// contains only 2 branches.
|
|
//
|
|
// The reason for not using shifting & masking for both the head and the
|
|
// tail is to stay semantically correct. This routine is not supposed
|
|
// to write bytes outside of the buffer. While most of the time this would
|
|
// be ok, we can't tolerate a mistake. A classical example is the case
|
|
// of multithreaded code were to the extra bytes touched is actually owned
|
|
// by another thread which runs concurrently to ours. Another, less likely,
|
|
// example is with device drivers where reading an I/O mapped location may
|
|
// have side effects (same thing for writing).
|
|
//
|
|
|
|
GLOBAL_ENTRY(__do_clear_user)
|
|
.prologue
|
|
.save ar.pfs, saved_pfs
|
|
alloc saved_pfs=ar.pfs,2,0,0,0
|
|
cmp.eq p6,p0=r0,len // check for zero length
|
|
.save ar.lc, saved_lc
|
|
mov saved_lc=ar.lc // preserve ar.lc (slow)
|
|
.body
|
|
;; // avoid WAW on CFM
|
|
adds tmp=-1,len // br.ctop is repeat/until
|
|
mov ret0=len // return value is length at this point
|
|
(p6) br.ret.spnt.many rp
|
|
;;
|
|
cmp.lt p6,p0=16,len // if len > 16 then long memset
|
|
mov ar.lc=tmp // initialize lc for small count
|
|
(p6) br.cond.dptk .long_do_clear
|
|
;; // WAR on ar.lc
|
|
//
|
|
// worst case 16 iterations, avg 8 iterations
|
|
//
|
|
// We could have played with the predicates to use the extra
|
|
// M slot for 2 stores/iteration but the cost the initialization
|
|
// the various counters compared to how long the loop is supposed
|
|
// to last on average does not make this solution viable.
|
|
//
|
|
1:
|
|
EX( .Lexit1, st1 [buf]=r0,1 )
|
|
adds len=-1,len // countdown length using len
|
|
br.cloop.dptk 1b
|
|
;; // avoid RAW on ar.lc
|
|
//
|
|
// .Lexit4: comes from byte by byte loop
|
|
// len contains bytes left
|
|
.Lexit1:
|
|
mov ret0=len // faster than using ar.lc
|
|
mov ar.lc=saved_lc
|
|
br.ret.sptk.many rp // end of short clear_user
|
|
|
|
|
|
//
|
|
// At this point we know we have more than 16 bytes to copy
|
|
// so we focus on alignment (no branches required)
|
|
//
|
|
// The use of len/len2 for countdown of the number of bytes left
|
|
// instead of ret0 is due to the fact that the exception code
|
|
// changes the values of r8.
|
|
//
|
|
.long_do_clear:
|
|
tbit.nz p6,p0=buf,0 // odd alignment (for long_do_clear)
|
|
;;
|
|
EX( .Lexit3, (p6) st1 [buf]=r0,1 ) // 1-byte aligned
|
|
(p6) adds len=-1,len;; // sync because buf is modified
|
|
tbit.nz p6,p0=buf,1
|
|
;;
|
|
EX( .Lexit3, (p6) st2 [buf]=r0,2 ) // 2-byte aligned
|
|
(p6) adds len=-2,len;;
|
|
tbit.nz p6,p0=buf,2
|
|
;;
|
|
EX( .Lexit3, (p6) st4 [buf]=r0,4 ) // 4-byte aligned
|
|
(p6) adds len=-4,len;;
|
|
tbit.nz p6,p0=buf,3
|
|
;;
|
|
EX( .Lexit3, (p6) st8 [buf]=r0,8 ) // 8-byte aligned
|
|
(p6) adds len=-8,len;;
|
|
shr.u cnt=len,4 // number of 128-bit (2x64bit) words
|
|
;;
|
|
cmp.eq p6,p0=r0,cnt
|
|
adds tmp=-1,cnt
|
|
(p6) br.cond.dpnt .dotail // we have less than 16 bytes left
|
|
;;
|
|
adds buf2=8,buf // setup second base pointer
|
|
mov ar.lc=tmp
|
|
;;
|
|
|
|
//
|
|
// 16bytes/iteration core loop
|
|
//
|
|
// The second store can never generate a fault because
|
|
// we come into the loop only when we are 16-byte aligned.
|
|
// This means that if we cross a page then it will always be
|
|
// in the first store and never in the second.
|
|
//
|
|
//
|
|
// We need to keep track of the remaining length. A possible (optimistic)
|
|
// way would be to use ar.lc and derive how many byte were left by
|
|
// doing : left= 16*ar.lc + 16. this would avoid the addition at
|
|
// every iteration.
|
|
// However we need to keep the synchronization point. A template
|
|
// M;;MB does not exist and thus we can keep the addition at no
|
|
// extra cycle cost (use a nop slot anyway). It also simplifies the
|
|
// (unlikely) error recovery code
|
|
//
|
|
|
|
2: EX(.Lexit3, st8 [buf]=r0,16 )
|
|
;; // needed to get len correct when error
|
|
st8 [buf2]=r0,16
|
|
adds len=-16,len
|
|
br.cloop.dptk 2b
|
|
;;
|
|
mov ar.lc=saved_lc
|
|
//
|
|
// tail correction based on len only
|
|
//
|
|
// We alternate the use of len3,len2 to allow parallelism and correct
|
|
// error handling. We also reuse p6/p7 to return correct value.
|
|
// The addition of len2/len3 does not cost anything more compared to
|
|
// the regular memset as we had empty slots.
|
|
//
|
|
.dotail:
|
|
mov len2=len // for parallelization of error handling
|
|
mov len3=len
|
|
tbit.nz p6,p0=len,3
|
|
;;
|
|
EX( .Lexit2, (p6) st8 [buf]=r0,8 ) // at least 8 bytes
|
|
(p6) adds len3=-8,len2
|
|
tbit.nz p7,p6=len,2
|
|
;;
|
|
EX( .Lexit2, (p7) st4 [buf]=r0,4 ) // at least 4 bytes
|
|
(p7) adds len2=-4,len3
|
|
tbit.nz p6,p7=len,1
|
|
;;
|
|
EX( .Lexit2, (p6) st2 [buf]=r0,2 ) // at least 2 bytes
|
|
(p6) adds len3=-2,len2
|
|
tbit.nz p7,p6=len,0
|
|
;;
|
|
EX( .Lexit2, (p7) st1 [buf]=r0 ) // only 1 byte left
|
|
mov ret0=r0 // success
|
|
br.ret.sptk.many rp // end of most likely path
|
|
|
|
//
|
|
// Outlined error handling code
|
|
//
|
|
|
|
//
|
|
// .Lexit3: comes from core loop, need restore pr/lc
|
|
// len contains bytes left
|
|
//
|
|
//
|
|
// .Lexit2:
|
|
// if p6 -> coming from st8 or st2 : len2 contains what's left
|
|
// if p7 -> coming from st4 or st1 : len3 contains what's left
|
|
// We must restore lc/pr even though might not have been used.
|
|
.Lexit2:
|
|
.pred.rel "mutex", p6, p7
|
|
(p6) mov len=len2
|
|
(p7) mov len=len3
|
|
;;
|
|
//
|
|
// .Lexit4: comes from head, need not restore pr/lc
|
|
// len contains bytes left
|
|
//
|
|
.Lexit3:
|
|
mov ret0=len
|
|
mov ar.lc=saved_lc
|
|
br.ret.sptk.many rp
|
|
END(__do_clear_user)
|
|
EXPORT_SYMBOL(__do_clear_user)
|