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 17:07:57 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
* Generate definitions needed by assembly language modules.
|
|
|
|
* This code generates raw asm output which is post-processed to extract
|
|
|
|
* and format the required data.
|
|
|
|
*/
|
|
|
|
|
2010-02-27 00:37:43 +03:00
|
|
|
#define ASM_OFFSETS_C
|
|
|
|
|
2008-04-29 12:04:09 +04:00
|
|
|
#include <linux/kbuild.h>
|
2013-05-17 16:41:34 +04:00
|
|
|
#include <linux/kvm_host.h>
|
2010-02-27 00:37:43 +03:00
|
|
|
#include <linux/sched.h>
|
2017-08-28 16:32:36 +03:00
|
|
|
#include <linux/purgatory.h>
|
2014-10-01 12:57:57 +04:00
|
|
|
#include <asm/idle.h>
|
2008-12-25 15:38:36 +03:00
|
|
|
#include <asm/vdso.h>
|
2011-09-20 19:07:28 +04:00
|
|
|
#include <asm/pgtable.h>
|
2016-03-08 13:49:57 +03:00
|
|
|
#include <asm/gmap.h>
|
2017-10-12 14:24:48 +03:00
|
|
|
#include <asm/nmi.h>
|
2019-01-28 10:33:08 +03:00
|
|
|
#include <asm/stacktrace.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2015-10-05 14:04:09 +03:00
|
|
|
/* task struct offsets */
|
2016-11-08 13:08:26 +03:00
|
|
|
OFFSET(__TASK_stack, task_struct, stack);
|
2015-10-05 14:04:09 +03:00
|
|
|
OFFSET(__TASK_thread, task_struct, thread);
|
|
|
|
OFFSET(__TASK_pid, task_struct, pid);
|
2005-04-17 02:20:36 +04:00
|
|
|
BLANK();
|
2015-10-05 14:04:09 +03:00
|
|
|
/* thread struct offsets */
|
|
|
|
OFFSET(__THREAD_ksp, thread_struct, ksp);
|
2016-11-08 14:33:38 +03:00
|
|
|
OFFSET(__THREAD_sysc_table, thread_struct, sys_call_table);
|
|
|
|
OFFSET(__THREAD_last_break, thread_struct, last_break);
|
2015-10-05 14:04:09 +03:00
|
|
|
OFFSET(__THREAD_FPU_fpc, thread_struct, fpu.fpc);
|
|
|
|
OFFSET(__THREAD_FPU_regs, thread_struct, fpu.regs);
|
|
|
|
OFFSET(__THREAD_per_cause, thread_struct, per_event.cause);
|
|
|
|
OFFSET(__THREAD_per_address, thread_struct, per_event.address);
|
|
|
|
OFFSET(__THREAD_per_paid, thread_struct, per_event.paid);
|
|
|
|
OFFSET(__THREAD_trap_tdb, thread_struct, trap_tdb);
|
2005-04-17 02:20:36 +04:00
|
|
|
BLANK();
|
2015-10-05 14:04:09 +03:00
|
|
|
/* thread info offsets */
|
2016-11-08 13:08:26 +03:00
|
|
|
OFFSET(__TI_flags, task_struct, thread_info.flags);
|
2005-04-17 02:20:36 +04:00
|
|
|
BLANK();
|
2015-10-05 14:04:09 +03:00
|
|
|
/* pt_regs offsets */
|
|
|
|
OFFSET(__PT_ARGS, pt_regs, args);
|
|
|
|
OFFSET(__PT_PSW, pt_regs, psw);
|
|
|
|
OFFSET(__PT_GPRS, pt_regs, gprs);
|
|
|
|
OFFSET(__PT_ORIG_GPR2, pt_regs, orig_gpr2);
|
|
|
|
OFFSET(__PT_INT_CODE, pt_regs, int_code);
|
|
|
|
OFFSET(__PT_INT_PARM, pt_regs, int_parm);
|
|
|
|
OFFSET(__PT_INT_PARM_LONG, pt_regs, int_parm_long);
|
|
|
|
OFFSET(__PT_FLAGS, pt_regs, flags);
|
2008-04-29 12:04:10 +04:00
|
|
|
DEFINE(__PT_SIZE, sizeof(struct pt_regs));
|
2005-04-17 02:20:36 +04:00
|
|
|
BLANK();
|
2015-10-05 14:04:09 +03:00
|
|
|
/* stack_frame offsets */
|
|
|
|
OFFSET(__SF_BACKCHAIN, stack_frame, back_chain);
|
|
|
|
OFFSET(__SF_GPRS, stack_frame, gprs);
|
|
|
|
OFFSET(__SF_EMPTY, stack_frame, empty1);
|
2017-06-07 12:30:42 +03:00
|
|
|
OFFSET(__SF_SIE_CONTROL, stack_frame, empty1[0]);
|
|
|
|
OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty1[1]);
|
|
|
|
OFFSET(__SF_SIE_REASON, stack_frame, empty1[2]);
|
2018-03-20 15:33:43 +03:00
|
|
|
OFFSET(__SF_SIE_FLAGS, stack_frame, empty1[3]);
|
2008-12-25 15:38:36 +03:00
|
|
|
BLANK();
|
|
|
|
/* timeval/timezone offsets for use by vdso */
|
2015-10-05 14:04:09 +03:00
|
|
|
OFFSET(__VDSO_UPD_COUNT, vdso_data, tb_update_count);
|
|
|
|
OFFSET(__VDSO_XTIME_STAMP, vdso_data, xtime_tod_stamp);
|
|
|
|
OFFSET(__VDSO_XTIME_SEC, vdso_data, xtime_clock_sec);
|
|
|
|
OFFSET(__VDSO_XTIME_NSEC, vdso_data, xtime_clock_nsec);
|
|
|
|
OFFSET(__VDSO_XTIME_CRS_SEC, vdso_data, xtime_coarse_sec);
|
|
|
|
OFFSET(__VDSO_XTIME_CRS_NSEC, vdso_data, xtime_coarse_nsec);
|
|
|
|
OFFSET(__VDSO_WTOM_SEC, vdso_data, wtom_clock_sec);
|
|
|
|
OFFSET(__VDSO_WTOM_NSEC, vdso_data, wtom_clock_nsec);
|
|
|
|
OFFSET(__VDSO_WTOM_CRS_SEC, vdso_data, wtom_coarse_sec);
|
|
|
|
OFFSET(__VDSO_WTOM_CRS_NSEC, vdso_data, wtom_coarse_nsec);
|
|
|
|
OFFSET(__VDSO_TIMEZONE, vdso_data, tz_minuteswest);
|
|
|
|
OFFSET(__VDSO_ECTG_OK, vdso_data, ectg_available);
|
|
|
|
OFFSET(__VDSO_TK_MULT, vdso_data, tk_mult);
|
|
|
|
OFFSET(__VDSO_TK_SHIFT, vdso_data, tk_shift);
|
2016-10-11 13:49:50 +03:00
|
|
|
OFFSET(__VDSO_TS_DIR, vdso_data, ts_dir);
|
|
|
|
OFFSET(__VDSO_TS_END, vdso_data, ts_end);
|
2015-10-05 14:04:09 +03:00
|
|
|
OFFSET(__VDSO_ECTG_BASE, vdso_per_cpu_data, ectg_timer_base);
|
|
|
|
OFFSET(__VDSO_ECTG_USER, vdso_per_cpu_data, ectg_user_time);
|
2016-01-05 15:29:38 +03:00
|
|
|
OFFSET(__VDSO_CPU_NR, vdso_per_cpu_data, cpu_nr);
|
|
|
|
OFFSET(__VDSO_NODE_ID, vdso_per_cpu_data, node_id);
|
2015-10-05 14:04:09 +03:00
|
|
|
BLANK();
|
2008-12-25 15:38:36 +03:00
|
|
|
/* constants used by the vdso */
|
2010-10-29 18:50:41 +04:00
|
|
|
DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME);
|
|
|
|
DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
|
2014-08-29 14:31:45 +04:00
|
|
|
DEFINE(__CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
|
|
|
|
DEFINE(__CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE);
|
2013-12-02 17:54:56 +04:00
|
|
|
DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID);
|
2010-10-29 18:50:41 +04:00
|
|
|
DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
|
2014-08-29 14:31:45 +04:00
|
|
|
DEFINE(__CLOCK_COARSE_RES, LOW_RES_NSEC);
|
2010-02-27 00:37:43 +03:00
|
|
|
BLANK();
|
2012-03-11 19:59:27 +04:00
|
|
|
/* idle data offsets */
|
2015-10-05 14:04:09 +03:00
|
|
|
OFFSET(__CLOCK_IDLE_ENTER, s390_idle_data, clock_idle_enter);
|
|
|
|
OFFSET(__CLOCK_IDLE_EXIT, s390_idle_data, clock_idle_exit);
|
|
|
|
OFFSET(__TIMER_IDLE_ENTER, s390_idle_data, timer_idle_enter);
|
|
|
|
OFFSET(__TIMER_IDLE_EXIT, s390_idle_data, timer_idle_exit);
|
2012-03-11 19:59:26 +04:00
|
|
|
BLANK();
|
2015-10-05 14:04:09 +03:00
|
|
|
/* hardware defined lowcore locations 0x000 - 0x1ff */
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_EXT_PARAMS, lowcore, ext_params);
|
|
|
|
OFFSET(__LC_EXT_CPU_ADDR, lowcore, ext_cpu_addr);
|
|
|
|
OFFSET(__LC_EXT_INT_CODE, lowcore, ext_int_code);
|
|
|
|
OFFSET(__LC_SVC_ILC, lowcore, svc_ilc);
|
|
|
|
OFFSET(__LC_SVC_INT_CODE, lowcore, svc_code);
|
|
|
|
OFFSET(__LC_PGM_ILC, lowcore, pgm_ilc);
|
|
|
|
OFFSET(__LC_PGM_INT_CODE, lowcore, pgm_code);
|
|
|
|
OFFSET(__LC_DATA_EXC_CODE, lowcore, data_exc_code);
|
|
|
|
OFFSET(__LC_MON_CLASS_NR, lowcore, mon_class_num);
|
|
|
|
OFFSET(__LC_PER_CODE, lowcore, per_code);
|
|
|
|
OFFSET(__LC_PER_ATMID, lowcore, per_atmid);
|
|
|
|
OFFSET(__LC_PER_ADDRESS, lowcore, per_address);
|
|
|
|
OFFSET(__LC_EXC_ACCESS_ID, lowcore, exc_access_id);
|
|
|
|
OFFSET(__LC_PER_ACCESS_ID, lowcore, per_access_id);
|
|
|
|
OFFSET(__LC_OP_ACCESS_ID, lowcore, op_access_id);
|
|
|
|
OFFSET(__LC_AR_MODE_ID, lowcore, ar_mode_id);
|
|
|
|
OFFSET(__LC_TRANS_EXC_CODE, lowcore, trans_exc_code);
|
|
|
|
OFFSET(__LC_MON_CODE, lowcore, monitor_code);
|
|
|
|
OFFSET(__LC_SUBCHANNEL_ID, lowcore, subchannel_id);
|
|
|
|
OFFSET(__LC_SUBCHANNEL_NR, lowcore, subchannel_nr);
|
|
|
|
OFFSET(__LC_IO_INT_PARM, lowcore, io_int_parm);
|
|
|
|
OFFSET(__LC_IO_INT_WORD, lowcore, io_int_word);
|
|
|
|
OFFSET(__LC_STFL_FAC_LIST, lowcore, stfl_fac_list);
|
|
|
|
OFFSET(__LC_STFLE_FAC_LIST, lowcore, stfle_fac_list);
|
|
|
|
OFFSET(__LC_MCCK_CODE, lowcore, mcck_interruption_code);
|
2016-08-03 13:25:08 +03:00
|
|
|
OFFSET(__LC_EXT_DAMAGE_CODE, lowcore, external_damage_code);
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_MCCK_FAIL_STOR_ADDR, lowcore, failing_storage_address);
|
|
|
|
OFFSET(__LC_LAST_BREAK, lowcore, breaking_event_addr);
|
|
|
|
OFFSET(__LC_RST_OLD_PSW, lowcore, restart_old_psw);
|
|
|
|
OFFSET(__LC_EXT_OLD_PSW, lowcore, external_old_psw);
|
|
|
|
OFFSET(__LC_SVC_OLD_PSW, lowcore, svc_old_psw);
|
|
|
|
OFFSET(__LC_PGM_OLD_PSW, lowcore, program_old_psw);
|
|
|
|
OFFSET(__LC_MCK_OLD_PSW, lowcore, mcck_old_psw);
|
|
|
|
OFFSET(__LC_IO_OLD_PSW, lowcore, io_old_psw);
|
|
|
|
OFFSET(__LC_RST_NEW_PSW, lowcore, restart_psw);
|
|
|
|
OFFSET(__LC_EXT_NEW_PSW, lowcore, external_new_psw);
|
|
|
|
OFFSET(__LC_SVC_NEW_PSW, lowcore, svc_new_psw);
|
|
|
|
OFFSET(__LC_PGM_NEW_PSW, lowcore, program_new_psw);
|
|
|
|
OFFSET(__LC_MCK_NEW_PSW, lowcore, mcck_new_psw);
|
|
|
|
OFFSET(__LC_IO_NEW_PSW, lowcore, io_new_psw);
|
2015-10-05 14:04:09 +03:00
|
|
|
/* software defined lowcore locations 0x200 - 0xdff*/
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_SAVE_AREA_SYNC, lowcore, save_area_sync);
|
|
|
|
OFFSET(__LC_SAVE_AREA_ASYNC, lowcore, save_area_async);
|
|
|
|
OFFSET(__LC_SAVE_AREA_RESTART, lowcore, save_area_restart);
|
|
|
|
OFFSET(__LC_CPU_FLAGS, lowcore, cpu_flags);
|
|
|
|
OFFSET(__LC_RETURN_PSW, lowcore, return_psw);
|
|
|
|
OFFSET(__LC_RETURN_MCCK_PSW, lowcore, return_mcck_psw);
|
|
|
|
OFFSET(__LC_SYNC_ENTER_TIMER, lowcore, sync_enter_timer);
|
|
|
|
OFFSET(__LC_ASYNC_ENTER_TIMER, lowcore, async_enter_timer);
|
|
|
|
OFFSET(__LC_MCCK_ENTER_TIMER, lowcore, mcck_enter_timer);
|
|
|
|
OFFSET(__LC_EXIT_TIMER, lowcore, exit_timer);
|
|
|
|
OFFSET(__LC_USER_TIMER, lowcore, user_timer);
|
|
|
|
OFFSET(__LC_SYSTEM_TIMER, lowcore, system_timer);
|
|
|
|
OFFSET(__LC_STEAL_TIMER, lowcore, steal_timer);
|
|
|
|
OFFSET(__LC_LAST_UPDATE_TIMER, lowcore, last_update_timer);
|
|
|
|
OFFSET(__LC_LAST_UPDATE_CLOCK, lowcore, last_update_clock);
|
|
|
|
OFFSET(__LC_INT_CLOCK, lowcore, int_clock);
|
|
|
|
OFFSET(__LC_MCCK_CLOCK, lowcore, mcck_clock);
|
2017-10-12 14:24:48 +03:00
|
|
|
OFFSET(__LC_CLOCK_COMPARATOR, lowcore, clock_comparator);
|
2016-10-27 13:41:39 +03:00
|
|
|
OFFSET(__LC_BOOT_CLOCK, lowcore, boot_clock);
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_CURRENT, lowcore, current_task);
|
|
|
|
OFFSET(__LC_KERNEL_STACK, lowcore, kernel_stack);
|
|
|
|
OFFSET(__LC_ASYNC_STACK, lowcore, async_stack);
|
2017-09-12 17:37:33 +03:00
|
|
|
OFFSET(__LC_NODAT_STACK, lowcore, nodat_stack);
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_RESTART_STACK, lowcore, restart_stack);
|
|
|
|
OFFSET(__LC_RESTART_FN, lowcore, restart_fn);
|
|
|
|
OFFSET(__LC_RESTART_DATA, lowcore, restart_data);
|
|
|
|
OFFSET(__LC_RESTART_SOURCE, lowcore, restart_source);
|
|
|
|
OFFSET(__LC_USER_ASCE, lowcore, user_asce);
|
s390: remove all code using the access register mode
The vdso code for the getcpu() and the clock_gettime() call use the access
register mode to access the per-CPU vdso data page with the current code.
An alternative to the complicated AR mode is to use the secondary space
mode. This makes the vdso faster and quite a bit simpler. The downside is
that the uaccess code has to be changed quite a bit.
Which instructions are used depends on the machine and what kind of uaccess
operation is requested. The instruction dictates which ASCE value needs
to be loaded into %cr1 and %cr7.
The different cases:
* User copy with MVCOS for z10 and newer machines
The MVCOS instruction can copy between the primary space (aka user) and
the home space (aka kernel) directly. For set_fs(KERNEL_DS) the kernel
ASCE is loaded into %cr1. For set_fs(USER_DS) the user space is already
loaded in %cr1.
* User copy with MVCP/MVCS for older machines
To be able to execute the MVCP/MVCS instructions the kernel needs to
switch to primary mode. The control register %cr1 has to be set to the
kernel ASCE and %cr7 to either the kernel ASCE or the user ASCE dependent
on set_fs(KERNEL_DS) vs set_fs(USER_DS).
* Data access in the user address space for strnlen / futex
To use "normal" instruction with data from the user address space the
secondary space mode is used. The kernel needs to switch to primary mode,
%cr1 has to contain the kernel ASCE and %cr7 either the user ASCE or the
kernel ASCE, dependent on set_fs.
To load a new value into %cr1 or %cr7 is an expensive operation, the kernel
tries to be lazy about it. E.g. for multiple user copies in a row with
MVCP/MVCS the replacement of the vdso ASCE in %cr7 with the user ASCE is
done only once. On return to user space a CPU bit is checked that loads the
vdso ASCE again.
To enable and disable the data access via the secondary space two new
functions are added, enable_sacf_uaccess and disable_sacf_uaccess. The fact
that a context is in secondary space uaccess mode is stored in the
mm_segment_t value for the task. The code of an interrupt may use set_fs
as long as it returns to the previous state it got with get_fs with another
call to set_fs. The code in finish_arch_post_lock_switch simply has to do a
set_fs with the current mm_segment_t value for the task.
For CPUs with MVCOS:
CPU running in | %cr1 ASCE | %cr7 ASCE |
--------------------------------------|-----------|-----------|
user space | user | vdso |
kernel, USER_DS, normal-mode | user | vdso |
kernel, USER_DS, normal-mode, lazy | user | user |
kernel, USER_DS, sacf-mode | kernel | user |
kernel, KERNEL_DS, normal-mode | kernel | vdso |
kernel, KERNEL_DS, normal-mode, lazy | kernel | kernel |
kernel, KERNEL_DS, sacf-mode | kernel | kernel |
For CPUs without MVCOS:
CPU running in | %cr1 ASCE | %cr7 ASCE |
--------------------------------------|-----------|-----------|
user space | user | vdso |
kernel, USER_DS, normal-mode | user | vdso |
kernel, USER_DS, normal-mode lazy | kernel | user |
kernel, USER_DS, sacf-mode | kernel | user |
kernel, KERNEL_DS, normal-mode | kernel | vdso |
kernel, KERNEL_DS, normal-mode, lazy | kernel | kernel |
kernel, KERNEL_DS, sacf-mode | kernel | kernel |
The lines with "lazy" refer to the state after a copy via the secondary
space with a delayed reload of %cr1 and %cr7.
There are three hardware address spaces that can cause a DAT exception,
primary, secondary and home space. The exception can be related to
four different fault types: user space fault, vdso fault, kernel fault,
and the gmap faults.
Dependent on the set_fs state and normal vs. sacf mode there are a number
of fault combinations:
1) user address space fault via the primary ASCE
2) gmap address space fault via the primary ASCE
3) kernel address space fault via the primary ASCE for machines with
MVCOS and set_fs(KERNEL_DS)
4) vdso address space faults via the secondary ASCE with an invalid
address while running in secondary space in problem state
5) user address space fault via the secondary ASCE for user-copy
based on the secondary space mode, e.g. futex_ops or strnlen_user
6) kernel address space fault via the secondary ASCE for user-copy
with secondary space mode with set_fs(KERNEL_DS)
7) kernel address space fault via the primary ASCE for user-copy
with secondary space mode with set_fs(USER_DS) on machines without
MVCOS.
8) kernel address space fault via the home space ASCE
Replace user_space_fault() with a new function get_fault_type() that
can distinguish all four different fault types.
With these changes the futex atomic ops from the kernel and the
strnlen_user will get a little bit slower, as well as the old style
uaccess with MVCP/MVCS. All user accesses based on MVCOS will be as
fast as before. On the positive side, the user space vdso code is a
lot faster and Linux ceases to use the complicated AR mode.
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2017-08-22 13:08:22 +03:00
|
|
|
OFFSET(__LC_VDSO_ASCE, lowcore, vdso_asce);
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_LPP, lowcore, lpp);
|
|
|
|
OFFSET(__LC_CURRENT_PID, lowcore, current_pid);
|
|
|
|
OFFSET(__LC_PERCPU_OFFSET, lowcore, percpu_offset);
|
|
|
|
OFFSET(__LC_VDSO_PER_CPU, lowcore, vdso_per_cpu_data);
|
|
|
|
OFFSET(__LC_MACHINE_FLAGS, lowcore, machine_flags);
|
2016-10-25 13:21:44 +03:00
|
|
|
OFFSET(__LC_PREEMPT_COUNT, lowcore, preempt_count);
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_GMAP, lowcore, gmap);
|
2018-04-25 19:35:26 +03:00
|
|
|
OFFSET(__LC_BR_R1, lowcore, br_r1_trampoline);
|
2015-10-05 14:04:09 +03:00
|
|
|
/* software defined ABI-relevant lowcore locations 0xe00 - 0xe20 */
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_DUMP_REIPL, lowcore, ipib);
|
2015-10-05 14:04:09 +03:00
|
|
|
/* hardware defined lowcore locations 0x1000 - 0x18ff */
|
2016-01-26 16:10:34 +03:00
|
|
|
OFFSET(__LC_MCESAD, lowcore, mcesad);
|
2015-12-31 12:29:00 +03:00
|
|
|
OFFSET(__LC_EXT_PARAMS2, lowcore, ext_params2);
|
|
|
|
OFFSET(__LC_FPREGS_SAVE_AREA, lowcore, floating_pt_save_area);
|
|
|
|
OFFSET(__LC_GPREGS_SAVE_AREA, lowcore, gpregs_save_area);
|
|
|
|
OFFSET(__LC_PSW_SAVE_AREA, lowcore, psw_save_area);
|
|
|
|
OFFSET(__LC_PREFIX_SAVE_AREA, lowcore, prefixreg_save_area);
|
|
|
|
OFFSET(__LC_FP_CREG_SAVE_AREA, lowcore, fpt_creg_save_area);
|
|
|
|
OFFSET(__LC_TOD_PROGREG_SAVE_AREA, lowcore, tod_progreg_save_area);
|
|
|
|
OFFSET(__LC_CPU_TIMER_SAVE_AREA, lowcore, cpu_timer_save_area);
|
|
|
|
OFFSET(__LC_CLOCK_COMP_SAVE_AREA, lowcore, clock_comp_save_area);
|
|
|
|
OFFSET(__LC_AREGS_SAVE_AREA, lowcore, access_regs_save_area);
|
|
|
|
OFFSET(__LC_CREGS_SAVE_AREA, lowcore, cregs_save_area);
|
|
|
|
OFFSET(__LC_PGM_TDB, lowcore, pgm_tdb);
|
2012-03-11 19:59:26 +04:00
|
|
|
BLANK();
|
2017-10-12 14:24:48 +03:00
|
|
|
/* extended machine check save area */
|
|
|
|
OFFSET(__MCESA_GS_SAVE_AREA, mcesa, guarded_storage_save_area);
|
|
|
|
BLANK();
|
2015-10-05 14:04:09 +03:00
|
|
|
/* gmap/sie offsets */
|
|
|
|
OFFSET(__GMAP_ASCE, gmap, asce);
|
|
|
|
OFFSET(__SIE_PROG0C, kvm_s390_sie_block, prog0c);
|
|
|
|
OFFSET(__SIE_PROG20, kvm_s390_sie_block, prog20);
|
2017-08-28 16:32:36 +03:00
|
|
|
/* kexec_sha_region */
|
|
|
|
OFFSET(__KEXEC_SHA_REGION_START, kexec_sha_region, start);
|
|
|
|
OFFSET(__KEXEC_SHA_REGION_LEN, kexec_sha_region, len);
|
|
|
|
DEFINE(__KEXEC_SHA_REGION_SIZE, sizeof(struct kexec_sha_region));
|
2005-04-17 02:20:36 +04:00
|
|
|
return 0;
|
|
|
|
}
|