Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1205014 > unrolled thread

[PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode

Started byXie XiuQi <xiexiuqi@huawei.com>
First post2015-08-11 12:20 +0200
Last post2015-08-12 04:10 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode Xie XiuQi <xiexiuqi@huawei.com> - 2015-08-11 12:20 +0200
    Re: [PATCH] x86/mce: fix failed to reenable cmci when swiching to  interrupt mode Borislav Petkov <bp@alien8.de> - 2015-08-11 16:50 +0200
      RE: [PATCH] x86/mce: fix failed to reenable cmci when swiching to  interrupt mode "Luck, Tony" <tony.luck@intel.com> - 2015-08-11 21:00 +0200
        Re: [PATCH] x86/mce: fix failed to reenable cmci when swiching to  interrupt mode Xie XiuQi <xiexiuqi@huawei.com> - 2015-08-12 04:10 +0200
      Re: [PATCH] x86/mce: fix failed to reenable cmci when swiching to  interrupt mode Xie XiuQi <xiexiuqi@huawei.com> - 2015-08-12 04:10 +0200

#1205014 — [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode

FromXie XiuQi <xiexiuqi@huawei.com>
Date2015-08-11 12:20 +0200
Subject[PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode
Message-ID<pWeP1-27X-51@gated-at.bofh.it>
Zhang Liguang report a bug as bellow:
1) system detected cmci storm on current cpu
2) disable cmci interrupt on banks ownd by current cpu, then swiching to poll mode
3) a few minites later, system swiching to interrupt mode on current cpu
4) we expect system to reenable cmci interrupt on banks ownd by current cpu
   mce_intel_adjust_timer
   |-> cmci_reenable
       |-> cmci_discover     # but, ownd banks is ignore here

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

In this patch, we add a func cmci_storm_enable_banks(), just to enable banks
which ownd by current cpu without clean the ownd flags. We call this func
instead of cmci_reenble() when swiching to interrupt mode.

Reported-by: Zhang Liguang <zhangliguang@huawei.com>
Cc: stable@vger.kernel.org  # v4.1+
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
---
 arch/x86/kernel/cpu/mcheck/mce_intel.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 844f56c..d4e98c7 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -146,6 +146,22 @@ void mce_intel_hcpu_update(unsigned long cpu)
 	per_cpu(cmci_storm_state, cpu) = CMCI_STORM_NONE;
 }
 
