From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752107AbdBWGCc (ORCPT ); Thu, 23 Feb 2017 01:02:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56188 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbdBWGCb (ORCPT ); Thu, 23 Feb 2017 01:02:31 -0500 Reply-To: xlpang@redhat.com Subject: Re: [PATCH v3] x86/mce: Don't participate in rendezvous process once nmi_shootdown_cpus() was made References: <1487736674-2058-1-git-send-email-xlpang@redhat.com> <20170222185015.GA6141@intel.com> To: "Luck, Tony" , Xunlei Pang Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, Borislav Petkov , Ingo Molnar , Dave Young , Prarit Bhargava , Junichi Nomura , Kiyoshi Ueda , Naoya Horiguchi From: Xunlei Pang Message-ID: <58AE7B82.2040008@redhat.com> Date: Thu, 23 Feb 2017 14:04:50 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20170222185015.GA6141@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 23 Feb 2017 06:02:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/23/2017 at 02:50 AM, Luck, Tony wrote: > On Wed, Feb 22, 2017 at 12:11:14PM +0800, Xunlei Pang wrote: >> + /* >> + * Cases to bail out to avoid rendezvous process timeout: >> + * 1)If this CPU is offline. >> + * 2)If crashing_cpu was set, e.g. entering kdump, >> + * we need to skip cpus remaining in 1st kernel. >> + */ >> + if (cpu_is_offline(cpu) || >> + (crashing_cpu != -1 && crashing_cpu != cpu)) { >> u64 mcgstatus; >> >> mcgstatus = mce_rdmsrl(MSR_IA32_MCG_STATUS); > > I think we should document the remaining race conditions. I don't > think there is any good way to eliminate them, and they are already > pretty small windows. > > I think the sequence of events looks like: > > 1 Panic occurs > 2 nmi_shootdown_cpus() sets crashing_cpu > 3 send NMI to everyone else > 4 wait up to a second for other CPUs to take NMI > 5 go to kexec code > 6 start new kernel > 7 new kernel establishes #MC handler > > If one of the other cpus triggers a machine check while > getting to, or in, the NMI handler ... then that cpu will > skip processing (if RIPV is set). > > Between '2' and '5' if crashing_cpu gets a machine check it > will execute in the old kernel handler, and do the right thing. > > There's a fuzzy area between '6' and '7' where a machine check > might not end up in the right code. > > From '7' onwards the kexec kernel will handle and machine > checks caused by kdump. > Agree, will update the comment. Regards, Xunlei