Fedora kernels don't respond properly to panic=1 parameter (appears
to be related to having debug enabled). Add some upstream and one non-upstream patches to work around this.
This commit is contained in:
parent
ba1e443ed0
commit
01a3b240d5
|
@ -0,0 +1,62 @@
|
|||
From 1a2ef4ef4740caeb0357c433004256ce33444a69 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 22 Aug 2013 15:40:57 +0100
|
||||
Subject: [PATCH 1/4] init: Try to call reboot(2) to reboot the system from the
|
||||
initramfs.
|
||||
|
||||
For some reason, panic=1 is broken on kernel 3.11. Calling reboot is
|
||||
more reliable.
|
||||
|
||||
Note that qemu won't actually reboot the VM, because we are passing
|
||||
-no-reboot on the command line, so the VM should exit instead.
|
||||
---
|
||||
configure.ac | 2 ++
|
||||
init.c | 12 ++++++++++++
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 791360f..1b3c22b 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -28,6 +28,8 @@ test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
|
||||
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
+AC_CHECK_HEADERS([sys/reboot.h])
|
||||
+
|
||||
dnl Allow the package to override the default list of qemu binary
|
||||
dnl names which are tried, since this heavily depends on how qemu
|
||||
dnl has been packaged in the downstream distro.
|
||||
diff --git a/init.c b/init.c
|
||||
index f19772b..ef7011c 100644
|
||||
--- a/init.c
|
||||
+++ b/init.c
|
||||
@@ -22,6 +22,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+#ifdef HAVE_SYS_REBOOT_H
|
||||
+#include <sys/reboot.h>
|
||||
+#endif
|
||||
+
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -29,6 +33,14 @@ main (int argc, char *argv[])
|
||||
fprintf (stderr, "***** initrd started up OK *****\n");
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "\n");
|
||||
+
|
||||
+#if defined(HAVE_SYS_REBOOT_H) && defined(RB_AUTOBOOT)
|
||||
+ /* Try to reboot the system. */
|
||||
+ reboot (RB_AUTOBOOT);
|
||||
+ perror ("reboot");
|
||||
+ /* Reboot attempt failed, fallthrough below. */
|
||||
+#endif
|
||||
+
|
||||
fprintf (stderr, "expect to see a kernel panic below, that is normal\n");
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, "\n");
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
From 280f8df59eba30ac4c0907efbdc86891139aab57 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 22 Aug 2013 15:41:54 +0100
|
||||
Subject: [PATCH 2/4] qemu: Pass -machine accel=kvm:tcg option on qemu command
|
||||
line.
|
||||
|
||||
This makes qemu try to use KVM, and fall back cleanly to TCG if
|
||||
hardware accelerated virt is not available.
|
||||
---
|
||||
qemu-sanity-check.in | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/qemu-sanity-check.in b/qemu-sanity-check.in
|
||||
index 4a13b07..24ce8ef 100644
|
||||
--- a/qemu-sanity-check.in
|
||||
+++ b/qemu-sanity-check.in
|
||||
@@ -136,6 +136,8 @@ argv[$((i++))]="$qemu"
|
||||
argv[$((i++))]="-nographic"
|
||||
argv[$((i++))]="-nodefconfig"
|
||||
argv[$((i++))]="-nodefaults"
|
||||
+argv[$((i++))]="-machine"
|
||||
+argv[$((i++))]="accel=kvm:tcg"
|
||||
argv[$((i++))]="-no-reboot"
|
||||
argv[$((i++))]="-serial"
|
||||
argv[$((i++))]="file:$test_output"
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
From 32c2ebeebf59ea0d4c57f9054b181197a573620e Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 22 Aug 2013 15:58:16 +0100
|
||||
Subject: [PATCH 3/4] qemu: Use oops=panic panic=-1
|
||||
|
||||
panic=-1 causes the kernel to reboot immediately without
|
||||
waiting.
|
||||
|
||||
oops=panic turns kernel OOPS into a panic.
|
||||
---
|
||||
qemu-sanity-check.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/qemu-sanity-check.in b/qemu-sanity-check.in
|
||||
index 24ce8ef..712fd8b 100644
|
||||
--- a/qemu-sanity-check.in
|
||||
+++ b/qemu-sanity-check.in
|
||||
@@ -146,7 +146,7 @@ argv[$((i++))]="$kernel"
|
||||
argv[$((i++))]="-initrd"
|
||||
argv[$((i++))]="$initrd"
|
||||
argv[$((i++))]="-append"
|
||||
-argv[$((i++))]="console=ttyS0 panic=1"
|
||||
+argv[$((i++))]="console=ttyS0 oops=panic panic=-1"
|
||||
|
||||
#echo "${argv[@]}"
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 67b7df2b0076148448916ad70ca9d35fb4a5c669 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 22 Aug 2013 16:42:00 +0100
|
||||
Subject: [PATCH 4/4] Disable bad userspace test (Fedora only).
|
||||
|
||||
---
|
||||
Makefile.am | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 5f22f79..ec549d4 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -67,8 +67,8 @@ TESTS = \
|
||||
test-timeout \
|
||||
test-bad-options \
|
||||
test-bad-kernel \
|
||||
- test-bad-qemu \
|
||||
- test-bad-userspace
|
||||
+ test-bad-qemu
|
||||
+# test-bad-userspace
|
||||
|
||||
# Tag HEAD with current version (maintainer only).
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -2,13 +2,23 @@
|
|||
|
||||
Name: qemu-sanity-check
|
||||
Version: 1.1.3
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Simple qemu and Linux kernel sanity checker
|
||||
|
||||
License: GPLv2+
|
||||
|
||||
URL: http://people.redhat.com/~rjones/qemu-sanity-check
|
||||
Source0: http://people.redhat.com/~rjones/qemu-sanity-check/files/%{name}-%{version}.tar.gz
|
||||
|
||||
# Upstream patches to fix sanity check on broken kernels which don't
|
||||
# respond to panic=1 option properly.
|
||||
Patch1: 0001-init-Try-to-call-reboot-2-to-reboot-the-system-from-.patch
|
||||
Patch2: 0002-qemu-Pass-machine-accel-kvm-tcg-option-on-qemu-comma.patch
|
||||
Patch3: 0003-qemu-Use-oops-panic-panic-1.patch
|
||||
|
||||
# Non-upstream patch to disable test which fails on broken kernels
|
||||
# which don't respond to panic=1 option properly.
|
||||
Patch4: 0004-Disable-bad-userspace-test-Fedora-only.patch
|
||||
|
||||
# For building manual pages.
|
||||
BuildRequires: /usr/bin/perldoc
|
||||
|
||||
|
@ -63,6 +73,11 @@ as %{name} except that this package does not depend on qemu or kernel.
|
|||
%prep
|
||||
%setup -q
|
||||
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
|
||||
%build
|
||||
# NB: canonical_arch is a variable in the final script, so it
|
||||
|
@ -96,5 +111,10 @@ make DESTDIR=$RPM_BUILD_ROOT install
|
|||
|
||||
|
||||
%changelog
|
||||
* Thu Aug 22 2013 Richard W.M. Jones <rjones@redhat.com> - 1.1.3-2
|
||||
- Fedora kernels don't respond properly to panic=1 parameter (appears
|
||||
to be related to having debug enabled). Add some upstream and one
|
||||
non-upstream patches to work around this.
|
||||
|
||||
* Thu Aug 22 2013 Richard W.M. Jones <rjones@redhat.com> - 1.1.3-1
|
||||
- Initial release (RHBZ#999108).
|
||||
|
|
Loading…
Reference in New Issue