linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	James Dingwall <james@dingwall.me.uk>,
	Juergen Gross <jgross@suse.com>, Sasha Levin <sashal@kernel.org>,
	linux-doc@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 079/100] x86/xen: Return from panic notifier
Date: Fri, 18 Oct 2019 18:05:04 -0400	[thread overview]
Message-ID: <20191018220525.9042-79-sashal@kernel.org> (raw)
In-Reply-To: <20191018220525.9042-1-sashal@kernel.org>

From: Boris Ostrovsky <boris.ostrovsky@oracle.com>

[ Upstream commit c6875f3aacf2a5a913205accddabf0bfb75cac76 ]

Currently execution of panic() continues until Xen's panic notifier
(xen_panic_event()) is called at which point we make a hypercall that
never returns.

This means that any notifier that is supposed to be called later as
well as significant part of panic() code (such as pstore writes from
kmsg_dump()) is never executed.

There is no reason for xen_panic_event() to be this last point in
execution since panic()'s emergency_restart() will call into
xen_emergency_restart() from where we can perform our hypercall.

Nevertheless, we will provide xen_legacy_crash boot option that will
preserve original behavior during crash. This option could be used,
for example, if running kernel dumper (which happens after panic
notifiers) is undesirable.

Reported-by: James Dingwall <james@dingwall.me.uk>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../admin-guide/kernel-parameters.txt         |  4 +++
 arch/x86/xen/enlighten.c                      | 28 +++++++++++++++++--
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 16607b178b474..a855f83defa6c 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5117,6 +5117,10 @@
 				the unplug protocol
 			never -- do not unplug even if version check succeeds
 
+	xen_legacy_crash	[X86,XEN]
+			Crash from Xen panic notifier, without executing late
+			panic() code such as dumping handler.
+
 	xen_nopvspin	[X86,XEN]
 			Disables the ticketlock slowpath using Xen PV
 			optimizations.
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c6c7c9b7b5c19..2483ff345bbcd 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -266,19 +266,41 @@ void xen_reboot(int reason)
 		BUG();
 }
 
+static int reboot_reason = SHUTDOWN_reboot;
+static bool xen_legacy_crash;
 void xen_emergency_restart(void)
 {
-	xen_reboot(SHUTDOWN_reboot);
+	xen_reboot(reboot_reason);
 }
 
 static int
 xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
 {
-	if (!kexec_crash_loaded())
-		xen_reboot(SHUTDOWN_crash);
+	if (!kexec_crash_loaded()) {
+		if (xen_legacy_crash)
+			xen_reboot(SHUTDOWN_crash);
+
+		reboot_reason = SHUTDOWN_crash;
+
+		/*
+		 * If panic_timeout==0 then we are supposed to wait forever.
+		 * However, to preserve original dom0 behavior we have to drop
+		 * into hypervisor. (domU behavior is controlled by its
+		 * config file)
+		 */
+		if (panic_timeout == 0)
+			panic_timeout = -1;
+	}
 	return NOTIFY_DONE;
 }
 
+static int __init parse_xen_legacy_crash(char *arg)
+{
+	xen_legacy_crash = true;
+	return 0;
+}
+early_param("xen_legacy_crash", parse_xen_legacy_crash);
+
 static struct notifier_block xen_panic_block = {
 	.notifier_call = xen_panic_event,
 	.priority = INT_MIN
-- 
2.20.1


  parent reply	other threads:[~2019-10-18 22:18 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 22:03 [PATCH AUTOSEL 4.19 001/100] wil6210: fix freeing of rx buffers in EDMA mode Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 002/100] f2fs: flush quota blocks after turnning it off Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 003/100] scsi: lpfc: Fix a duplicate 0711 log message number Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 004/100] sc16is7xx: Fix for "Unexpected interrupt: 8" Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 005/100] powerpc/powernv: hold device_hotplug_lock when calling memtrace_offline_pages() Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 006/100] f2fs: fix to recover inode's i_gc_failures during POR Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 007/100] f2fs: fix to recover inode->i_flags of inode block " Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 008/100] HID: i2c-hid: add Direkt-Tek DTLAPY133-1 to descriptor override Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 009/100] usb: dwc2: fix unbalanced use of external vbus-supply Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 010/100] tools/power turbostat: fix goldmont C-state limit decoding Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 011/100] x86/cpu: Add Atom Tremont (Jacobsville) Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 012/100] drm/msm/dpu: handle failures while initializing displays Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 013/100] bcache: fix input overflow to writeback_rate_minimum Sasha Levin
2019-10-18 22:03 ` [PATCH AUTOSEL 4.19 014/100] PCI: Fix Switchtec DMA aliasing quirk dmesg noise Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 015/100] Btrfs: fix deadlock on tree root leaf when finding free extent Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 016/100] netfilter: ipset: Make invalid MAC address checks consistent Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 017/100] HID: i2c-hid: Disable runtime PM for LG touchscreen Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 018/100] HID: i2c-hid: Ignore input report if there's no data present on Elan touchpanels Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 019/100] HID: i2c-hid: Add Odys Winbook 13 to descriptor override Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 020/100] platform/x86: Add the VLV ISP PCI ID to atomisp2_pm Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 021/100] platform/x86: Fix config space access for intel_atomisp2_pm Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 022/100] ath10k: assign 'n_cipher_suites = 11' for WCN3990 to enable WPA3 Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 023/100] clk: boston: unregister clks on failure in clk_boston_setup() Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 024/100] scripts/setlocalversion: Improve -dirty check with git-status --no-optional-locks Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 025/100] staging: mt7621-pinctrl: use pinconf-generic for 'dt_node_to_map' and 'dt_free_map' Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 026/100] HID: Add ASUS T100CHI keyboard dock battery quirks Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 027/100] NFSv4: Ensure that the state manager exits the loop on SIGKILL Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 028/100] HID: steam: fix boot loop with bluetooth firmware Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 029/100] HID: steam: fix deadlock with input devices Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 030/100] samples: bpf: fix: seg fault with NULL pointer arg Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 031/100] usb: dwc3: gadget: early giveback if End Transfer already completed Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 032/100] usb: dwc3: gadget: clear DWC3_EP_TRANSFER_STARTED on cmd complete Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 033/100] ALSA: usb-audio: Add quirk for MOTU MicroBook II Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 034/100] ALSA: usb-audio: Cleanup DSD whitelist Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 035/100] usb: handle warm-reset port requests on hub resume Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 036/100] rtc: pcf8523: set xtal load capacitance from DT Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 037/100] mlxsw: spectrum: Set LAG port collector only when active Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 038/100] net: stmmac: Fix NAPI poll in TX path when in multi-queue Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 039/100] scsi: lpfc: Correct localport timeout duration error Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 040/100] CIFS: Respect SMB2 hdr preamble size in read responses Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 041/100] cifs: add credits from unmatched responses/messages Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 042/100] ALSA: hda/realtek - Apply ALC294 hp init also for S4 resume Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 043/100] media: vimc: Remove unused but set variables Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 044/100] ext4: disallow files with EXT4_JOURNAL_DATA_FL from EXT4_IOC_SWAP_BOOT Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 045/100] exec: load_script: Do not exec truncated interpreter path Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 046/100] net: dsa: mv88e6xxx: Release lock while requesting IRQ Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 047/100] PCI/PME: Fix possible use-after-free on remove Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 048/100] drm/amd/display: fix odm combine pipe reset Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 049/100] power: supply: max14656: fix potential use-after-free Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 050/100] iio: adc: meson_saradc: Fix memory allocation order Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 051/100] iio: fix center temperature of bmc150-accel-core Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 052/100] libsubcmd: Make _FORTIFY_SOURCE defines dependent on the feature Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 053/100] perf tests: Avoid raising SEGV using an obvious NULL dereference Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 054/100] perf map: Fix overlapped map handling Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 055/100] perf script brstackinsn: Fix recovery from LBR/binary mismatch Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 056/100] perf jevents: Fix period for Intel fixed counters Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 057/100] perf tools: Propagate get_cpuid() error Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 058/100] perf annotate: Propagate perf_env__arch() error Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 059/100] perf annotate: Fix the signedness of failure returns Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 060/100] perf annotate: Propagate the symbol__annotate() error return Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 061/100] perf annotate: Return appropriate error code for allocation failures Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 062/100] staging: rtl8188eu: fix null dereference when kzalloc fails Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 063/100] crypto: arm/aes-ce - add dependency on AES library Sasha Levin
2019-10-21  6:08   ` Ard Biesheuvel
2019-10-29  9:19     ` Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 064/100] RDMA/hfi1: Prevent memory leak in sdma_init Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 065/100] RDMA/iwcm: Fix a lock inversion issue Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 066/100] HID: hyperv: Use in-place iterator API in the channel callback Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 067/100] nfs: Fix nfsi->nrequests count error on nfs_inode_remove_request Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 068/100] arm64: ftrace: Ensure synchronisation in PLT setup for Neoverse-N1 #1542419 Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 069/100] tty: serial: owl: Fix the link time qualifier of 'owl_uart_exit()' Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 070/100] tty: n_hdlc: fix build on SPARC Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 071/100] RDMA/cxgb4: Do not dma memory off of the stack Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 072/100] gpio: max77620: Use correct unit for debounce times Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 073/100] fs: cifs: mute -Wunused-const-variable message Sasha Levin
2019-10-18 22:04 ` [PATCH AUTOSEL 4.19 074/100] serial: mctrl_gpio: Check for NULL pointer Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 075/100] efi/cper: Fix endianness of PCIe class code Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 076/100] efi/x86: Do not clean dummy variable in kexec path Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 077/100] kbuild: fix build error of 'make nsdeps' in clean tree Sasha Levin
2019-10-19  0:13   ` Masahiro Yamada
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 078/100] MIPS: include: Mark __cmpxchg as __always_inline Sasha Levin
2019-10-18 22:05 ` Sasha Levin [this message]
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 080/100] ocfs2: clear zero in unaligned direct IO Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 081/100] fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry() Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 082/100] fs: ocfs2: fix a possible null-pointer dereference in ocfs2_write_end_nolock() Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 083/100] fs: ocfs2: fix a possible null-pointer dereference in ocfs2_info_scan_inode_alloc() Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 084/100] arm64: armv8_deprecated: Checking return value for memory allocation Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 085/100] x86/cpu: Add Comet Lake to the Intel CPU models header Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 086/100] sched/vtime: Fix guest/system mis-accounting on task switch Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 087/100] perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 088/100] drm/amdgpu: fix memory leak Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 089/100] iio: adc: hx711: fix bug in sampling of data Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 090/100] iio: imu: adis16400: release allocated memory on failure Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 091/100] iio: adc: ad799x: fix probe error handling Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 092/100] iio: light: opt3001: fix mutex unlock race Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 093/100] MIPS: include: Mark __xchg as __always_inline Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 094/100] MIPS: fw: sni: Fix out of bounds init of o32 stack Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 095/100] USB: usb-skeleton: fix use-after-free after driver unbind Sasha Levin
2019-10-18 22:22   ` Greg Kroah-Hartman
2019-10-29  9:04     ` Sasha Levin
2019-10-29  9:43       ` Greg Kroah-Hartman
2019-10-29 10:04         ` Johan Hovold
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 096/100] virt: vbox: fix memory leak in hgcm_call_preprocess_linaddr Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 097/100] nbd: fix possible sysfs duplicate warning Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 098/100] NFSv4: Fix leak of clp->cl_acceptor string Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 099/100] s390/uaccess: avoid (false positive) compiler warnings Sasha Levin
2019-10-18 22:05 ` [PATCH AUTOSEL 4.19 100/100] tracing: Initialize iter->seq after zeroing in tracing_read_pipe() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191018220525.9042-79-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=james@dingwall.me.uk \
    --cc=jgross@suse.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).