Skip to contentSkip to conversation

RFC: vmcoreinfo device

PATCH In review Marc-André Lureau 6 participants 16 messages Apr 24, 2017 – Jun 15, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RFC: vmcoreinfo device

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various informations useful to debug the guest OS. (it is greatly inspired by the VMGENID device implementation)

This is an early-boot alternative to the qemu-ga VMDUMP_INFO event proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg directly instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:
https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

---
 include/hw/acpi/aml-build.h        |   1 +
 include/hw/acpi/vmcoreinfo.h       |  36 +++++++
 include/hw/compat.h                |   4 +
 hw/acpi/aml-build.c                |   2 +
 hw/acpi/vmcoreinfo.c               | 207 +++++++++++++++++++++++++++++++++++++
 hw/i386/acpi-build.c               |  14 +++
 default-configs/i386-softmmu.mak   |   1 +
 default-configs/x86_64-softmmu.mak |   1 +
 docs/specs/vmcoreinfo.txt          | 138 +++++++++++++++++++++++++
 hw/acpi/Makefile.objs              |   1 +
 10 files changed, 405 insertions(+)
 create mode 100644 include/hw/acpi/vmcoreinfo.h
 create mode 100644 hw/acpi/vmcoreinfo.c
 create mode 100644 docs/specs/vmcoreinfo.txt
include/hw/acpi/aml-build.h +1 -0
index 00c21f160c..fd479115e1 100644
@@ -211,6 +211,7 @@ struct AcpiBuildTables {
     GArray *rsdp;
     GArray *tcpalog;
     GArray *vmgenid;
+    GArray *vmcoreinfo;
     BIOSLinker *linker;
 } AcpiBuildTables;
 
include/hw/acpi/vmcoreinfo.h new file +36 -0
new file mode 100644
index 0000000000..63196aeee0
@@ -0,0 +1,36 @@
+#ifndef ACPI_VMCOREINFO_H
+#define ACPI_VMCOREINFO_H
+
+#include "hw/acpi/bios-linker-loader.h"
+#include "hw/qdev.h"
+
+#define VMCOREINFO_DEVICE           "vmcoreinfo"
+#define VMCOREINFO_FW_CFG_FILE      "etc/vmcoreinfo"
+#define VMCOREINFO_ADDR_FW_CFG_FILE "etc/vmcoreinfo-addr"
+
+#define VMCOREINFO_FW_CFG_SIZE      4096 /* Occupy a page of memory */
+#define VMCOREINFO_OFFSET           40   /* allow space for
+                                          * OVMF SDT Header Probe Supressor
+                                          */
+
+#define VMCOREINFO(obj) OBJECT_CHECK(VmcoreinfoState, (obj), VMCOREINFO_DEVICE)
+
+typedef struct VmcoreinfoState {
+    DeviceClass parent_obj;
+    uint8_t vmcoreinfo_addr_le[8];   /* Address of memory region */
+    bool write_pointer_available;
+} VmcoreinfoState;
+
+/* returns NULL unless there is exactly one device */
+static inline Object *find_vmcoreinfo_dev(void)
+{
+    return object_resolve_path_type("", VMCOREINFO_DEVICE, NULL);
+}
+
+void vmcoreinfo_build_acpi(VmcoreinfoState *vis, GArray *table_data,
+                           GArray *vmci, BIOSLinker *linker);
+void vmcoreinfo_add_fw_cfg(VmcoreinfoState *vis, FWCfgState *s, GArray *vmci);
+bool vmcoreinfo_get(VmcoreinfoState *vis, uint64_t *paddr, uint32_t *size,
+                    Error **errp);
+
+#endif
include/hw/compat.h +4 -0
index 5d5be91daf..d0c9b71902 100644
@@ -135,6 +135,10 @@
         .driver   = "vmgenid",\
         .property = "x-write-pointer-available",\
         .value    = "off",\
+    },{\
+        .driver   = "vmcoreinfo",\
+        .property = "x-write-pointer-available",\
+        .value    = "off",\
     },
 
 #define HW_COMPAT_2_3 \
hw/acpi/aml-build.c +2 -0
index c6f2032dec..cd639586a4 100644
@@ -1560,6 +1560,7 @@ void acpi_build_tables_init(AcpiBuildTables *tables)
     tables->table_data = g_array_new(false, true /* clear */, 1);
     tables->tcpalog = g_array_new(false, true /* clear */, 1);
     tables->vmgenid = g_array_new(false, true /* clear */, 1);
+    tables->vmcoreinfo = g_array_new(false, true /* clear */, 1);
     tables->linker = bios_linker_loader_init();
 }
 
@@ -1570,6 +1571,7 @@ void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre)
     g_array_free(tables->table_data, true);
     g_array_free(tables->tcpalog, mfre);
     g_array_free(tables->vmgenid, mfre);
+    g_array_free(tables->vmcoreinfo, mfre);
 }
 
 /* Build rsdt table */
hw/acpi/vmcoreinfo.c new file +207 -0

207 lines not on this page · raw message

hw/i386/acpi-build.c +14 -0
index 2073108577..97f04401c4 100644
@@ -43,6 +43,7 @@
 #include "sysemu/tpm.h"
 #include "hw/acpi/tpm.h"
 #include "hw/acpi/vmgenid.h"
+#include "hw/acpi/vmcoreinfo.h"
 #include "sysemu/tpm_backend.h"
 #include "hw/timer/mc146818rtc_regs.h"
 #include "sysemu/numa.h"
@@ -2612,6 +2613,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
     GArray *tables_blob = tables->table_data;
     AcpiSlicOem slic_oem = { .id = NULL, .table_id = NULL };
     Object *vmgenid_dev;
+    Object *vmcoreinfo_dev;
 
     acpi_get_pm_info(&pm);
     acpi_get_misc_info(&misc);
@@ -2661,6 +2663,12 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
         vmgenid_build_acpi(VMGENID(vmgenid_dev), tables_blob,
                            tables->vmgenid, tables->linker);
     }
