From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932245AbcKHSJt (ORCPT ); Tue, 8 Nov 2016 13:09:49 -0500 Received: from mail.skyhub.de ([78.46.96.112]:38257 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754035AbcKHSJs (ORCPT ); Tue, 8 Nov 2016 13:09:48 -0500 Date: Tue, 8 Nov 2016 19:09:32 +0100 From: Borislav Petkov To: "Luck, Tony" Cc: linux-edac , X86 ML , LKML Subject: Re: [PATCH] x86/MCE: Remove MCP_TIMESTAMP Message-ID: <20161108180932.wvvcbbzrzrai26eg@pd.tnic> References: <20161101120911.13163-1-bp@alien8.de> <20161105131104.drouavgezizz4w7v@pd.tnic> <3908561D78D1C84285E8C5FCA982C28F3A22720B@ORSMSX114.amr.corp.intel.com> <20161107180853.4uxlvtoychzhwr2q@pd.tnic> <3908561D78D1C84285E8C5FCA982C28F3A22728C@ORSMSX114.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F3A22728C@ORSMSX114.amr.corp.intel.com> User-Agent: NeoMutt/20161014 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 07, 2016 at 06:37:50PM +0000, Luck, Tony wrote: > Also to me ... and I think that's what used to happen (or at least was the > intent). How's that? This still preserves the precise TSC timestamp in intel_threshold_interrupt(). --- From: Borislav Petkov Date: Tue, 8 Nov 2016 16:20:05 +0100 Subject: [PATCH] x86/MCE: Correct TSC timestamping of error records We did have logic in the MCE code which would TSC-timestamp an error record only when it is exact - i.e., it wasn't detected by polling. This isn't the case anymore. So let's fix that: We have a TSC timestamp in the error record only when it has been a precise detection, i.e., either in the #MC handler or in one of the interrupt handlers (thresholding, deferred, ...). All other error records still have mce.time which contains the wall time in order to be able to place the error record in time approximately. Also, this fixes another bug where machine_check_poll() would clear mce.tsc unconditionally even if we requested precise MCP_TIMESTAMP logging. Signed-off-by: Borislav Petkov Cc: Tony Luck --- arch/x86/kernel/cpu/mcheck/mce.c | 3 +-- arch/x86/kernel/cpu/mcheck/mce_intel.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 4ca00474804b..b7a976d657f3 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -713,7 +713,6 @@ bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b) m.misc = 0; m.addr = 0; m.bank = i; - m.tsc = 0; barrier(); m.status = mce_rdmsrl(msr_ops.status(i)); @@ -1394,7 +1393,7 @@ static void mce_timer_fn(unsigned long data) iv = __this_cpu_read(mce_next_interval); if (mce_available(this_cpu_ptr(&cpu_info))) { - machine_check_poll(MCP_TIMESTAMP, this_cpu_ptr(&mce_poll_banks)); + machine_check_poll(0, this_cpu_ptr(&mce_poll_banks)); if (mce_intel_cmci_poll()) { iv = mce_adjust_timer(iv); diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c index 1defb8ea882c..be0b2fad47c5 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_intel.c +++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c @@ -130,7 +130,7 @@ bool mce_intel_cmci_poll(void) * Reset the counter if we've logged an error in the last poll * during the storm. */ - if (machine_check_poll(MCP_TIMESTAMP, this_cpu_ptr(&mce_banks_owned))) + if (machine_check_poll(0, this_cpu_ptr(&mce_banks_owned))) this_cpu_write(cmci_backoff_cnt, INITIAL_CHECK_INTERVAL); else this_cpu_dec(cmci_backoff_cnt); @@ -342,7 +342,7 @@ void cmci_recheck(void) return; local_irq_save(flags); - machine_check_poll(MCP_TIMESTAMP, this_cpu_ptr(&mce_banks_owned)); + machine_check_poll(0, this_cpu_ptr(&mce_banks_owned)); local_irq_restore(flags); } -- 2.10.0 -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.