From patchwork Sun Apr 24 15:19:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 12824797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1092BC433EF for ; Sun, 24 Apr 2022 07:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VJyyK1ijuOfTfCI6Yme5vSPqsDHIvqVfIUzs13LcOZc=; b=a4ts1KJvF7DAlm b+nSORUzDqJ20dJN8mwhXQre4WsgfGd1f291M4u6vGXuBkeHbzjUMXB7u92blO4LQD85BToE+umwe S4OvtqpqmdDqkTEuINzLKHZAkmE7/pX1KsXur0bjXWzmFET4hXmCYih1EUI/DqASy9sYDwCRs19Ai 1i1WKnKq/SdEu54YSUs4iHJe8Fv74Rre7XTEH0SUcj6L9RzUYcxPU6Sg/TnMRPHydQhdDuDTf1uno 84xmEs87HC05VnebSBGFAMkVaUrFvjiZ4kArLG8ZWXqAonBMl2Ko4P/XWMsYSyKxdb2ieOtNXMhCE TWdGzyKkAu4+mQrg8/+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1niWb6-0062OE-BX; Sun, 24 Apr 2022 07:23:56 +0000 Received: from mail-bn1nam07on2070e.outbound.protection.outlook.com ([2a01:111:f400:7eb2::70e] helo=NAM02-BN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1niWb1-0062MO-Rt for linux-arm-kernel@lists.infradead.org; Sun, 24 Apr 2022 07:23:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ouux28lX26amicJzAUCaKuKllA2vNVIotsyxP9OPW2m+Rxim2nH0b9VNn/HxviA9x55mONmFBIxFL14zFU2DC89PuxeEbFcWk9Hlv//lbT43ZU4G0d7vjBFJEyovIEAgHCvVC+03AFYfvteVf4LTzxXeO9aHWxFwtpjCw38Hjn/jTnuPy6KporgD5E3X+4WWrqTOJlrE6rASX6mn6BXWSqQW1v6KPl896cC3PEkEvg51AyIldDUGTAcNO8Zil3iFEdtSRbA1zh138J6BA+m5e79rWsAi8DWXIx1n4dfJKz/G8k2D3BW+XN6pCnFi8oUV3aVbS71QbWvNj7GDcIKQIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nf/XcownOYwfF8Vu0e7UWlZUAMEv5jxx9qXfAH3i+Qk=; b=dHYuhDHZL0O35vTtz5cY8MwHGxuPOoYQy+KdF4EZS7jtO7fHNdW3dYktsArKo7G1qn8YfVkHV2xW/ND7tQ4omJ9nwXSNU8f19Y+e747PHxFiubnGXhmkL9gyxfvNvc9l4NUTArVDHrWQu2slM1c3fLq3v8GetiJMdlfaOwbg/eQxdO+nPmFj7ENWmdDyQbIBVFvDJ7m43LUSnDpsFZCUq4l84qyFXH7ou3mWtqbV4sizaghCYiXlI141oRJME99fqyvGjGm7dWyi24AcmRgBJEi/fR2oofosU0hp0ySXSiHjbeI+KUelpv/Dy0UjbghJoOUOZX1/8XCQSZvisC0D9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nf/XcownOYwfF8Vu0e7UWlZUAMEv5jxx9qXfAH3i+Qk=; b=WQteL/a7aLTg3M+Rx5/6btRo8/59XZZqHLRh5jMRHZxxE9cabryvAXh/vFfTXsg7qS92wJsDPnv0LjeEImAAeq27Nl3uofgf1m7dbNLHJHzfm4E3vCdu6Ee2a1SIji9c2T433+bKGD8zo04noJEFVb7g5AmoMntYQ9iH1wv+Ts4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) by SN4PR01MB7486.prod.exchangelabs.com (2603:10b6:806:202::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.13; Sun, 24 Apr 2022 07:23:45 +0000 Received: from DM8PR01MB6824.prod.exchangelabs.com ([fe80::1c14:74a3:9d99:d21e]) by DM8PR01MB6824.prod.exchangelabs.com ([fe80::1c14:74a3:9d99:d21e%3]) with mapi id 15.20.5186.020; Sun, 24 Apr 2022 07:23:45 +0000 From: Huang Shijie To: will@kernel.org, catalin.marinas@arm.com Cc: patches@amperecomputing.com, zwang@amperecomputing.com, darren@os.amperecomputing.com, pasha.tatashin@soleen.com, pmladek@suse.com, senozhatsky@chromium.org, rostedt@goodmis.org, john.ogness@linutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Huang Shijie , Adam Li Subject: [PATCH v2] arm64: kexec: flush log to console in NMI context Date: Sun, 24 Apr 2022 15:19:52 +0000 Message-Id: <20220424151952.183208-1-shijie@os.amperecomputing.com> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: CH0PR03CA0259.namprd03.prod.outlook.com (2603:10b6:610:e5::24) To DM8PR01MB6824.prod.exchangelabs.com (2603:10b6:8:23::24) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b4650d3-f583-4a04-4ba6-08da25c35d75 X-MS-TrafficTypeDiagnostic: SN4PR01MB7486:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XHIHrC7qAjCHMmhhe+y4/KkLfXautHO4jwnaIsLV8UGER8s4UM0UdS2QQFE1XPJvDkI7TQIJddkjguocHdMi0dyeD2LpzGChOamwFhY2aMr22MJTuoQeT32PbgL2Ld2jytlh2ygULZZ7RHTES4n8CFP+R17Q5t5fYLxYADv7QiPsIJ0UDqbdyuGqySmK2gbnCTCJKR3/VmIn/kcs+w+C00Cvy34dmMs7RtHm9FnkIeCFjc1PnS3FHs0LtVpsmaKqAk13nO2ZF3NF/FGW7E5xKjW72r+y+tFnxYWFS3lEpxSRhB/acq56JtcbNaK2CUmvNXq0Xx17Wmmdv7bONoCa+bOdDPhipEHxePvIJoaBCPOmwH0pwXpqD6IOK5vNflbd9exodotqsvkDwVnpGbRx1EiHChNwnkN3uGAZenoDNUwFFjjiuTEQtJr0K+J+gvgcLi4Cx8Th/AUm5Xti2qfOMCHdA6uj0f2HwFyJiBv3irKVgg/mpt8p5kvU6zVAU557MA7isZU2DmurH5ALx1/rVhsY2CUVAyEjnP4Je9q64R47g/1g+nITsYyI98zySAhrpFkAAxZaXW2Y8jxTiMMH+ABvksgzhVbYfVctDZ6LEX1ZDVvF5GX+a/+rYTA6y8CoTQYTLpnr896GYr6puWm0yIJKGmLIL0utvjvJRPAqImPLbDuFxRrGLjVgD3C9wytuLpel1RW/2h+Hl6z8SAYdSQHvMKvUfmwBn+jMwvfLc7ZDahn8x3o1j1dMPYnsW96uv5tAH0vfqzfu2Y+3dXxtwS/i8a5uF/seUYBS7ES18Do= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM8PR01MB6824.prod.exchangelabs.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(2906002)(8936002)(38350700002)(5660300002)(83380400001)(107886003)(38100700002)(316002)(4326008)(66946007)(66476007)(66556008)(8676002)(54906003)(6486002)(2616005)(186003)(1076003)(508600001)(86362001)(26005)(6506007)(52116002)(6666004)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qsotfIokCuVu0MjMoEgtFtHFcwRUw0ib6BXk3Zjqki5rRVVkVN8IYARmStYCIORWp7L8u7yD9ANUsz6BUbW9poeFbhrcrkxEzRkIsxdYpym+teQKIgMTTLRX8liEjLc41ZPr1JDkQ6QNxCcrrwj5KTsvSjNkzUxtMd7USKl8VWOJrmLrxYK235Gnk4biHAAALYYaG1SoYzgzLj7xjohqjfsEYSDBwGOORmmZm/Zh5T5j0EYw4YARiB4U3RiBJWolRm8xlAn2LqnIGbf8/3ofSh1Vll7xSKuIcKMwMDY2eyFvFnKjFvzbPYr+VL/YmVG5day6skMq+/0btRlFRijPIAs7qQp9S9yBY6h0jtZJNA50sJd9RrDxqlfhq21FlsEYlNwFBqWXvqKTT984F7fbpEakG+XDOERd1dZVblucBR043Ygmecl/aoQ5Li0Lk0sJF3oBOaCMzK+ukFI6goei1rPFVCrlct+7SoolT/Nm2EzQo2PFDxzYEws8a+E50YXrLVJHViZuOZYWluvN88hJH1jmtbXEgasE/JiWs7Sqq6oBRuQklTW7eP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leWD4eNoMmeFxdKzASoXLu/KdtsjxtiQrHCRnE+ap5zLPfRgF3DyJzSIRCCd15z/gWqY6TpvTPpWzJ2bfaBouiwNYIWJpTIiKsp9KLRammYzmo67c6Nh1DD2W6LFcPjbFjFr0BzGUJx89tqm706dS X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b4650d3-f583-4a04-4ba6-08da25c35d75 X-MS-Exchange-CrossTenant-AuthSource: DM8PR01MB6824.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2022 07:23:44.8954 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xw4DPiBTQriZtD+k8eW0InPrbgvQNvIilKu4+Gioqy7IZRhL7E3+pd9H/bsPnkP6EB5knlSQp0hO6X2hoR4hzipLX0Fd538fBPdN/AKsnoR86hofIFZiY8FlhcO3HrNN X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR01MB7486 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220424_002352_149544_13B842AD X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org If kdump is configured, nmi_panic() may run to machine_kexec(). In NMI context, the defer_console_output() defers the console output by using wake_up_klogd to flush the printk ringbuffer to console. But in the machine_kexec, the system will reset, and there is no chance for the wake_up_klogd to do its job. So we can _not_ see any log on the console since the nmi_panic (nmi_panic() will disable the irq). This patch fixes this issue by using console_flush_on_panic() to flush to console. After this patch, we can see all the log since the nmi_panic in the panic console. Tested-by: Adam Li Signed-off-by: Huang Shijie --- v1 --> v2: update this patch since the printk system is changed. v1:https://lkml.iu.edu/hypermail/linux/kernel/2106.2/01703.html --- arch/arm64/kernel/machine_kexec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index e16b248699d5..e961464a881e 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -6,6 +6,7 @@ * Copyright (C) Huawei Futurewei Technologies. */ +#include #include #include #include @@ -188,6 +189,8 @@ void machine_kexec(struct kimage *kimage) "Some CPUs may be stale, kdump will be unreliable.\n"); pr_info("Bye!\n"); + if (in_nmi()) + console_flush_on_panic(CONSOLE_FLUSH_PENDING); local_daif_mask();