Subject: SMT off triggers WARNING: CPU: 1 PID: 13 at arch/powerpc/kernel/watchdog.c:314 stop_wd_on_cpu+0x54/0xf0

From: Abdul Haleem <[email-masked]>
Date: Mon, 03 Jul 2017 11:25:18 +0530

Hi,

Today's next-20170630 on powerpc shows warnings in dmesg when SMT is
disabled.

Test: SMT off
kernel: 4.12.0-rc7-next-20170630
Machine: Power 8 Bare-metal
gcc: 4.8.5
config: attached

Steps to recreate
-----------------
1. Boot powerpc machine with today's next kernel.
By default SMT 8 is enabled.
$ ppc64_cpu  --smt
SMT=8

2. Disable SMT
$ ppc64_cpu --smt=off

With above command a WARN_ON(1) is triggered from stop_wd_on_cpu
function in file arch/powerpc/kernel/watchdog.c at line 314

static int stop_wd_on_cpu(unsigned int cpu)
{
    if (!cpumask_test_cpu(cpu, &wd_cpus_enabled)) {
>>>     WARN_ON(1);
        return 0;
    }

$ dmesg
WARNING: CPU: 1 PID: 13 at arch/powerpc/kernel/watchdog.c:314 stop_wd_on_cpu+0x54/0xf0
Modules linked in: iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4
iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4
xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp tun bridge
stp llc kvm_hv kvm iptable_filter vmx_crypto ipmi_powernv ipmi_devintf
leds_powernv ipmi_msghandler powernv_op_panel powernv_rng led_class
rng_core binfmt_misc nfsd ip_tables x_tables autofs4
CPU: 1 PID: 13 Comm: cpuhp/1 Not tainted
4.12.0-rc7-next-20170630-autotest #1
task: c0000007f8479200 task.stack: c0000007f8578000
NIP: c00000000002cbd4 LR: c0000000000dc238 CTR: c00000000002cb80
REGS: c0000007f857b9b0 TRAP: 0700   Not tainted  (4.12.0-rc7-next-20170630-autotest)
MSR: 9000000000029033 <SF,HV,EE,ME,IR,DR,RI,LE>
  CR: 24000028  XER: 00000000  
CFAR: c0000000000dc234 SOFTE: 1 
GPR00: c0000000000dc238 c0000007f857bc30 c000000001063000 0000000000000001
GPR04: 000000000000009e 0000000000000000 0000000000000000 0000000000000000
GPR08: 0000000000000001 0000000000000000 0000000000000000 0000000000000000
GPR12: c00000000002cb80 c00000000fd40580 c000000000107348 c0000007fc163d80
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 0000000000000000 0000000000000000 0000000000000000 c00000000010ccc0
GPR24: c000000000f47888 00000007fe810000 0000000000000000 c00000000002cb80
GPR28: 000000000000009e 0000000000000000 c0000000010a1b80 0000000000000001
NIP [c00000000002cbd4] stop_wd_on_cpu+0x54/0xf0
LR [c0000000000dc238] cpuhp_invoke_callback+0x148/0x5b0
Call Trace:
[c0000007f857bc70] [c0000000000dc238] cpuhp_invoke_callback+0x148/0x5b0
[c0000007f857bce0] [c0000000000dc818] cpuhp_down_callbacks+0x78/0xf0
[c0000007f857bd30] [c0000000000dd86c] cpuhp_thread_fun+0x16c/0x180
[c0000007f857bd60] [c00000000010cf50] smpboot_thread_fn+0x290/0x2a0
[c0000007f857bdc0] [c0000000001074a0] kthread+0x160/0x1a0
[c0000007f857be30] [c00000000000bc9c] ret_from_kernel_thread+0x5c/0xc0
Instruction dump:
3d420004 394aeb80 7fa907b4 57e806be 79291f24 f8010010 f821ffc1 7fca4a14 
7cea482a 7ce94436 792a07e1 40820030 <0fe00000> 38210040 38600000 e8010010 
---[ end trace bc1cf8bfb9c5be6e ]---

-- 
Regard's

Abdul Haleem
IBM Linux Technology Centre