From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933254AbcHJSNC (ORCPT ); Wed, 10 Aug 2016 14:13:02 -0400 Received: from mailxx.hitachi.co.jp ([133.145.228.50]:49061 "EHLO mailxx.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbcHJSM7 (ORCPT ); Wed, 10 Aug 2016 14:12:59 -0400 Subject: [V4 PATCH 0/2] kexec: crash_kexec_post_notifiers boot option related fixes From: Hidehiro Kawai To: Andrew Morton , Dave Young , "Eric W. Biederman" , Baoquan He , Ralf Baechle Cc: linux-mips@linux-mips.org, Xunlei Pang , x86@kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, HATAYAMA Daisuke , Masami Hiramatsu , xen-devel@lists.xenproject.org, Daniel Walker , Vivek Goyal Date: Wed, 10 Aug 2016 17:09:46 +0900 Message-ID: <20160810080946.11028.97686.stgit@sysi4-13.yrl.intra.hitachi.co.jp> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Daniel Walker reported problems which happens when crash_kexec_post_notifiers kernel option is enabled (https://lkml.org/lkml/2015/6/24/44). In that case, smp_send_stop() is called before entering kdump routines which assume other CPUs are still online. This causes some issues depending on architectures. For example, for x86, kdump routines fail to save other CPUs' registers and disable virtualization extensions. For MIPS OCTEON, it fails to stop the watchdog timer. To fix this problem, call a new kdump friendly function, crash_smp_send_stop(), instead of the smp_send_stop() when crash_kexec_post_notifiers is enabled. crash_smp_send_stop() is a weak function, and it just call smp_send_stop(). Architecture codes should override it so that kdump can work appropriately. This patch set supports only x86 and MIPS. NOTE: - Right solution would be to place crash_smp_send_stop() before __crash_kexec() invocation in all cases and remove smp_send_stop(), but we can't do that until all architectures implement own crash_smp_send_stop() - crash_smp_send_stop()-like work is still needed by machine_crash_shutdown() because crash_kexec() can be called without entering panic() Changes in V4: - Keep to use smp_send_stop if crash_kexec_post_notifiers is not set - Rename panic_smp_send_stop to crash_smp_send_stop - Don't change the behavior for Xen's PV kernel - Support MIPS Changes in V3: https://lkml.org/lkml/2016/7/5/221 - Revise comments, description, and symbol names (the logic doesn't change) - Make crash_kexec_post_notifiers boot option modifiable after boot Changes in V2: https://lkml.org/lkml/2015/7/23/864 - Replace smp_send_stop() call with crash_kexec version which saves cpu states and does cleanups instead of changing execution flow - Drop a fix for Problem 1 - Drop other patches because they aren't needed anymore V1: https://lkml.org/lkml/2015/7/10/316 --- Hidehiro Kawai (2): x86/panic: Replace smp_send_stop() with kdump friendly version in panic path mips/panic: Replace smp_send_stop() with kdump friendly version in panic path arch/mips/cavium-octeon/setup.c | 14 +++++++++++ arch/mips/include/asm/kexec.h | 1 + arch/mips/kernel/crash.c | 18 ++++++++++++++- arch/mips/kernel/machine_kexec.c | 1 + arch/x86/include/asm/kexec.h | 1 + arch/x86/include/asm/smp.h | 1 + arch/x86/kernel/crash.c | 22 +++++++++++++++--- arch/x86/kernel/smp.c | 5 ++++ kernel/panic.c | 47 ++++++++++++++++++++++++++++++++------ 9 files changed, 99 insertions(+), 11 deletions(-) -- Hidehiro Kawai Hitachi, Ltd. Research & Development Group