← Back to team overview

kernel-packages team mailing list archive

[Bug 1400319] Re: [Hyper-V] Kernel panic not functional on 32bit Ubuntu 14.10, 15.04, and 15.10


A consideration:

From: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>

When we crash from NMI context (e.g. after NMI injection from host when
'sysctl -w kernel.unknown_nmi_panic=1' is set) we hit

    kernel BUG at mm/vmalloc.c:1530!

as vfree() is denied. While the issue could be solved with in_nmi() check
instead I opted for skipping vfree on all sorts of crashes to reduce the
amount of work which can cause consequent crashes. We don't really need to
free anything on crash.

Signed-off-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
Signed-off-by: K. Y. Srinivasan <kys@xxxxxxxxxxxxx>
 drivers/hv/hv.c           |    8 +++++---
 drivers/hv/hyperv_vmbus.h |    2 +-
 drivers/hv/vmbus_drv.c    |    8 ++++----
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index a1c086b..60dbd6c 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -278,7 +278,7 @@ cleanup:
  * This routine is called normally during driver unloading or exiting.
-void hv_cleanup(void)
+void hv_cleanup(bool crash)
        union hv_x64_msr_hypercall_contents hypercall_msr;

@@ -288,7 +288,8 @@ void hv_cleanup(void)
        if (hv_context.hypercall_page) {
                hypercall_msr.as_uint64 = 0;
                wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
-               vfree(hv_context.hypercall_page);
+               if (!crash)
+                       vfree(hv_context.hypercall_page);
                hv_context.hypercall_page = NULL;

@@ -308,7 +309,8 @@ void hv_cleanup(void)

                hypercall_msr.as_uint64 = 0;
                wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
-               vfree(hv_context.tsc_page);
+               if (!crash)
+                       vfree(hv_context.tsc_page);
                hv_context.tsc_page = NULL;
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 718b5c7..dfa9fac 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -495,7 +495,7 @@ struct hv_ring_buffer_debug_info {

 extern int hv_init(void);

-extern void hv_cleanup(void);
+extern void hv_cleanup(bool crash);

 extern int hv_post_message(union hv_connection_id connection_id,
                         enum hv_message_type message_type,
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 952f20f..d11690e 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -871,7 +871,7 @@ err_alloc:

-       hv_cleanup();
+       hv_cleanup(false);

        return ret;
@@ -1323,7 +1323,7 @@ static void hv_kexec_handler(void)
                smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
-       hv_cleanup();
+       hv_cleanup(false);

 static void hv_crash_handler(struct pt_regs *regs)
@@ -1335,7 +1335,7 @@ static void hv_crash_handler(struct pt_regs *regs)
         * for kdump.
-       hv_cleanup();
+       hv_cleanup(true);

 static int __init hv_acpi_init(void)
@@ -1395,7 +1395,7 @@ static void __exit vmbus_exit(void)
-       hv_cleanup();
+       hv_cleanup(false);
        for_each_online_cpu(cpu) {
                smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);


You received this bug notification because you are a member of Kernel
Packages, which is subscribed to kexec-tools in Ubuntu.

  [Hyper-V] Kernel panic not functional on 32bit Ubuntu 14.10, 15.04,
  and 15.10

Status in kexec-tools package in Ubuntu:
Status in linux package in Ubuntu:
Status in kexec-tools source package in Wily:
Status in linux source package in Wily:

Bug description:
  While testing the final build of 14.10 32bit we found that kernel
  panic cannot be activated for an installation on a Hyper-V VM.

  Repro rate: 100%
  Repro details:
  Hyper-V: Server 2012 R2
  VM: Ubuntu 14.10 32bit

  Kdump is enabled in the config file at /etc/default/kdump-tools

  Different crashkernel values used in grub.cfg – 128M-:64M | 256M-:128m
  | 384M-:256M

  VM settings: 2 cores, various RAM sizes attempted: 1, 2 or 4 GB – this
  in combination with the values for crashkernel.

  Trying to start the kdump service:
  root@ubuntu1410i386:~# /etc/init.d/kdump-tools start
  Starting kdump-tools: Could not find a free area of memory of 0x9f000 bytes...
  locate_hole failed
  * failed to load kdump kernel

  root@ubuntu1410i386:~# cat /sys/kernel/kexec_crash_loaded

  If the conversion from hex to dec is right, the mentioned memory mapping of 0x9f000 bytes is equal to 651264 (bytes), so under 1MB. This is not then related to the RAM allocation nor the crashkernel value used.
  AlsaDevices: Error: command ['ls', '-l', '/dev/snd/'] failed with exit code 2: ls: cannot access /dev/snd/: No such file or directory
  AplayDevices: Error: [Errno 2] No such file or directory
  ApportVersion: 2.14.7-0ubuntu8
  Architecture: i386
  ArecordDevices: Error: [Errno 2] No such file or directory
  CRDA: Error: [Errno 2] No such file or directory
  DistroRelease: Ubuntu 14.10
  HibernationDevice: RESUME=UUID=5a5d0aa4-b8ee-4bf7-b1b9-761b7d1550b6
  InstallationDate: Installed on 2014-10-31 (37 days ago)
  InstallationMedia: Ubuntu-Server 14.10 "Utopic Unicorn" - Release i386 (20141022.2)
   lo        no wireless extensions.
   eth0      no wireless extensions.
  Lsusb: Error: command ['lsusb'] failed with exit code 1: unable to initialize libusb: -99
  MachineType: Microsoft Corporation Virtual Machine
  Package: linux (not installed)
   PATH=(custom, no user)
  ProcFB: 0 hyperv_fb
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.16.0-24-generic root=UUID=83fb481a-8898-4adc-bf31-4e160f5f0ce8 ro crashkernel=128M-:64M
  ProcVersionSignature: Ubuntu 3.16.0-24.32-generic 3.16.4
   linux-restricted-modules-3.16.0-24-generic N/A
   linux-backports-modules-3.16.0-24-generic  N/A
   linux-firmware                             1.138
  RfKill: Error: [Errno 2] No such file or directory
  Tags:  utopic
  Uname: Linux 3.16.0-24-generic i686
  UpgradeStatus: No upgrade log present (probably fresh install)
   Dec  8 08:16:46 ubuntu1410i386 dhclient: DHCPREQUEST of on eth0 to port 67 (xid=0x4b67ffa3)
   Dec  8 08:16:46 ubuntu1410i386 dhclient: DHCPACK of from
   Dec  8 08:16:47 ubuntu1410i386 dhclient: bound to -- renewal in 13914 seconds.
   Dec  8 10:10:47 ubuntu1410i386 kernel: [1840786.031060] init: tty1 main process ended, respawning
  _MarkForUpload: True
  dmi.bios.date: 05/23/2012
  dmi.bios.vendor: American Megatrends Inc.
  dmi.bios.version: 090006
  dmi.board.name: Virtual Machine
  dmi.board.vendor: Microsoft Corporation
  dmi.board.version: 7.0
  dmi.chassis.asset.tag: 7176-0455-3377-8479-3268-6677-66
  dmi.chassis.type: 3
  dmi.chassis.vendor: Microsoft Corporation
  dmi.chassis.version: 7.0
  dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr090006:bd05/23/2012:svnMicrosoftCorporation:pnVirtualMachine:pvr7.0:rvnMicrosoftCorporation:rnVirtualMachine:rvr7.0:cvnMicrosoftCorporation:ct3:cvr7.0:
  dmi.product.name: Virtual Machine
  dmi.product.version: 7.0
  dmi.sys.vendor: Microsoft Corporation

To manage notifications about this bug go to: