x86/mce: Reenable CMCI banks when swiching back to interrupt mode
x86/mce: Reenable CMCI banks when swiching back to interrupt mode

Zhang Liguang reported the following issue:

1) System detects a CMCI storm on the current CPU.

2) Kernel disables the CMCI interrupt on banks owned by the
   current CPU and switches to poll mode

3) After the CMCI storm subsides, kernel switches back to
   interrupt mode

4) We expect the system to reenable the CMCI interrupt on banks
   owned by the current CPU

   mce_intel_adjust_timer
   |-> cmci_reenable
       |-> cmci_discover     # owned banks are ignored here

  static void cmci_discover(int banks)
	...
	for (i = 0; i < banks; i++) {
		...
		if (test_bit(i, owned))	# ownd banks is ignore here
			continue;

So convert cmci_storm_disable_banks() to
cmci_toggle_interrupt_mode() which controls whether to enable or
disable CMCI interrupts with its argument.

NB: We cannot clear the owned bit because the banks won't be
polled, otherwise. See:

  27f6c573e0f7 ("x86, CMCI: Add proper detection of end of CMCI storms")

for more info.

Reported-by: Zhang Liguang <c4f90526e5570b4d0d55e85e81d26c823daa01c7@huawei.com>
Signed-off-by: Xie XiuQi <2028ee332ef6b7042006b7f86166fb57d0680e49@huawei.com>
Signed-off-by: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@suse.de>
Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org> # v3.15+
Cc: H. Peter Anvin <8a453bad9912ffe59bc0f0b8abe03df9be19379e@zytor.com>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: Tony Luck <e7984595ec0368ff920a7b3521dc7093683f6f26@intel.com>
Cc: 907cb18f632f56970a1dc2ab34acaa162917635f@huawei.com
Cc: linux-edac <2f2877799b28945e915fed027ea960f3cffe53dd@vger.kernel.org>
Cc: 7510c11ed4d45beb000097fa9c56f5a59a5bb490@huawei.com
Link: 35cb0bfc4e89bec2ee4543f4e72a0760f4e8d449@alien8.de
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs