linux_dsm_epyc7002/arch/s390/kernel
Thomas Richter b6ffdf27f3 s390/cpumf: Fix warning from check_processor_id
Function __hw_perf_event_init() used a CPU variable without
ensuring CPU preemption has been disabled. This caused the
following warning in the kernel log:

  [ 7.277085] BUG: using smp_processor_id() in preemptible
                 [00000000] code: cf-csdiag/1892
  [ 7.277111] caller is cf_diag_event_init+0x13a/0x338
  [ 7.277122] CPU: 10 PID: 1892 Comm: cf-csdiag Not tainted
                 5.0.0-20190318.rc0.git0.9e1a11e0f602.300.fc29.s390x+debug #1
  [ 7.277131] Hardware name: IBM 2964 NC9 712 (LPAR)
  [ 7.277139] Call Trace:
  [ 7.277150] ([<000000000011385a>] show_stack+0x82/0xd0)
  [ 7.277161]  [<0000000000b7a71a>] dump_stack+0x92/0xd0
  [ 7.277174]  [<00000000007b7e9c>] check_preemption_disabled+0xe4/0x100
  [ 7.277183]  [<00000000001228aa>] cf_diag_event_init+0x13a/0x338
  [ 7.277195]  [<00000000002cf3aa>] perf_try_init_event+0x72/0xf0
  [ 7.277204]  [<00000000002d0bba>] perf_event_alloc+0x6fa/0xce0
  [ 7.277214]  [<00000000002dc4a8>] __s390x_sys_perf_event_open+0x398/0xd50
  [ 7.277224]  [<0000000000b9e8f0>] system_call+0xdc/0x2d8
  [ 7.277233] 2 locks held by cf-csdiag/1892:
  [ 7.277241]  #0: 00000000976f5510 (&sig->cred_guard_mutex){+.+.},
                  at: __s390x_sys_perf_event_open+0xd2e/0xd50
  [ 7.277257]  #1: 00000000363b11bd (&pmus_srcu){....},
                  at: perf_event_alloc+0x52e/0xce0

The variable is now accessed in proper context. Use
get_cpu_var()/put_cpu_var() pair to disable
preemption during access.
As the hardware authorization settings apply to all CPUs, it
does not matter which CPU is used to check the authorization setting.

Remove the event->count assignment. It is not needed as function
perf_event_alloc() allocates memory for the event with kzalloc() and
thus count is already set to zero.

Fixes: fe5908bccc ("s390/cpum_cf_diag: Add support for s390 counter facility diagnostic trace")

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2019-03-28 09:28:42 +01:00
..
syscalls y2038: add 64-bit time_t syscalls to all 32-bit architectures 2019-02-07 00:13:28 +01:00
vdso32 s390/vdso: add missing FORCE to build targets 2018-10-26 10:19:40 +02:00
vdso64 s390/vdso: add missing FORCE to build targets 2018-10-26 10:19:40 +02:00
.gitignore
alternative.c
asm-offsets.c s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
audit.c
audit.h
base.S s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
cache.c
compat_audit.c
compat_linux.c s390: use generic UID16 implementation 2019-01-18 09:33:18 +01:00
compat_linux.h
compat_ptrace.h
compat_signal.c
cpcmd.c
crash_dump.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
debug.c s390: no need to check return value of debugfs_create functions 2019-01-28 15:58:55 +01:00
diag.c s390/setup: set control program code via diag 318 2019-01-28 15:58:53 +01:00
dis.c
dumpstack.c s390/dumpstack: print psw mask and address again 2018-10-10 07:37:20 +02:00
early_nobss.c s390/kasan: add initialization code and enable it 2018-10-09 11:21:20 +02:00
early_printk.c s390/hibernate: fix error handling when suspend cpu != resume cpu 2018-09-20 13:20:23 +02:00
early.c s390 updates for the 5.1 merge window 2019-03-05 11:13:10 -08:00
ebcdic.c s390: ebcdic: convert comments to UTF-8 2018-08-23 18:48:43 -07:00
entry.h s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
entry.S s390: autogenerate compat syscall wrappers 2019-01-18 09:33:19 +01:00
fpu.c
ftrace.c s390/function_graph: Simplify with function_graph_enter() 2018-11-27 20:31:30 -05:00
guarded_storage.c
head64.S s390: remove dead code 2019-02-07 11:56:57 +01:00
idle.c
ipl_vmparm.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
ipl.c s390/kasan: reipl and kexec support 2018-10-09 11:21:27 +02:00
irq.c s390: unify stack size definitions 2018-10-09 11:20:58 +02:00
jump_label.c jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00
kdebugfs.c s390: no need to check return value of debugfs_create functions 2019-01-28 15:58:55 +01:00
kexec_elf.c
kexec_image.c
kprobes.c
lgr.c
machine_kexec_file.c s390, kexec_file: drop arch_kexec_mem_walk() 2018-12-06 14:38:49 +00:00
machine_kexec.c s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
Makefile s390/cpum_cf_diag: Add support for s390 counter facility diagnostic trace 2019-02-22 09:19:56 +01:00
mcount.S s390/ftrace: Add -mfentry and -mnop-mcount support 2018-08-15 22:39:53 -04:00
module.c s390/kasan: dynamic shadow mem allocation for modules 2018-10-09 11:21:23 +02:00
nmi.c
nospec-branch.c
nospec-sysfs.c
os_info.c
perf_cpum_cf_common.c s390/cpum_cf: move common functions into a separate file 2019-02-22 09:19:55 +01:00
perf_cpum_cf_diag.c s390/cpumf: Fix warning from check_processor_id 2019-03-28 09:28:42 +01:00
perf_cpum_cf_events.c s390/cpum_cf: move counter set controls to a new header file 2019-02-22 09:19:46 +01:00
perf_cpum_cf.c s390/cpum_cf: Handle EBUSY return code from CPU counter facility reservation 2019-02-22 09:19:58 +01:00
perf_cpum_sf.c s390/cpum_sf: Rework attribute definition for diagnostic sampling 2018-11-02 08:31:56 +01:00
perf_event.c
perf_regs.c
pgm_check.S
process.c
processor.c
ptrace.c
reipl.S
relocate_kernel.S
runtime_instr.c
setup.c s390 updates for the 5.1 merge window 2019-03-05 11:13:10 -08:00
signal.c
smp.c s390/vtime: steal time exponential moving average 2019-03-06 14:59:50 +01:00
stacktrace.c
sthyi.c s390/sthyi: Fix machine name validity indication 2018-10-15 12:17:00 +02:00
suspend.c
swsusp.S s390 updates for the 5.1 merge window 2019-03-05 11:13:10 -08:00
sys_s390.c s390: autogenerate compat syscall wrappers 2019-01-18 09:33:19 +01:00
sysinfo.c s390: no need to check return value of debugfs_create functions 2019-01-28 15:58:55 +01:00
time.c
topology.c mm: remove include/linux/bootmem.h 2018-10-31 08:54:16 -07:00
trace.c
traps.c
uprobes.c
vdso.c s390/vdso: correct vdso mapping for compat tasks 2019-01-11 17:12:02 +01:00
vmlinux.lds.S s390: avoid vmlinux segments overlap 2018-10-26 10:19:40 +02:00
vtime.c s390/vtime: steal time exponential moving average 2019-03-06 14:59:50 +01:00