From patchwork Fri Aug 4 07:02:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hoeun Ryu X-Patchwork-Id: 9880709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A339B603B4 for ; Fri, 4 Aug 2017 07:07:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95C26289B4 for ; Fri, 4 Aug 2017 07:07:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A7F8289B6; Fri, 4 Aug 2017 07:07:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B990289B4 for ; Fri, 4 Aug 2017 07:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=FN+G8JUqyb+VlsMeBFkTPP0UmTaUWEFNnYfH43MCXWw=; b=i6Q r2qgsPKQV4yDi6aRbBocHWeoEWUa8wpLjLjC/qulJRfI3tJ8oKdP4j+iBshRg9YwxlOxtKBRfAmBK dpluL5R7zJi2l3r1aenEjnQ8Xm8cpJBUeXV5bzhfdG57iOd9/Bq3M2x17bjXIyCl/7cn7ZsOfBEaN k4t1ioOIZmkw4IYXDCvXw75O/ZNRWH+TfG8noDeQ0ZMgitSZA3iSgbXd8narXlJ2RB+o4nuOYzM4d lL0tyu4gc/LLWiE2Sw6QkX2GEBHbzZc03cQ0LLuiBoplq+vwn/uEh1VXlrayJ7cAyZ7OuCUX4aEb7 L27BBjNgN0uBHO3tKyg0iMYyw+EIoKg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ddWi5-0002CD-Fv; Fri, 04 Aug 2017 07:07:49 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ddWi1-00028n-Ne for linux-arm-kernel@lists.infradead.org; Fri, 04 Aug 2017 07:07:47 +0000 Received: by mail-pf0-x244.google.com with SMTP id c65so1053847pfl.0 for ; Fri, 04 Aug 2017 00:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ekq9ZeGAMAzdTz98TspLz2UymtM/mdeEojguxW9nHR0=; b=hd6P2MQ551eAHWhtawhN6IY1tKMiXv6iFzRgGnhHgumoLkAemBpUCCovMIIvoI5Ncf urlSQlmaUzkmIYLx7Eq/57d0JFf+5nIOhmy01JwQPo2FnUjmQgJfjZsseE5PEvZ0v7UU vIcqs99D6301mF81rnBrH8QxPJr8kvhBuISu9ah/qefA9FlybhzeFBB3mjyHcvXiJpsM 3+7DKX/2rN7Bxecq1dMLcz74FPLAuP2bH/WN7X8s6hhrtfHO+0NWfShuj0QgxwHnVHNl ZSTBKdlQq25XofYJYE+xb1Qapmtd8XTAp0yF2c8JVJNV+IiWZmzzqp+DdG1Z+AvYbdY3 iIZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ekq9ZeGAMAzdTz98TspLz2UymtM/mdeEojguxW9nHR0=; b=Nqs0Yf3oHWcA6+cRBOkFLI3Q1qmLvw5shmCX6TVQY5bl4zGespjNU2E/j9o8Im83+P wYiDj1p9z99Jub4rJgCWO1e4tUG4ulFyDX7+0lqwpNkmM9XRYUmEFN3PTth0t2ciYE9d lx87BLGL5jovrUUYufgtS90PmCOckocHVMh5lnGcf/1tdCfFmFL5GTvECO9FbWOlH301 QvNei/5q+HGmrADfyNddZeHk3F/CxpY9NB8Rg76xsQcUKc15KM0mJkGJ71JvtpwnoI+B fiUqhOneoKD1JfJG/ywWjMKU/Ah17FmAYgzVy2ciei4O2mU2SAXlLZUYlHjubRIAgNi8 zlnw== X-Gm-Message-State: AIVw112WY3zolMKHs40fxNcgpNW+y2rI5sDio21gaGhGyLe56B8WLgRk 4rpnDA4WM+yfqzklca8= X-Received: by 10.84.196.100 with SMTP id k91mr1611596pld.262.1501830443561; Fri, 04 Aug 2017 00:07:23 -0700 (PDT) Received: from hryu-OptiPlex-9020.corp.ad.wrs.com ([61.107.31.52]) by smtp.gmail.com with ESMTPSA id r13sm1452416pfg.14.2017.08.04.00.07.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Aug 2017 00:07:22 -0700 (PDT) From: Hoeun Ryu To: Catalin Marinas , Will Deacon , AKASHI Takahiro , James Morse , Ard Biesheuvel Subject: [PATCH] arm64:kexec: have own crash_smp_send_stop() for crash dump for nonpanic cores Date: Fri, 4 Aug 2017 16:02:29 +0900 Message-Id: <1501830173-15989-1-git-send-email-hoeun.ryu@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170804_000745_930072_DEE24642 X-CRM114-Status: GOOD ( 12.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hoeun Ryu , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 0ee5941 : (x86/panic: replace smp_send_stop() with kdump friendly version in panic path) introduced crash_smp_send_stop() which is a weak function and can be overriden by architecture codes to fix the side effect caused by commit f06e515 : (kernel/panic.c: add "crash_kexec_post_ notifiers" option). ARM64 architecture uses the weak version function and the problem is that the weak function simply calls smp_send_stop() which makes other CPUs offline and takes away the chance to save crash information for nonpanic CPUs in machine_crash_shutdown() when crash_kexec_post_notifiers kernel option is enabled. Calling smp_send_crash_stop() in the function is useless because all nonpanic CPUs are already offline by smp_send_stop() in this case and smp_send_crash_stop() only works against online CPUs. The result is that /proc/vmcore is not available with the error messages; "Warning: Zero PT_NOTE entries found", "Kdump: vmcore not initialized". crash_smp_send_stop() is implemented for ARM64 architecture to fix this problem and the function (strong symbol version) saves crash information for nonpanic CPUs using smp_send_crash_stop() and machine_crash_shutdown() tries to save crash information for nonpanic CPUs only when crash_kexec_post_notifiers kernel option is disabled. Signed-off-by: Hoeun Ryu --- arch/arm64/kernel/machine_kexec.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index 481f54a..ec55cd8 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -213,6 +213,23 @@ void machine_kexec(struct kimage *kimage) BUG(); /* Should never get here. */ } +void crash_smp_send_stop(void) +{ + static int cpus_stopped; + + /* + * This function can be called twice in panic path, but obviously + * we execute this only once. + */ + if (cpus_stopped) + return; + + /* shutdown non-crashing cpus */ + smp_send_crash_stop(); + + cpus_stopped = 1; +} + static void machine_kexec_mask_interrupts(void) { unsigned int i; @@ -252,7 +269,7 @@ void machine_crash_shutdown(struct pt_regs *regs) local_irq_disable(); /* shutdown non-crashing cpus */ - smp_send_crash_stop(); + crash_smp_send_stop(); /* for crashing cpu */ crash_save_cpu(regs, smp_processor_id());