+    vmcoreinfo_dev = find_vmcoreinfo_dev();
+    if (vmcoreinfo_dev) {
+        acpi_add_table(table_offsets, tables_blob);
+        vmcoreinfo_build_acpi(VMCOREINFO(vmcoreinfo_dev), tables_blob,
+                              tables->vmcoreinfo, tables->linker);
+    }
 
     if (misc.has_hpet) {
         acpi_add_table(table_offsets, tables_blob);
@@ -2833,6 +2841,7 @@ void acpi_setup(void)
     AcpiBuildTables tables;
     AcpiBuildState *build_state;
     Object *vmgenid_dev;
+    Object *vmcoreinfo_dev;
 
     if (!pcms->fw_cfg) {
         ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n");
@@ -2874,6 +2883,11 @@ void acpi_setup(void)
         vmgenid_add_fw_cfg(VMGENID(vmgenid_dev), pcms->fw_cfg,
                            tables.vmgenid);
     }
+    vmcoreinfo_dev = find_vmcoreinfo_dev();
+    if (vmcoreinfo_dev) {
+        vmcoreinfo_add_fw_cfg(VMCOREINFO(vmcoreinfo_dev), pcms->fw_cfg,
+                              tables.vmcoreinfo);
+    }
 
     if (!pcmc->rsdp_in_ram) {
         /*
default-configs/i386-softmmu.mak +1 -0
index 029e95202a..5b0acdb715 100644
@@ -60,3 +60,4 @@ CONFIG_SMBIOS=y
 CONFIG_HYPERV_TESTDEV=$(CONFIG_KVM)
 CONFIG_PXB=y
 CONFIG_ACPI_VMGENID=y
+CONFIG_ACPI_VMCOREINFO=y
default-configs/x86_64-softmmu.mak +1 -0
index d1d7432f74..71033e26fa 100644
@@ -60,3 +60,4 @@ CONFIG_SMBIOS=y
 CONFIG_HYPERV_TESTDEV=$(CONFIG_KVM)
 CONFIG_PXB=y
 CONFIG_ACPI_VMGENID=y
+CONFIG_ACPI_VMCOREINFO=y
docs/specs/vmcoreinfo.txt new file +138 -0

138 lines not on this page · raw message

hw/acpi/Makefile.objs +1 -0
index 11c35bcb44..9623078f95 100644
@@ -6,6 +6,7 @@ common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o
 common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o
 common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
 common-obj-$(CONFIG_ACPI_VMGENID) += vmgenid.o
+common-obj-$(CONFIG_ACPI_VMCOREINFO) += vmcoreinfo.o
 common-obj-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.o
 
 common-obj-y += acpi_interface.o
Signature · 1 line
2.12.0.191.gc5d8de91d
#1 lore raw

On Mon, Apr 24, 2017 at 05:03:55PM +0400, Marc-André Lureau wrote:
[...]

include/hw/compat.h line 142

Quoted 13 lines
include/hw/compat.h +4 -0
index 5d5be91daf..d0c9b71902 100644
@@ -135,6 +135,10 @@
         .driver   = "vmgenid",\
         .property = "x-write-pointer-available",\
         .value    = "off",\
+    },{\
+        .driver   = "vmcoreinfo",\
+        .property = "x-write-pointer-available",\
+        .value    = "off",\
     },

My first reaction to this was "we don't need this compat property, because the device didn't even exist in QEMU 2.4".

But then I read commit f2a1ae45d8ec5ad494e66a9234499a2e0fbf4b40 and now I see why this is required: this is a compat property whose sole function is to prevent the device from being instantiated.

Instead of requiring an extra compat property, I suggest just checking if fw_cfg has DMA enabled. e.g.:

static void vmgenid_realize(DeviceState *dev, Error **errp)

 {
     VmGenIdState *vms = VMGENID(dev);

+ FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("", TYPE_FW_CFG, NULL));

- if (!vms->write_pointer_available) {

+    if (!fw_cfg || !fw_cfg_dma_enabled(fw_cfg)) {
         error_setg(errp, "%s requires DMA write support in fw_cfg, "
                    "which this machine type does not provide", VMGENID_DEVICE);
         return;

This has the additional benefit of handling other cases properly, like:

  $ qemu-system-x86_64 -device vmgenid -machine none
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.9 -global fw_cfg.dma_enabled=off
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.6 -global fw_cfg.dma_enabled=on
  [boots normally]
  $
Signature · 1 line
Eduardo
#2 lore raw
Quoted 40 lines · Eduardo Habkost

On Mon, Apr 24, 2017 at 05:03:55PM +0400, Marc-André Lureau wrote:
[...]

include/hw/compat.h line 142

Quoted 13 lines
include/hw/compat.h +4 -0
index 5d5be91daf..d0c9b71902 100644
@@ -135,6 +135,10 @@
         .driver   = "vmgenid",\
         .property = "x-write-pointer-available",\
         .value    = "off",\
+    },{\
+        .driver   = "vmcoreinfo",\
+        .property = "x-write-pointer-available",\
+        .value    = "off",\
     },

My first reaction to this was "we don't need this compat property, because the device didn't even exist in QEMU 2.4".

But then I read commit f2a1ae45d8ec5ad494e66a9234499a2e0fbf4b40 and now I see why this is required: this is a compat property whose sole function is to prevent the device from being instantiated.

Instead of requiring an extra compat property, I suggest just checking if fw_cfg has DMA enabled. e.g.:

static void vmgenid_realize(DeviceState *dev, Error **errp)

 {
     VmGenIdState *vms = VMGENID(dev);
(quoted diff) +2 -1
+    FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("", TYPE_FW_CFG, NULL));
 
-    if (!vms->write_pointer_available) {
+    if (!fw_cfg || !fw_cfg_dma_enabled(fw_cfg)) {
         error_setg(errp, "%s requires DMA write support in fw_cfg, "
                    "which this machine type does not provide", VMGENID_DEVICE);
         return;

This has the additional benefit of handling other cases properly, like:

Quoted 7 lines
  $ qemu-system-x86_64 -device vmgenid -machine none
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.9 -global fw_cfg.dma_enabled=off
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.6 -global fw_cfg.dma_enabled=on
  [boots normally]
  $

It's quite ugly to make it poke at fw cfg internals though, it shouldn't know how is write pointer implemented. We need some kind of API that it can share with vm gen id.

Quoted 2 lines
Signature · 1 line
Eduardo
#3 lore raw
Quoted 49 lines · Michael S. Tsirkin
Quoted 40 lines · Eduardo Habkost

On Mon, Apr 24, 2017 at 05:03:55PM +0400, Marc-André Lureau wrote:
[...]

include/hw/compat.h line 142

Quoted 13 lines
include/hw/compat.h +4 -0
index 5d5be91daf..d0c9b71902 100644
@@ -135,6 +135,10 @@
         .driver   = "vmgenid",\
         .property = "x-write-pointer-available",\
         .value    = "off",\
+    },{\
+        .driver   = "vmcoreinfo",\
+        .property = "x-write-pointer-available",\
+        .value    = "off",\
     },

My first reaction to this was "we don't need this compat property, because the device didn't even exist in QEMU 2.4".

But then I read commit f2a1ae45d8ec5ad494e66a9234499a2e0fbf4b40 and now I see why this is required: this is a compat property whose sole function is to prevent the device from being instantiated.

Instead of requiring an extra compat property, I suggest just checking if fw_cfg has DMA enabled. e.g.:

static void vmgenid_realize(DeviceState *dev, Error **errp)

 {
     VmGenIdState *vms = VMGENID(dev);
(quoted diff) +2 -1
+    FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("", TYPE_FW_CFG, NULL));
 
-    if (!vms->write_pointer_available) {
+    if (!fw_cfg || !fw_cfg_dma_enabled(fw_cfg)) {
         error_setg(errp, "%s requires DMA write support in fw_cfg, "
                    "which this machine type does not provide", VMGENID_DEVICE);
         return;

This has the additional benefit of handling other cases properly, like:

Quoted 7 lines
  $ qemu-system-x86_64 -device vmgenid -machine none
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.9 -global fw_cfg.dma_enabled=off
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.6 -global fw_cfg.dma_enabled=on
  [boots normally]
  $
Quoted 3 lines

It's quite ugly to make it poke at fw cfg internals though, it shouldn't know how is write pointer implemented. We need some kind of API that it can share with vm gen id.

Do you mean adding something like this to bios-linker-loader.c?

  bool bios_linker_loader_can_write_pointer(void)
  {
      FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("", TYPE_FW_CFG, NULL));
      return fw_cfg && fw_cfg_dma_enabled(fw_cfg);
  }
Signature · 1 line
Eduardo
#4 lore raw

Hi

Quoted 64 lines · Eduardo Habkost
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Eduardo Habkost

On Mon, Apr 24, 2017 at 05:03:55PM +0400, Marc-André Lureau wrote:
[...]

include/hw/compat.h line 142

Quoted 13 lines
include/hw/compat.h +4 -0
index 5d5be91daf..d0c9b71902 100644
@@ -135,6 +135,10 @@
         .driver   = "vmgenid",\
         .property = "x-write-pointer-available",\
         .value    = "off",\
+    },{\
+        .driver   = "vmcoreinfo",\
+        .property = "x-write-pointer-available",\
+        .value    = "off",\
     },

My first reaction to this was "we don't need this compat property,

because the

Quoted 3 lines
Quoted 3 lines

device didn't even exist in QEMU 2.4".

But then I read commit f2a1ae45d8ec5ad494e66a9234499a2e0fbf4b40 and

now I see

Quoted 1 line
Quoted 1 line

why this is required: this is a compat property whose sole function is

to

Quoted 3 lines
Quoted 3 lines

prevent the device from being instantiated.

Instead of requiring an extra compat property, I suggest just checking

if

Quoted 6 lines
Quoted 6 lines

fw_cfg has DMA enabled. e.g.:

static void vmgenid_realize(DeviceState *dev, Error **errp)

 {
     VmGenIdState *vms = VMGENID(dev);

+ FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("",

TYPE_FW_CFG, NULL));

Quoted 5 lines

Review

Quoted 5 lines
(quoted diff) +1 -1
-    if (!vms->write_pointer_available) {
+    if (!fw_cfg || !fw_cfg_dma_enabled(fw_cfg)) {
         error_setg(errp, "%s requires DMA write support in fw_cfg, "
                    "which this machine type does not provide",

VMGENID_DEVICE);

Quoted 7 lines
Quoted 7 lines
         return;

This has the additional benefit of handling other cases properly, like:

  $ qemu-system-x86_64 -device vmgenid -machine none
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write

support in fw_cfg, which this machine type does not provide

Quoted 1 line
Quoted 1 line
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.9 -global

fw_cfg.dma_enabled=off

Quoted 1 line
Quoted 1 line

qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write

support in fw_cfg, which this machine type does not provide

Quoted 1 line
Quoted 1 line
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.6 -global

fw_cfg.dma_enabled=on

Quoted 6 lines
Quoted 2 lines

[boots normally]
$

It's quite ugly to make it poke at fw cfg internals though, it shouldn't know how is write pointer implemented. We need some kind of API that it can share with vm gen id.

Quoted 10 lines

Do you mean adding something like this to bios-linker-loader.c?

bool bios_linker_loader_can_write_pointer(void)
{
FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("",

TYPE_FW_CFG, NULL));
      return fw_cfg && fw_cfg_dma_enabled(fw_cfg);

}

Looks like a good change to me, are you going to send a patch?

thanks

Signature · 1 line
Marc-André Lureau
#5 lore raw
Quoted 78 lines · Marc-André Lureau

Hi

Quoted 64 lines · Eduardo Habkost
Quoted 18 lines · Michael S. Tsirkin
Quoted 17 lines · Eduardo Habkost

On Mon, Apr 24, 2017 at 05:03:55PM +0400, Marc-André Lureau wrote:
[...]

include/hw/compat.h line 142

Quoted 13 lines
include/hw/compat.h +4 -0
index 5d5be91daf..d0c9b71902 100644
@@ -135,6 +135,10 @@
         .driver   = "vmgenid",\
         .property = "x-write-pointer-available",\
         .value    = "off",\
+    },{\
+        .driver   = "vmcoreinfo",\
+        .property = "x-write-pointer-available",\
+        .value    = "off",\
     },

My first reaction to this was "we don't need this compat property,

because the

Quoted 3 lines
Quoted 3 lines

device didn't even exist in QEMU 2.4".

But then I read commit f2a1ae45d8ec5ad494e66a9234499a2e0fbf4b40 and

now I see

Quoted 1 line
Quoted 1 line

why this is required: this is a compat property whose sole function is

to

Quoted 3 lines
Quoted 3 lines

prevent the device from being instantiated.

Instead of requiring an extra compat property, I suggest just checking

if

Quoted 6 lines
Quoted 6 lines

fw_cfg has DMA enabled. e.g.:

static void vmgenid_realize(DeviceState *dev, Error **errp)

 {
     VmGenIdState *vms = VMGENID(dev);

+ FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("",

TYPE_FW_CFG, NULL));

Quoted 5 lines

Review

Quoted 5 lines
(quoted diff) +1 -1
-    if (!vms->write_pointer_available) {
+    if (!fw_cfg || !fw_cfg_dma_enabled(fw_cfg)) {
         error_setg(errp, "%s requires DMA write support in fw_cfg, "
                    "which this machine type does not provide",

VMGENID_DEVICE);

Quoted 7 lines
Quoted 7 lines
         return;

This has the additional benefit of handling other cases properly, like:

  $ qemu-system-x86_64 -device vmgenid -machine none
  qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write

support in fw_cfg, which this machine type does not provide

Quoted 1 line
Quoted 1 line
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.9 -global

fw_cfg.dma_enabled=off

Quoted 1 line
Quoted 1 line

qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write

support in fw_cfg, which this machine type does not provide

Quoted 1 line
Quoted 1 line
  $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.6 -global

fw_cfg.dma_enabled=on

Quoted 6 lines
Quoted 2 lines

[boots normally]
$

It's quite ugly to make it poke at fw cfg internals though, it shouldn't know how is write pointer implemented. We need some kind of API that it can share with vm gen id.

Quoted 10 lines

Do you mean adding something like this to bios-linker-loader.c?

bool bios_linker_loader_can_write_pointer(void)
{
FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("",

TYPE_FW_CFG, NULL));
      return fw_cfg && fw_cfg_dma_enabled(fw_cfg);

}

Quoted 1 line

Looks like a good change to me, are you going to send a patch?

I will add it to my (wish-)to-do list, but I will probably take a while until I get to do it. If anybody wants to implement that, please be my guest.

Signature · 1 line
Eduardo
#6 lore raw
In reply to Marc-André Lureau
Quoted 5 lines · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various informations useful to debug the guest OS. (it is greatly inspired by the VMGENID device implementation)

Quoted 8 lines

This is an early-boot alternative to the qemu-ga VMDUMP_INFO event proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg directly instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:
https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Here's a proof-of-concept Windows driver:
https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

I just wanted to be sure that it's possible to evaluate the ADDR method in Windows.

Quoted 1 line

From a practical point of view it is unfortunate that this would be a

completely new device. For Windows guests it means another driver binary and all the overhead associated with deploying it on VMs. Would it be too crazy to add this functionality to the pvpanic device? The mechanics could stay the same but it would be done under the existing ACPI\QEMU0001 device.

Quoted 18 lines
docs/specs/vmcoreinfo.txt new file +18 -0
+Storage Format:
+---------------
+
+The content is expected to use little-endian format.
+
+In order to implement an OVMF "SDT Header Probe Suppressor", the contents of
+the vmcoreinfo blob has 40 bytes of padding:
+
++-----------------------------------+
+| SSDT with OEM Table ID = VMCOREIN |
++-----------------------------------+
+| ...                               |       TOP OF PAGE
+| VCIA dword object ----------------|-----> +---------------------------+
+| ...                               |       | fw-allocated array for    |
+| _STA method referring to VCIA     |       | "etc/vmcoreinfo"          |
+| ...                               |       +---------------------------+
+| ADDR method referring to VCIA     |       |  0: OVMF SDT Header probe |
+| ...                               |       |     suppressor            |

docs/specs/vmcoreinfo.txt line 136

Quoted 10 lines
docs/specs/vmcoreinfo.txt new file +10 -0
++-----------------------------------+       | 40: uint32 version field  |
+                                            | 44: info contents         |
+                                            |     ....                  |
+                                            +---------------------------+
+                                            END OF PAGE
+
+Version 0 content:
+
+ uint64 paddr:
+  Physical address of the Linux vmcoreinfo ELF note.

Or physical address of the Windows crash dump header :p
Do we want to have an additional discriminator field to tell what kind of information was written by the guest or would Windows use a different version?

Thanks!
Ladi

#7 lore raw

Hi

Quoted 23 lines · Ladi Prosek
Quoted 5 lines · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various informations useful to debug the guest OS. (it is greatly inspired by the VMGENID device implementation)

Quoted 8 lines

This is an early-boot alternative to the qemu-ga VMDUMP_INFO event proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg directly instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:
https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

I just wanted to be sure that it's possible to evaluate the ADDR method in Windows.

Quoted 7 lines

From a practical point of view it is unfortunate that this would be a completely new device. For Windows guests it means another driver binary and all the overhead associated with deploying it on VMs. Would it be too crazy to add this functionality to the pvpanic device? The mechanics could stay the same but it would be done under the existing ACPI\QEMU0001 device.

pvpanic is under _SB.PCI0.ISA, that could be problematic

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make sense to merge both and how.

Can't you handle 2 ACPI devices in the same windows driver instead?

Quoted 34 lines

+Storage Format:

docs/specs/vmcoreinfo.txt

Quoted 5 lines

+---------------

docs/specs/vmcoreinfo.txt new file +4 -0
+
+The content is expected to use little-endian format.
+
+In order to implement an OVMF "SDT Header Probe Suppressor", the

contents of

docs/specs/vmcoreinfo.txt

Quoted 7 lines
docs/specs/vmcoreinfo.txt new file +7 -0
+the vmcoreinfo blob has 40 bytes of padding:
+
++-----------------------------------+
+| SSDT with OEM Table ID = VMCOREIN |
++-----------------------------------+
+| ...                               |       TOP OF PAGE
+| VCIA dword object ----------------|----->
+---------------------------+
> +| ...                               |       | fw-allocated array for
|
> +| _STA method referring to VCIA     |       | "etc/vmcoreinfo"
|
> +| ...                               |
 +---------------------------+
> +| ADDR method referring to VCIA     |       |  0: OVMF SDT Header probe
|
> +| ...                               |       |     suppressor
|
> ++-----------------------------------+       | 40: uint32 version field
|
> +                                            | 44: info contents
 |
> +                                            |     ....
|
Quoted 1 line

+

+---------------------------+
> +                                            END OF PAGE
Quoted 8 lines

docs/specs/vmcoreinfo.txt line 136

Quoted 5 lines
docs/specs/vmcoreinfo.txt new file +5 -0
+
+Version 0 content:
+
+ uint64 paddr:
+  Physical address of the Linux vmcoreinfo ELF note.

Or physical address of the Windows crash dump header :p

Is there support for Windows crash dump in qemu?

Quoted 5 lines

Do we want to have an additional discriminator field to tell what kind of information was written by the guest or would Windows use a different version?

I guess a different version would be ok.

Thanks a lot for looking at it!

Signature · 1 line
Marc-André Lureau
#8 lore raw
Quoted 35 lines · Marc-André Lureau

Hi

Quoted 24 lines · Ladi Prosek
Quoted 5 lines · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various informations useful to debug the guest OS. (it is greatly inspired by the VMGENID device implementation)

Quoted 8 lines

This is an early-boot alternative to the qemu-ga VMDUMP_INFO event proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg directly instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:
https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

I just wanted to be sure that it's possible to evaluate the ADDR method in Windows.

Quoted 6 lines

From a practical point of view it is unfortunate that this would be a completely new device. For Windows guests it means another driver binary and all the overhead associated with deploying it on VMs. Would it be too crazy to add this functionality to the pvpanic device? The mechanics could stay the same but it would be done under the existing ACPI\QEMU0001 device.

Quoted 8 lines

pvpanic is under _SB.PCI0.ISA, that could be problematic

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make sense to merge both and how.

Can't you handle 2 ACPI devices in the same windows driver instead?

It can be done but it's uncommon for one driver to drive two different devices so it would probably be confusing.

Quoted 43 lines
Quoted 33 lines
Quoted 33 lines
docs/specs/vmcoreinfo.txt new file +6 -0
+Storage Format:
+---------------
+
+The content is expected to use little-endian format.
+
+In order to implement an OVMF "SDT Header Probe Suppressor", the

contents of

docs/specs/vmcoreinfo.txt new file +9 -0
+the vmcoreinfo blob has 40 bytes of padding:
+
++-----------------------------------+
+| SSDT with OEM Table ID = VMCOREIN |
++-----------------------------------+
+| ...                               |       TOP OF PAGE
+| VCIA dword object ----------------|----->
+---------------------------+
+| ...                               |       | fw-allocated array for

|
+| _STA method referring to VCIA | | "etc/vmcoreinfo"
|
+| ... |

+---------------------------+
+| ADDR method referring to VCIA     |       |  0: OVMF SDT Header probe
|
+| ...                               |       |     suppressor
|
++-----------------------------------+       | 40: uint32 version field
|
+                                            | 44: info contents
|
+                                            |     ....
|

+
+---------------------------+

Quoted 8 lines

docs/specs/vmcoreinfo.txt line 136

Quoted 6 lines
docs/specs/vmcoreinfo.txt new file +6 -0
+                                            END OF PAGE
+
+Version 0 content:
+
+ uint64 paddr:
+  Physical address of the Linux vmcoreinfo ELF note.

Or physical address of the Windows crash dump header :p

Quoted 1 line

Is there support for Windows crash dump in qemu?

Not yet :) We want to add it soon-ish. For QEMU (or libvirt?) to be able to create Windows crash dump out of a raw guest physical memory dump, it needs to know the "header", a page-sized datastructure which Windows exposes via a kernel API. So the idea is that we would use the same mechanism as Linux for its KASLR dump support.

Quoted 11 lines
Quoted 5 lines

Do we want to have an additional discriminator field to tell what kind of information was written by the guest or would Windows use a different version?

I guess a different version would be ok.

Thanks a lot for looking at it!
--
Marc-André Lureau

Thank you!
Ladi

#9 lore raw
In reply to Marc-André Lureau
Quoted 35 lines · On Fri, 28 Apr 2017 14:28:38 +0000 Marc-André Lureau…

Hi

Quoted 23 lines · Ladi Prosek
Quoted 5 lines · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various informations useful to debug the guest OS. (it is greatly inspired by the VMGENID device implementation)

Quoted 8 lines

This is an early-boot alternative to the qemu-ga VMDUMP_INFO event proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg directly instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:
https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

I just wanted to be sure that it's possible to evaluate the ADDR method in Windows.

Quoted 7 lines

From a practical point of view it is unfortunate that this would be a completely new device. For Windows guests it means another driver binary and all the overhead associated with deploying it on VMs. Would it be too crazy to add this functionality to the pvpanic device? The mechanics could stay the same but it would be done under the existing ACPI\QEMU0001 device.

Quoted 8 lines

pvpanic is under _SB.PCI0.ISA, that could be problematic

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make sense to merge both and how.

Can't you handle 2 ACPI devices in the same windows driver instead?

we use QEMU0001 to reserve IO ports for pvpanic device, ASL wise there shouldn't problems with adding _ADDR method to it

but then we probably should fold vmcoreinfo into pvpanic device as well (QEMU and linux driver)

Quoted 55 lines
Quoted 35 lines

+Storage Format:

docs/specs/vmcoreinfo.txt

Quoted 5 lines

+---------------

docs/specs/vmcoreinfo.txt new file +4 -0
+
+The content is expected to use little-endian format.
+
+In order to implement an OVMF "SDT Header Probe Suppressor", the  

contents of

docs/specs/vmcoreinfo.txt

Quoted 7 lines
docs/specs/vmcoreinfo.txt new file +7 -0
+the vmcoreinfo blob has 40 bytes of padding:
+
++-----------------------------------+
+| SSDT with OEM Table ID = VMCOREIN |
++-----------------------------------+
+| ...                               |       TOP OF PAGE
+| VCIA dword object ----------------|----->  
+---------------------------+  
> +| ...                               |       | fw-allocated array for  
|  
> +| _STA method referring to VCIA     |       | "etc/vmcoreinfo"  
|  
> +| ...                               |  
 +---------------------------+  
> +| ADDR method referring to VCIA     |       |  0: OVMF SDT Header probe  
|  
> +| ...                               |       |     suppressor  
|  
> ++-----------------------------------+       | 40: uint32 version field  
|  
> +                                            | 44: info contents  
 |  
> +                                            |     ....  
|  
> +  
+---------------------------+  
> +                                            END OF PAGE
Quoted 8 lines

docs/specs/vmcoreinfo.txt line 136

Quoted 5 lines
docs/specs/vmcoreinfo.txt new file +5 -0
+
+Version 0 content:
+
+ uint64 paddr:
+  Physical address of the Linux vmcoreinfo ELF note.  

Or physical address of the Windows crash dump header :p

Is there support for Windows crash dump in qemu?

Quoted 5 lines

Do we want to have an additional discriminator field to tell what kind of information was written by the guest or would Windows use a different version?

I guess a different version would be ok.

Thanks a lot for looking at it!

#10 lore raw

Hi

Quoted 46 lines · Igor Mammedov
Quoted 15 lines · On Fri, 28 Apr 2017 14:28:38 +0000 Marc-André Lureau…

Hi

Quoted 11 lines · Ladi Prosek
Quoted 9 lines · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various informations useful to debug the guest OS. (it is greatly inspired by the VMGENID device implementation)

This is an early-boot alternative to the qemu-ga VMDUMP_INFO event proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg

directly

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:
https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

Quoted 12 lines
Quoted 11 lines

I just wanted to be sure that it's possible to evaluate the ADDR method in Windows.

From a practical point of view it is unfortunate that this would be a completely new device. For Windows guests it means another driver binary and all the overhead associated with deploying it on VMs. Would it be too crazy to add this functionality to the pvpanic device? The mechanics could stay the same but it would be done under the existing ACPI\QEMU0001 device.

Quoted 5 lines

pvpanic is under _SB.PCI0.ISA, that could be problematic

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make sense

to

Quoted 10 lines
Quoted 3 lines

merge both and how.

Can't you handle 2 ACPI devices in the same windows driver instead?

we use QEMU0001 to reserve IO ports for pvpanic device, ASL wise there shouldn't problems with adding _ADDR method to it

but then we probably should fold vmcoreinfo into pvpanic device as well (QEMU and linux driver)

pvpanic is x86-only afaict. While I think vmcoreinfo would work fine with any acpi-able arch.

I think I would rather modify the windows driver to support both pvpanic & vmcoreinfo, even if it's not typical for driver to implement several devices.

Quoted 54 lines
Quoted 16 lines
Quoted 16 lines

+Storage Format:

docs/specs/vmcoreinfo.txt

Quoted 5 lines

+---------------

docs/specs/vmcoreinfo.txt new file +4 -0
+
+The content is expected to use little-endian format.
+
+In order to implement an OVMF "SDT Header Probe Suppressor", the

contents of

docs/specs/vmcoreinfo.txt

Quoted 7 lines
docs/specs/vmcoreinfo.txt new file +7 -0
+the vmcoreinfo blob has 40 bytes of padding:
+
++-----------------------------------+
+| SSDT with OEM Table ID = VMCOREIN |
++-----------------------------------+
+| ...                               |       TOP OF PAGE
+| VCIA dword object ----------------|----->

+---------------------------+

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

+| ... | | fw-allocated array for

|

Quoted 1 line

+| _STA method referring to VCIA | | "etc/vmcoreinfo"

|

Quoted 1 line

+| ... |

 +---------------------------+
> +| ADDR method referring to VCIA     |       |  0: OVMF SDT Header

probe

Quoted 4 lines
Quoted 4 lines

|

Quoted 1 line

+| ... | | suppressor

|

Quoted 1 line

++-----------------------------------+ | 40: uint32 version

field

Quoted 25 lines
Quoted 8 lines

|

Quoted 1 line

+ | 44: info contents

|

Quoted 1 line

+ | ....

|

Quoted 1 line

+

+---------------------------+
> +                                            END OF PAGE
Quoted 8 lines

docs/specs/vmcoreinfo.txt line 136

Quoted 5 lines
docs/specs/vmcoreinfo.txt new file +5 -0
+
+Version 0 content:
+
+ uint64 paddr:
+  Physical address of the Linux vmcoreinfo ELF note.

Or physical address of the Windows crash dump header :p

Is there support for Windows crash dump in qemu?

Quoted 5 lines

Do we want to have an additional discriminator field to tell what kind of information was written by the guest or would Windows use a different version?

Quoted 5 lines
Quoted 3 lines

I guess a different version would be ok.

Thanks a lot for looking at it!

--

Marc-André Lureau

#11 lore raw
Quoted 53 lines · On Tue, 02 May 2017 19:03:15 +0000 Marc-André Lureau…

Hi

Quoted 49 lines · Igor Mammedov
Quoted 15 lines · On Fri, 28 Apr 2017 14:28:38 +0000 Marc-André Lureau…

Hi

Quoted 11 lines · Ladi Prosek
Quoted 9 lines · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various informations useful to debug the guest OS. (it is greatly inspired by the VMGENID device implementation)

This is an early-boot alternative to the qemu-ga VMDUMP_INFO event proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg

directly

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:
https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

Quoted 12 lines
Quoted 11 lines

I just wanted to be sure that it's possible to evaluate the ADDR method in Windows.

From a practical point of view it is unfortunate that this would be a completely new device. For Windows guests it means another driver binary and all the overhead associated with deploying it on VMs. Would it be too crazy to add this functionality to the pvpanic device? The mechanics could stay the same but it would be done under the existing ACPI\QEMU0001 device.

Quoted 5 lines

pvpanic is under _SB.PCI0.ISA, that could be problematic

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make sense

to

Quoted 3 lines

merge both and how.

Can't you handle 2 ACPI devices in the same windows driver instead?

Quoted 8 lines
Quoted 7 lines

we use QEMU0001 to reserve IO ports for pvpanic device, ASL wise there shouldn't problems with adding _ADDR method to it

but then we probably should fold vmcoreinfo into pvpanic device as well (QEMU and linux driver)

pvpanic is x86-only afaict.

There is nothing that forces it to be x86 specific (beside being ISA device), ARM also can benefit from/use pvpanic if you make it pci device or just plain Device.

Quoted 2 lines

While I think vmcoreinfo would work fine with
any acpi-able arch.

I don't insist on it but it's worth a try, probably a lot of code could be shared between both (including AML part/which makes DSDT smaller little bit)

Quoted 64 lines

I think I would rather modify the windows driver to support both pvpanic & vmcoreinfo, even if it's not typical for driver to implement several devices.

Quoted 49 lines
Quoted 16 lines
Quoted 16 lines

+Storage Format:

docs/specs/vmcoreinfo.txt

Quoted 5 lines

+---------------

docs/specs/vmcoreinfo.txt new file +4 -0
+
+The content is expected to use little-endian format.
+
+In order to implement an OVMF "SDT Header Probe Suppressor", the  

contents of

docs/specs/vmcoreinfo.txt

Quoted 7 lines
docs/specs/vmcoreinfo.txt new file +7 -0
+the vmcoreinfo blob has 40 bytes of padding:
+
++-----------------------------------+
+| SSDT with OEM Table ID = VMCOREIN |
++-----------------------------------+
+| ...                               |       TOP OF PAGE
+| VCIA dword object ----------------|----->  

+---------------------------+

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

+| ... | | fw-allocated array for

|

Quoted 1 line

+| _STA method referring to VCIA | | "etc/vmcoreinfo"

|

Quoted 1 line

+| ... |

 +---------------------------+  
> +| ADDR method referring to VCIA     |       |  0: OVMF SDT Header  

probe

Quoted 4 lines
Quoted 4 lines

|

Quoted 1 line

+| ... | | suppressor

|

Quoted 1 line

++-----------------------------------+ | 40: uint32 version

field

Quoted 20 lines
Quoted 8 lines

|

Quoted 1 line

+ | 44: info contents

|

Quoted 1 line

+ | ....

|

Quoted 1 line

+

+---------------------------+  
> +                                            END OF PAGE
Quoted 8 lines

docs/specs/vmcoreinfo.txt line 136

Quoted 5 lines
docs/specs/vmcoreinfo.txt new file +5 -0
+
+Version 0 content:
+
+ uint64 paddr:
+  Physical address of the Linux vmcoreinfo ELF note.  

Or physical address of the Windows crash dump header :p

Is there support for Windows crash dump in qemu?

Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

Do we want to have an additional discriminator field to tell what kind of information was written by the guest or would Windows use a different version?

I guess a different version would be ok.

Thanks a lot for looking at it!

Marc-André Lureau

#12 lore raw

Hi

Quoted 75 lines · Igor Mammedov
Quoted 3 lines · On Tue, 02 May 2017 19:03:15 +0000 Marc-André Lureau…

Hi

On Tue, May 2, 2017 at 11:17 AM Igor Mammedov <[email protected]>

Quoted 7 lines · wrote:
Quoted 7 lines
Quoted 3 lines · On Fri, 28 Apr 2017 14:28:38 +0000 Marc-André Lureau…

Hi

On Fri, Apr 28, 2017 at 6:12 PM Ladi Prosek <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various

informations

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

useful to debug the guest OS. (it is greatly inspired by the

VMGENID

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

device implementation)

This is an early-boot alternative to the qemu-ga VMDUMP_INFO

event

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg

directly

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:

https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I just wanted to be sure that it's possible to evaluate the ADDR method in Windows.

From a practical point of view it is unfortunate that this would

be a

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

completely new device. For Windows guests it means another driver binary and all the overhead associated with deploying it on VMs.

Would

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

it be too crazy to add this functionality to the pvpanic device?

The

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

mechanics could stay the same but it would be done under the

existing

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

ACPI\QEMU0001 device.

pvpanic is under _SB.PCI0.ISA, that could be problematic

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make

sense

Quoted 11 lines
Quoted 11 lines

to

Quoted 3 lines

merge both and how.

Can't you handle 2 ACPI devices in the same windows driver instead?

we use QEMU0001 to reserve IO ports for pvpanic device, ASL wise there shouldn't problems with adding _ADDR method to it

but then we probably should fold vmcoreinfo into pvpanic device as well (QEMU and linux driver)

Quoted 7 lines
Quoted 1 line

pvpanic is x86-only afaict.

There is nothing that forces it to be x86 specific (beside being ISA device),
ARM also can benefit from/use pvpanic if you make it pci device or just plain
Device.

Could someone advise on a recommended solution here?

Should we make a PCI variant of pvpanic and add the proposed vmcoreinfo ACPI/mem to it ?

Tbh, I think I prefer to have seperate devices since they work differently and vmcoreinfo doesn't require any bus device.

thanks

Quoted 70 lines
Quoted 3 lines

While I think vmcoreinfo would work fine with
any acpi-able arch.

I don't insist on it but it's worth a try, probably a lot of code could be shared between both (including AML part/which makes DSDT smaller little bit)

Quoted 1 line

I think I would rather modify the windows driver to support both pvpanic

&

Quoted 20 lines

vmcoreinfo, even if it's not typical for driver to implement several devices.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

+Storage Format:

docs/specs/vmcoreinfo.txt

Quoted 5 lines

+---------------

docs/specs/vmcoreinfo.txt new file +4 -0
+
+The content is expected to use little-endian format.
+
+In order to implement an OVMF "SDT Header Probe Suppressor", the

contents of

docs/specs/vmcoreinfo.txt

Quoted 7 lines
docs/specs/vmcoreinfo.txt new file +7 -0
+the vmcoreinfo blob has 40 bytes of padding:
+
++-----------------------------------+
+| SSDT with OEM Table ID = VMCOREIN |
++-----------------------------------+
+| ...                               |       TOP OF PAGE
+| VCIA dword object ----------------|----->
+---------------------------+
> +| ...                               |       | fw-allocated

array for

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

|

Quoted 1 line

+| _STA method referring to VCIA | | "etc/vmcoreinfo"

|

Quoted 1 line

+| ... |

 +---------------------------+
> +| ADDR method referring to VCIA     |       |  0: OVMF SDT

Header

Quoted 23 lines
Quoted 23 lines

probe

Quoted 4 lines
Quoted 4 lines

|

Quoted 1 line

+| ... | | suppressor

|

Quoted 1 line

++-----------------------------------+ | 40: uint32 version

field

Quoted 17 lines
Quoted 16 lines

|

Quoted 1 line

+ | 44: info contents

|

Quoted 1 line

+ | ....

|

Quoted 1 line

+

+---------------------------+
> +                                            END OF PAGE

docs/specs/vmcoreinfo.txt line 136

Quoted 5 lines
docs/specs/vmcoreinfo.txt new file +5 -0
+
+Version 0 content:
+
+ uint64 paddr:
+  Physical address of the Linux vmcoreinfo ELF note.

Or physical address of the Windows crash dump header :p

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Is there support for Windows crash dump in qemu?

Quoted 1 line

Do we want to have an additional discriminator field to tell what

kind

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

of information was written by the guest or would Windows use a different version?

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

I guess a different version would be ok.

Thanks a lot for looking at it!

--

Marc-André Lureau

--

Marc-André Lureau

#13 lore raw
Quoted 87 lines · On Fri, 26 May 2017 13:59:09 +0000 Marc-André Lureau…

Hi

Quoted 75 lines · Igor Mammedov
Quoted 3 lines · On Tue, 02 May 2017 19:03:15 +0000 Marc-André Lureau…

Hi

On Tue, May 2, 2017 at 11:17 AM Igor Mammedov <[email protected]>

Quoted 7 lines · wrote:
Quoted 7 lines
Quoted 3 lines · On Fri, 28 Apr 2017 14:28:38 +0000 Marc-André Lureau…

Hi

On Fri, Apr 28, 2017 at 6:12 PM Ladi Prosek <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device which exposes a 4k memory range to the guest to store various

informations

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

useful to debug the guest OS. (it is greatly inspired by the

VMGENID

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

device implementation)

This is an early-boot alternative to the qemu-ga VMDUMP_INFO

event

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg

directly

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:

https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I just wanted to be sure that it's possible to evaluate the ADDR method in Windows.

From a practical point of view it is unfortunate that this would

be a

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

completely new device. For Windows guests it means another driver binary and all the overhead associated with deploying it on VMs.

Would

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

it be too crazy to add this functionality to the pvpanic device?

The

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

mechanics could stay the same but it would be done under the

existing

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

ACPI\QEMU0001 device.

pvpanic is under _SB.PCI0.ISA, that could be problematic

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make

sense

Quoted 11 lines
Quoted 11 lines

to

Quoted 3 lines

merge both and how.

Can't you handle 2 ACPI devices in the same windows driver instead?

we use QEMU0001 to reserve IO ports for pvpanic device, ASL wise there shouldn't problems with adding _ADDR method to it

but then we probably should fold vmcoreinfo into pvpanic device as well (QEMU and linux driver)

Quoted 7 lines
Quoted 1 line

pvpanic is x86-only afaict.

There is nothing that forces it to be x86 specific (beside being ISA device),
ARM also can benefit from/use pvpanic if you make it pci device or just plain
Device.

Quoted 7 lines

Could someone advise on a recommended solution here?

Should we make a PCI variant of pvpanic and add the proposed vmcoreinfo ACPI/mem to it ?

Tbh, I think I prefer to have seperate devices since they work differently and vmcoreinfo doesn't require any bus device.

Considering pvpanic and vmcore are closely related, I'd prefer it being one device. But I won't insist on it.

Also instead of PCI device, I'd use plain Device as vmgenid does, that would leave open question how to make legacy ISA based pvpanic on top of it in case both are merged.

Quoted 82 lines

thanks

Quoted 70 lines
Quoted 3 lines

While I think vmcoreinfo would work fine with
any acpi-able arch.

I don't insist on it but it's worth a try, probably a lot of code could be shared between both (including AML part/which makes DSDT smaller little bit)

Quoted 1 line

I think I would rather modify the windows driver to support both pvpanic

&

Quoted 20 lines

vmcoreinfo, even if it's not typical for driver to implement several devices.

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

+Storage Format:

Review

Quoted 5 lines

+---------------

(quoted diff) +4 -0
+
+The content is expected to use little-endian format.
+
+In order to implement an OVMF "SDT Header Probe Suppressor", the  

contents of

Review

Quoted 7 lines
(quoted diff) +7 -0
+the vmcoreinfo blob has 40 bytes of padding:
+
++-----------------------------------+
+| SSDT with OEM Table ID = VMCOREIN |
++-----------------------------------+
+| ...                               |       TOP OF PAGE
+| VCIA dword object ----------------|----->  
+---------------------------+  
> +| ...                               |       | fw-allocated  

array for

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

|

Quoted 1 line

+| _STA method referring to VCIA | | "etc/vmcoreinfo"

|

Quoted 1 line

+| ... |

 +---------------------------+  
> +| ADDR method referring to VCIA     |       |  0: OVMF SDT  

Header

Quoted 23 lines
Quoted 23 lines

probe

Quoted 4 lines
Quoted 4 lines

|

Quoted 1 line

+| ... | | suppressor

|

Quoted 1 line

++-----------------------------------+ | 40: uint32 version

field

Quoted 17 lines
Quoted 16 lines

|

Quoted 1 line

+ | 44: info contents

|

Quoted 1 line

+ | ....

|

Quoted 1 line

+

+---------------------------+  
> +                                            END OF PAGE

Review

Quoted 5 lines
(quoted diff) +5 -0
+
+Version 0 content:
+
+ uint64 paddr:
+  Physical address of the Linux vmcoreinfo ELF note.  

Or physical address of the Windows crash dump header :p

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Is there support for Windows crash dump in qemu?

Quoted 1 line

Do we want to have an additional discriminator field to tell what

kind

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

of information was written by the guest or would Windows use a different version?

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

I guess a different version would be ok.

Thanks a lot for looking at it!

Marc-André Lureau

Marc-André Lureau

#14 lore raw

Hi

Quoted 105 lines · Igor Mammedov
Quoted 3 lines · On Fri, 26 May 2017 13:59:09 +0000 Marc-André Lureau…

Hi

On Thu, May 4, 2017 at 5:41 PM Igor Mammedov <[email protected]>

Quoted 12 lines · wrote:
Quoted 12 lines
Quoted 3 lines · On Tue, 02 May 2017 19:03:15 +0000 Marc-André Lureau…

Hi

On Tue, May 2, 2017 at 11:17 AM Igor Mammedov <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines

On Fri, 28 Apr 2017 14:28:38 +0000
Marc-André Lureau <[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Hi

On Fri, Apr 28, 2017 at 6:12 PM Ladi Prosek <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device

which

Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

exposes a 4k memory range to the guest to store various

informations

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

useful to debug the guest OS. (it is greatly inspired by the

VMGENID

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

device implementation)

This is an early-boot alternative to the qemu-ga VMDUMP_INFO

event

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg

directly

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:

Quoted 7 lines
Quoted 7 lines

https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I just wanted to be sure that it's possible to evaluate the

ADDR

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

method in Windows.

From a practical point of view it is unfortunate that this

would

Quoted 2 lines
Quoted 2 lines

be a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

completely new device. For Windows guests it means another

driver

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

binary and all the overhead associated with deploying it on

VMs.

Quoted 2 lines
Quoted 2 lines

Would

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

it be too crazy to add this functionality to the pvpanic

device?

Quoted 8 lines
Quoted 8 lines

The

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

mechanics could stay the same but it would be done under the

existing

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

ACPI\QEMU0001 device.

pvpanic is under _SB.PCI0.ISA, that could be problematic

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make

sense

Quoted 4 lines
Quoted 4 lines

to

Quoted 3 lines

merge both and how.

Can't you handle 2 ACPI devices in the same windows driver

instead?

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

we use QEMU0001 to reserve IO ports for pvpanic device, ASL wise there shouldn't problems with adding _ADDR method to it

but then we probably should fold vmcoreinfo into pvpanic device as well (QEMU and linux driver)

Quoted 7 lines
Quoted 1 line

pvpanic is x86-only afaict.

There is nothing that forces it to be x86 specific (beside being ISA device),
ARM also can benefit from/use pvpanic if you make it pci device or just plain
Device.

Quoted 6 lines

Could someone advise on a recommended solution here?

Should we make a PCI variant of pvpanic and add the proposed vmcoreinfo ACPI/mem to it ?

Tbh, I think I prefer to have seperate devices since they work

Quoted 10 lines

differently

Quoted 1 line

and vmcoreinfo doesn't require any bus device.

Considering pvpanic and vmcore are closely related, I'd prefer it being one device. But I won't insist on it.

Also instead of PCI device, I'd use plain Device as vmgenid does, that would leave open question how to make legacy ISA based pvpanic on top of it in case both are merged.

Can we instead try to fit pvpanic functionality in the proposed vmcoreinfo device? This could be done in a future revision of the device. This way we don't have to deal with legacy ISA, and can make pvpanic functionality more portable.

Tbh, I have no idea how to do the merging of the legacy ISA pvpanic with vmcoreinfo without breaking things, nor do I have the motivation to do so.

More comments welcome (I would like to resend the patch as non-rfc this time, I hope we can make it in 2.10)

Thanks

Signature · 1 line
Marc-André Lureau
#15 lore raw
Quoted 119 lines · On Wed, 14 Jun 2017 10:46:08 +0000 Marc-André Lureau…

Hi

Quoted 105 lines · Igor Mammedov
Quoted 3 lines · On Fri, 26 May 2017 13:59:09 +0000 Marc-André Lureau…

Hi

On Thu, May 4, 2017 at 5:41 PM Igor Mammedov <[email protected]>

Quoted 12 lines · wrote:
Quoted 12 lines
Quoted 3 lines · On Tue, 02 May 2017 19:03:15 +0000 Marc-André Lureau…

Hi

On Tue, May 2, 2017 at 11:17 AM Igor Mammedov <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines

On Fri, 28 Apr 2017 14:28:38 +0000
Marc-André Lureau <[email protected]> wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Hi

On Fri, Apr 28, 2017 at 6:12 PM Ladi Prosek <[email protected]>

Quoted 4 lines · wrote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line · Marc-André Lureau

The VM coreinfo (vmcoreinfo) device is an emulated device

which

Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

exposes a 4k memory range to the guest to store various

informations

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

useful to debug the guest OS. (it is greatly inspired by the

VMGENID

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

device implementation)

This is an early-boot alternative to the qemu-ga VMDUMP_INFO

event

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

proposed in "[PATCH 00/21] WIP: dump: add kaslr support".

If deemed more appropriate, we can consider writing to fw_cfg

directly

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

instead of guest memory, now that qemu 2.9 supports it again.

The proof-of-concept kernel module:

Quoted 7 lines
Quoted 7 lines

https://github.com/elmarco/vmgenid-test/blob/master/qemuvmci-test.c

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines

Here's a proof-of-concept Windows driver:

https://github.com/ladipro/kvm-guest-drivers-windows/tree/vmcoreinfo/vmcoreinfo

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I just wanted to be sure that it's possible to evaluate the

ADDR

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

method in Windows.

From a practical point of view it is unfortunate that this

would

Quoted 2 lines
Quoted 2 lines

be a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

completely new device. For Windows guests it means another

driver

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

binary and all the overhead associated with deploying it on

VMs.

Quoted 2 lines
Quoted 2 lines

Would

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

it be too crazy to add this functionality to the pvpanic

device?

Quoted 8 lines
Quoted 8 lines

The

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

mechanics could stay the same but it would be done under the

existing

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

ACPI\QEMU0001 device.

pvpanic is under _SB.PCI0.ISA, that could be problematic

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

and _STA is a name field.

Someone with more experience with ACPI could tell us if that make

sense

Quoted 4 lines
Quoted 4 lines

to

Quoted 3 lines

merge both and how.

Can't you handle 2 ACPI devices in the same windows driver

instead?

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

we use QEMU0001 to reserve IO ports for pvpanic device, ASL wise there shouldn't problems with adding _ADDR method to it

but then we probably should fold vmcoreinfo into pvpanic device as well (QEMU and linux driver)

Quoted 7 lines
Quoted 1 line

pvpanic is x86-only afaict.

There is nothing that forces it to be x86 specific (beside being ISA device),
ARM also can benefit from/use pvpanic if you make it pci device or just plain
Device.

Quoted 6 lines

Could someone advise on a recommended solution here?

Should we make a PCI variant of pvpanic and add the proposed vmcoreinfo ACPI/mem to it ?

Tbh, I think I prefer to have seperate devices since they work

Quoted 10 lines

differently

Quoted 1 line

and vmcoreinfo doesn't require any bus device.

Considering pvpanic and vmcore are closely related, I'd prefer it being one device. But I won't insist on it.

Also instead of PCI device, I'd use plain Device as vmgenid does, that would leave open question how to make legacy ISA based pvpanic on top of it in case both are merged.

Quoted 4 lines

Can we instead try to fit pvpanic functionality in the proposed vmcoreinfo device? This could be done in a future revision of the device. This way we don't have to deal with legacy ISA, and can make pvpanic functionality more portable.

it would complicate host/guest side, as there will be 2 drivers per OS and later device will have to support capability negotiation/reporting to enable pvpanic functionality in vmcoreinfo + corresponding changes in guest driver. That might lead to a bigger maintenance burden than if vmcoreinfo were integrated with pvpanic from the very beginning.

Quoted 8 lines

Tbh, I have no idea how to do the merging of the legacy ISA pvpanic with vmcoreinfo without breaking things, nor do I have the motivation to do so.

More comments welcome (I would like to resend the patch as non-rfc this time, I hope we can make it in 2.10)

Thanks