Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3068950pxk; Mon, 21 Sep 2020 04:37:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9wb7ot147loyvBbRgrqc3YZHV71/cfrsS/c6ATwiXZ7wh7+yOP5WgeiHMT9OHScO8irI9 X-Received: by 2002:a50:cbc7:: with SMTP id l7mr51835753edi.148.1600688244420; Mon, 21 Sep 2020 04:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600688244; cv=none; d=google.com; s=arc-20160816; b=B2Dj06YhO/B3+wHGTCZJY9rLSuYRR6zFeAbf1dOqlN7XO4ybUyz/NUH/zqVJjTSjwe PgUFds+X3UExPaI1q19RiEhU1RZUygQp/beN6HqwYE8S5ojauxvklLmxf+zFsEUVHaiE aojVWlnUeaMEM1oWqsEYwBfcFTa8HKMdm8fPmJiu5jKTepFh4nQV00cl/7QmThN4AioC rU4X0Jo1PSJAi0NCMMoBCBFbIXywHAlSEakQiszCyXr6EJLWVeS/dEZnbp2LdSAFyuAK alr8lmGNmr1YSCvKYSmPKCH502MiJ34xzQ9vP4VVx5jnOM/7DNljTT67PAmU7vF0XZOj K4zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=SQFO99rWcacODC7nIwHbVpaFVbZYSUNj0m0/PD9iq7Q=; b=vTsyyzxh2OX7kaP7LIYpPf5W+pO45vtnBm2ZFhebme4ipDPdsK3+4m3pZqnUF13iOE LQsbLsbSj3ENy6+6wSAkj2N2iNw5dOhLT/OpKKtmfU9QBoyMVO3KslsqiUMUFuSlCl8W IxNuX1gWi10iG53EVcxGiZ6Hz/1D1MC3gm/it8rfpqOIX5lkGdFmqRPGH7pdT49RSml5 QjbTd4HkWNEs/cPsYxVbbrQgrMBY4SVOYbcH0pleZp/UJbjMHATokNkzbG7guJ+dJTFb QiLznMHr/LspMohxftsV/vqrGHQaToGlhJ8zLmN4PaiU2RVSVJ1r5gKbVjhn+cC/G8Vm ih2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si7973420edw.139.2020.09.21.04.37.00; Mon, 21 Sep 2020 04:37:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbgIULgB (ORCPT + 99 others); Mon, 21 Sep 2020 07:36:01 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13796 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726326AbgIULgA (ORCPT ); Mon, 21 Sep 2020 07:36:00 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 0C87329B30D6C3AE099E; Mon, 21 Sep 2020 19:35:59 +0800 (CST) Received: from [10.174.179.35] (10.174.179.35) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Mon, 21 Sep 2020 19:35:51 +0800 Subject: Re: [RFC PATCH] mce: don't not enable IRQ in wait_for_panic() To: , , CC: , , , , , , , , , , , , References: <1600339070-570840-1-git-send-email-wubo40@huawei.com> From: Wu Bo Message-ID: <2262c2ee-3272-987a-0bdb-a0ce55a1d43c@huawei.com> Date: Mon, 21 Sep 2020 19:35:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <1600339070-570840-1-git-send-email-wubo40@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.35] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/9/17 18:37, Wu Bo wrote: > In my virtual machine (have 4 cpus), Use mce_inject to inject errors > into the system. After mce-inject injects an uncorrectable error, > there is a probability that the virtual machine is not reset immediately, > but hangs for more than 3000 seconds, and appeared unable to > handle kernel paging request. > > The analysis reasons are as follows: > 1) MCE appears on all CPUs, Currently all CPUs are in the NMI interrupt > context. cpu0 is the first to seize the opportunity to run panic > routines, and panic event should stop the other processors before > do ipmi flush_messages(). but cpu1, cpu2 and cpu3 has already > in NMI interrupt context, So the Second NMI interrupt(IPI) > will not be processed again by cpu1, cpu2 and cpu3. > At this time, cpu1,cpu2 and cpu3 did not stopped. > > 2) cpu1, cpu2 and cpu3 are waitting for cpu0 to finish the panic process. > if a timeout waiting for other CPUs happened, do wait_for_panic(), > the irq is enabled in the wait_for_panic() function. > > 3) ipmi IRQ occurs on the cpu3, and the cpu0 is doing the panic, > they have the opportunity to call the smi_event_handler() > function concurrently. the ipmi IRQ affects the panic process of cpu0. > > CPU0 CPU3 > > |-nmi_handle do mce_panic |-nmi_handle do_machine_check > | | > |-panic() |-wait_for_panic() > | | > |-stop other cpus ---- NMI ------> (Ignore, already in nmi interrupt) > | | > |-notifier call(ipmi panic_event) |<-ipmi IRQ occurs > | | > \|/ \|/ > do smi_event_handler() do smi_event_handler() > > My understanding is that panic() runs with only one operational CPU > in the system, other CPUs should be stopped, if other CPUs does not stop, > at least IRQ interrupts should be disabled. The x86 architecture, > disable IRQ interrupt will not affect IPI when do mce panic, > because IPI is notified through NMI interrupt. If my analysis > is not right, please correct me, thanks. > > Steps to reproduce (Have a certain probability): > 1. # vim /tmp/uncorrected > CPU 1 BANK 4 > STATUS uncorrected 0xc0 > MCGSTATUS EIPV MCIP > ADDR 0x1234 > RIP 0xdeadbabe > RAISINGCPU 0 > MCGCAP SER CMCI TES 0x6 > > 2. # modprobe mce_inject > 3. # cd /tmp > 4. # mce-inject uncorrected > Hi, I tested the 5.9-rc5 version and found that the problem still exists. Is there a good solution ? Best regards, Wu Bo