+static void cmci_storm_enable_banks(void)
+{
+	unsigned long flags, *owned;
+	int bank;
+	u64 val;
+
+	raw_spin_lock_irqsave(&cmci_discover_lock, flags);
+	owned = this_cpu_ptr(mce_banks_owned);
+	for_each_set_bit(bank, owned, MAX_NR_BANKS) {
+		rdmsrl(MSR_IA32_MCx_CTL2(bank), val);
+		val |= MCI_CTL2_CMCI_EN;
+		wrmsrl(MSR_IA32_MCx_CTL2(bank), val);
+	}
+	raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
+}
+
 unsigned long cmci_intel_adjust_timer(unsigned long interval)
 {
 	if ((this_cpu_read(cmci_backoff_cnt) > 0) &&
@@ -175,7 +191,7 @@ unsigned long cmci_intel_adjust_timer(unsigned long interval)
 		 */
 		if (!atomic_read(&cmci_storm_on_cpus)) {
 			__this_cpu_write(cmci_storm_state, CMCI_STORM_NONE);
-			cmci_reenable();
+			cmci_storm_enable_banks();
 			cmci_recheck();
 		}
 		return CMCI_POLL_INTERVAL;
-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1205189 — Re: [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode

FromBorislav Petkov <bp@alien8.de>
Date2015-08-11 16:50 +0200
SubjectRe: [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode
Message-ID<pWj2i-86m-31@gated-at.bofh.it>
In reply to#1205014
On Tue, Aug 11, 2015 at 06:09:37PM +0800, Xie XiuQi wrote:
> Zhang Liguang report a bug as bellow:
> 1) system detected cmci storm on current cpu
> 2) disable cmci interrupt on banks ownd by current cpu, then swiching to poll mode
> 3) a few minites later, system swiching to interrupt mode on current cpu
> 4) we expect system to reenable cmci interrupt on banks ownd by current cpu
>    mce_intel_adjust_timer
>    |-> cmci_reenable
>        |-> cmci_discover     # but, ownd banks is ignore here
> 
> > static void cmci_discover(int banks)
> >	...
> >	for (i = 0; i < banks; i++) {
> >		...
> >		if (test_bit(i, owned))	# ownd banks is ignore here
> >			continue;
> 
> In this patch, we add a func cmci_storm_enable_banks(), just to enable banks
> which ownd by current cpu without clean the ownd flags. We call this func
> instead of cmci_reenble() when swiching to interrupt mode.

Hmm, and we cannot clear the owned bit because those banks won't be
polled otherwise, see:

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

Yuck.

Well, ok, but do it differently, please: rename
cmci_storm_disable_banks() to cmci_storm_switch_banks(bool on) which
turns them on and off. Unless Tony has a better suggestion...

> Reported-by: Zhang Liguang <zhangliguang@huawei.com>
> Cc: stable@vger.kernel.org  # v4.1+

Why 4.1 only?

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205380 — RE: [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode

From"Luck, Tony" <tony.luck@intel.com>
Date2015-08-11 21:00 +0200
SubjectRE: [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode
Message-ID<pWmWe-5o0-21@gated-at.bofh.it>
In reply to#1205189
PiBXZWxsLCBvaywgYnV0IGRvIGl0IGRpZmZlcmVudGx5LCBwbGVhc2U6IHJlbmFtZQ0KPiBjbWNp
X3N0b3JtX2Rpc2FibGVfYmFua3MoKSB0byBjbWNpX3N0b3JtX3N3aXRjaF9iYW5rcyhib29sIG9u
KSB3aGljaA0KPiB0dXJucyB0aGVtIG9uIGFuZCBvZmYuIFVubGVzcyBUb255IGhhcyBhIGJldHRl
ciBzdWdnZXN0aW9uLi4uDQoNCkkgbGlrZSB0aGUgYm9vbGVhbiBhcmd1bWVudCAuLi4gYnV0IG5v
dCB0aGUgInN3aXRjaF9iYW5rcyIgbmFtZS4gSXQgc291bmRzIG1vcmUNCmxpa2Ugd2UgYXJlIGp1
Z2dsaW5nIGJldHdlZW4gYmFua3MsIHJhdGhlciB0aGFuIHNldHRpbmcgYSBzd2l0Y2gvZmxhZyBp
biBhIGJhbmsuDQoNCkhvdyBkb2VzICJjbWNpX3N0b3JtX3NldF9jbWNpKGJvb2wgb24pIiBzb3Vu
ZD8gIFRvbyBtYW55ICJjbWNpIiBpbiBvbmUgbmFtZT8NCg0KLVRvbnkNCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205552 — Re: [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode

FromXie XiuQi <xiexiuqi@huawei.com>
Date2015-08-12 04:10 +0200
SubjectRe: [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode
Message-ID<pWtEl-6Mj-13@gated-at.bofh.it>
In reply to#1205380
On 2015/8/12 2:52, Luck, Tony wrote:
>> Well, ok, but do it differently, please: rename
>> cmci_storm_disable_banks() to cmci_storm_switch_banks(bool on) which
>> turns them on and off. Unless Tony has a better suggestion...
>
> I like the boolean argument ... but not the "switch_banks" name. It sounds more
> like we are juggling between banks, rather than setting a switch/flag in a bank.
>
> How does "cmci_storm_set_cmci(bool on)" sound?  Too many "cmci" in one name?

Thanks, I'll use this name.

--
Xie XiuQi

>
> -Tony
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1205551 — Re: [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode

FromXie XiuQi <xiexiuqi@huawei.com>
Date2015-08-12 04:10 +0200
SubjectRe: [PATCH] x86/mce: fix failed to reenable cmci when swiching to interrupt mode
Message-ID<pWtEl-6Mj-11@gated-at.bofh.it>
In reply to#1205189
On 2015/8/11 22:46, Borislav Petkov wrote:
> On Tue, Aug 11, 2015 at 06:09:37PM +0800, Xie XiuQi wrote:
>> Zhang Liguang report a bug as bellow:
>> 1) system detected cmci storm on current cpu
>> 2) disable cmci interrupt on banks ownd by current cpu, then swiching to poll mode
>> 3) a few minites later, system swiching to interrupt mode on current cpu
>> 4) we expect system to reenable cmci interrupt on banks ownd by current cpu
>>     mce_intel_adjust_timer
>>     |-> cmci_reenable
>>         |-> cmci_discover     # but, ownd banks is ignore here
>>
>>> static void cmci_discover(int banks)
>>> 	...
>>> 	for (i = 0; i < banks; i++) {
>>> 		...
>>> 		if (test_bit(i, owned))	# ownd banks is ignore here
>>> 			continue;
>>
>> In this patch, we add a func cmci_storm_enable_banks(), just to enable banks
>> which ownd by current cpu without clean the ownd flags. We call this func
>> instead of cmci_reenble() when swiching to interrupt mode.
>
> Hmm, and we cannot clear the owned bit because those banks won't be
> polled otherwise, see:
>
> 27f6c573e0f7 ("x86, CMCI: Add proper detection of end of CMCI storms")

OK, thanks.

>
> Yuck.
>
> Well, ok, but do it differently, please: rename
> cmci_storm_disable_banks() to cmci_storm_switch_banks(bool on) which
> turns them on and off. Unless Tony has a better suggestion...
>
>> Reported-by: Zhang Liguang <zhangliguang@huawei.com>
>> Cc: stable@vger.kernel.org  # v4.1+
>
> Why 4.1 only?

My fault, it's v3.15+.

Thanks,
Xie XiuQi

>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web