Skip to content

Commit c79f01b

Browse files
Thomas Richterhcahca
authored andcommitted
s390/cpumf: disable preemption when accessing per-cpu variable
The following BUG message was triggered repeatedly when complete counter sets are extracted from the CPUMF: BUG: using smp_processor_id() in preemptible [00000000] code: psvc-readsets/7759 caller is cf_diag_needspace+0x2c/0x100 CPU: 7 PID: 7759 Comm: psvc-readsets Not tainted 5.12.0 Hardware name: IBM 3906 M03 703 (LPAR) Call Trace: [<00000000c7043f78>] show_stack+0x90/0xf8 [<00000000c705776a>] dump_stack+0xba/0x108 [<00000000c705d91c>] check_preemption_disabled+0xec/0xf0 [<00000000c63eb1c4>] cf_diag_needspace+0x2c/0x100 [<00000000c63ecbcc>] cf_diag_ioctl_start+0x10c/0x240 [<00000000c63ece9a>] cf_diag_ioctl+0x19a/0x238 [<00000000c675f3f4>] __s390x_sys_ioctl+0xc4/0x100 [<00000000c63ca762>] do_syscall+0x82/0xd0 [<00000000c705bdd8>] __do_syscall+0xc0/0xd8 [<00000000c706d532>] system_call+0x72/0x98 2 locks held by psvc-readsets/7759: #0: 00000000c75a57c0 (cpu_hotplug_lock){++++}-{0:0}, at: cf_diag_ioctl+0x44/0x238 raspberrypi#1: 00000000c75a3078 (cf_diag_ctrset_mutex){+.+.}-{3:3}, at: cf_diag_ioctl+0x54/0x238 This issue is a missing get_cpu_ptr/put_cpu_ptr pair in function cf_diag_needspace. Add it. Fixes: cf6acb8 ("s390/cpumf: Add support for complete counter set extraction") Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 1e28eed commit c79f01b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎arch/s390/kernel/perf_cpum_cf_diag.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ static int cf_diag_all_start(void)
968968
*/
969969
static size_t cf_diag_needspace(unsigned int sets)
970970
{
971-
struct cpu_cf_events *cpuhw = this_cpu_ptr(&cpu_cf_events);
971+
struct cpu_cf_events *cpuhw = get_cpu_ptr(&cpu_cf_events);
972972
size_t bytes = 0;
973973
int i;
974974

@@ -984,6 +984,7 @@ static size_t cf_diag_needspace(unsigned int sets)
984984
sizeof(((struct s390_ctrset_cpudata *)0)->no_sets));
985985
debug_sprintf_event(cf_diag_dbg, 5, "%s bytes %ld\n", __func__,
986986
bytes);
987+
put_cpu_ptr(&cpu_cf_events);
987988
return bytes;
988989
}
989990

0 commit comments

Comments
 (0)