Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2027019ybg; Fri, 5 Jun 2020 03:47:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCw+P9PEJo1CqvvvzKOTospheLJg8ub09A5+VVluilKmA7KTyXLnzpQHqydHjRUtjJJ/I/ X-Received: by 2002:a17:906:b41:: with SMTP id v1mr7893759ejg.147.1591354068020; Fri, 05 Jun 2020 03:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591354068; cv=none; d=google.com; s=arc-20160816; b=XCCwHOmvqPnwdkBFI14d3ZVGgH0mW0DQtMepiuMAkJmZzLMtajlGrrmdCxFipGpT83 HSmzRh98Ae0dZQrz7yZjuWfDjyEBtgDCaaAbXEZ7J/i5le+q0+ETEZ25mBkWub3Z8eP/ y+aT+SgffayoAcKV00LCP7pblONvsCLsYJfe0vKiHVkR51XOPhkwqZ7tlweYfSOnY90e 46pLR8PF5xU9i1ctUbTXpUvgPmybDZk36TLpNSHXs5oUlQhpSvCD3bSB+fCxwXIJbX+h jA6SF9HRioLeg2t/NBUjxvF6p7ME06548DK23yBKxKQmHFhfvBYWWYlGvz12TIACoEnp B9gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=AGV5ugy2Hu1pwMmvPlM8LIVRqt0Q7mdmnoDQ/jTxCMw=; b=lV2t+i7+Qatm7tuEkJt/Npm4zG9vZnkFqNSbzyr360sL5hRgATDKJt0PFuzvHU0c4P I4qNSseg82xeWe+iTJMtHdsU5Qj9F4oEZGHsrrv5AuqSOP0bvdhL92LBWsbk9mAXKsiU ZRjIRrz92Mvfya3Rqp1tJMsE7w1IuYN5s62srrf01XuCYMCXHiudc5+tmFKA9xuilIs5 IKW5EmOq9oMXJWyTRsWNeDbBMvwBxvtS6KhqYpaSe0tpJ60BeCTGDVOM5eQrnY/LmqRq PTuenCB4dPEud2gGwSfx+k+gPl5l0jaRYzQqA7Baw+eitX2d9j6tVcpCCoKjKjO1RDar aScA== 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 n4si3531894edy.244.2020.06.05.03.47.25; Fri, 05 Jun 2020 03:47:48 -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 S1726719AbgFEKnG (ORCPT + 99 others); Fri, 5 Jun 2020 06:43:06 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:42684 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726669AbgFEKnG (ORCPT ); Fri, 5 Jun 2020 06:43:06 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 2F6A4C1D64892B82114F; Fri, 5 Jun 2020 18:43:04 +0800 (CST) Received: from [127.0.0.1] (10.166.212.204) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Fri, 5 Jun 2020 18:42:58 +0800 Subject: Re: [RFC PATCH] panic: fix deadlock in panic() To: Petr Mladek CC: , , , , , , , "chengjian (D)" References: <20200603141915.38739-1-cj.chengjian@huawei.com> <20200604082947.GB22497@linux-b0ei> From: "chengjian (D)" Message-ID: <7b6f8522-f9b2-29e8-2dde-3bbfac19335b@huawei.com> Date: Fri, 5 Jun 2020 18:42:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200604082947.GB22497@linux-b0ei> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.166.212.204] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Petr On 2020/6/4 16:29, Petr Mladek wrote: > It might cause double unlock (deadlock) on architectures that did not > use NMI to stop the CPUs. > > I have created a conservative fix for this problem for SLES, see > https://github.com/openSUSE/kernel-source/blob/SLE15-SP2-UPDATE/patches.suse/printk-panic-Avoid-deadlock-in-printk-after-stopping-CPUs-by-NMI.patch > It solves the problem only on x86 architecture. > > There are many hacks that try to solve various scenarios but it > is getting too complicated and does not solve all problems. I have read your conservative fix and I have some question, 1-- does the console_sem need to be reinitialized ? 2-- Other architectures without NMI, is there no such problem ? > The only real solution is lockless printk(). First piece is a lockless > ringbuffer. See the last version at > https://lore.kernel.org/r/20200501094010.17694-1-john.ogness@linutronix.de > > We prefer to work on the lockless solution instead of adding more > complicated workarounds. This is why I even did not try to upstream > the patch for SLES. > > In the meantime, you might also consider removing the offending > message from the panic notifier if it is not really important. > > Best Regards, > Petr > > . Thank you.     Cheng Jian