[Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3

Paolo Bonzini posted 15 patches 7 years, 2 months ago
Test asan passed
Test checkpatch passed
Test docker-quick@centos7 passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1543329397-48407-1-git-send-email-pbonzini@redhat.com
MAINTAINERS                 |  18 +++++++
backends/hostmem-file.c     |  24 ++++-----
backends/hostmem-memfd.c    |   8 ++-
configure                   |   2 +-
cpus.c                      |  12 +++--
hw/display/virtio-gpu.c     |   4 +-
hw/intc/s390_flic_kvm.c     |   4 +-
hw/nvram/eeprom93xx.c       |   6 +--
hw/nvram/fw_cfg.c           |   6 +--
hw/pci/msix.c               |   4 +-
hw/pci/pci.c                |   8 +--
hw/pci/shpc.c               |   7 +--
hw/scsi/lsi53c895a.c        |  48 +++++++++++++-----
hw/scsi/scsi-bus.c          |   4 +-
hw/timer/twl92230.c         |   4 +-
hw/usb/redirect.c           |  12 ++---
hw/virtio/virtio.c          |   8 +--
include/migration/vmstate.h |   6 +--
migration/savevm.c          |  11 ++--
migration/vmstate-types.c   | 119 ++++++++++++++++++++++++--------------------
migration/vmstate.c         |  31 ++++++------
qemu-options.hx             |   4 +-
scripts/checkpatch.pl       |   3 +-
target/alpha/machine.c      |   5 +-
target/arm/machine.c        |  12 ++---
target/hppa/machine.c       |  10 ++--
target/i386/kvm.c           |  15 ++++--
target/i386/translate.c     |  35 +++++++------
target/mips/machine.c       |  14 +++---
target/openrisc/machine.c   |   5 +-
target/ppc/machine.c        |  14 +++---
target/sparc/machine.c      |   7 +--
tests/vhost-user-bridge.c   |   2 +-
vl.c                        |   9 ++--
34 files changed, 286 insertions(+), 195 deletions(-)
[Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3
Posted by Paolo Bonzini 7 years, 2 months ago
The following changes since commit 4822f1ee9efa8df56e29db0a68323b484bdb0335:

  Merge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181127-pull-request' into staging (2018-11-27 11:21:38 +0000)

are available in the git repository at:


  git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to cb16c8466b6c62868aba47cd95fadcf316541f40:

  hostmem: no need to check for host_memory_backend_mr_inited() in alloc() (2018-11-27 15:35:19 +0100)

----------------------------------------------------------------
* lsi HBA reselection fix (George)
* Small cleanups (Li Qiang)
* bugfixes for vhost-user-bridge and hostmem (Marc-André)
* single-thread TCG fix (me)
* VMX migration blocker (me)
* target/i386 fix for LOCK (Richard)
* fix elf2dmp check (Roman)
* MAINTAINERS update (Philippe, Thomas)

----------------------------------------------------------------
George Kennedy (1):
      lsi: Reselection needed to remove pending commands from queue

Li Qiang (2):
      vl: Improve error message when we can't load fw_cfg from file
      vl.c: remove outdated comment

Marc-André Lureau (4):
      vmstate: constify VMStateField
      vhost-user-bridge: fix recvmsg iovlen
      hostmem-memfd: honour share=on/off property
      hostmem: no need to check for host_memory_backend_mr_inited() in alloc()

Paolo Bonzini (4):
      target/i386: kvm: add VMX migration blocker
      cpus: run work items for all vCPUs if single-threaded
      migration: savevm: consult migration blockers
      checkpatch: g_test_message does not need a trailing newline

Philippe Mathieu-Daudé (1):
      MAINTAINERS: Add an entry for the Firmware Configuration (fw_cfg) device

Richard Henderson (1):
      target/i386: Generate #UD when applying LOCK to a register destination

Roman Kagan (1):
      configure: fix elf2dmp check

Thomas Huth (1):
      MAINTAINERS: Add some missing entries related to accelerators

 MAINTAINERS                 |  18 +++++++
 backends/hostmem-file.c     |  24 ++++-----
 backends/hostmem-memfd.c    |   8 ++-
 configure                   |   2 +-
 cpus.c                      |  12 +++--
 hw/display/virtio-gpu.c     |   4 +-
 hw/intc/s390_flic_kvm.c     |   4 +-
 hw/nvram/eeprom93xx.c       |   6 +--
 hw/nvram/fw_cfg.c           |   6 +--
 hw/pci/msix.c               |   4 +-
 hw/pci/pci.c                |   8 +--
 hw/pci/shpc.c               |   7 +--
 hw/scsi/lsi53c895a.c        |  48 +++++++++++++-----
 hw/scsi/scsi-bus.c          |   4 +-
 hw/timer/twl92230.c         |   4 +-
 hw/usb/redirect.c           |  12 ++---
 hw/virtio/virtio.c          |   8 +--
 include/migration/vmstate.h |   6 +--
 migration/savevm.c          |  11 ++--
 migration/vmstate-types.c   | 119 ++++++++++++++++++++++++--------------------
 migration/vmstate.c         |  31 ++++++------
 qemu-options.hx             |   4 +-
 scripts/checkpatch.pl       |   3 +-
 target/alpha/machine.c      |   5 +-
 target/arm/machine.c        |  12 ++---
 target/hppa/machine.c       |  10 ++--
 target/i386/kvm.c           |  15 ++++--
 target/i386/translate.c     |  35 +++++++------
 target/mips/machine.c       |  14 +++---
 target/openrisc/machine.c   |   5 +-
 target/ppc/machine.c        |  14 +++---
 target/sparc/machine.c      |   7 +--
 tests/vhost-user-bridge.c   |   2 +-
 vl.c                        |   9 ++--
 34 files changed, 286 insertions(+), 195 deletions(-)
-- 
1.8.3.1


Re: [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3
Posted by Peter Maydell 7 years, 2 months ago
On Tue, 27 Nov 2018 at 14:38, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit 4822f1ee9efa8df56e29db0a68323b484bdb0335:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181127-pull-request' into staging (2018-11-27 11:21:38 +0000)
>
> are available in the git repository at:
>
>
>   git://github.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to cb16c8466b6c62868aba47cd95fadcf316541f40:
>
>   hostmem: no need to check for host_memory_backend_mr_inited() in alloc() (2018-11-27 15:35:19 +0100)
>
> ----------------------------------------------------------------
> * lsi HBA reselection fix (George)
> * Small cleanups (Li Qiang)
> * bugfixes for vhost-user-bridge and hostmem (Marc-André)
> * single-thread TCG fix (me)
> * VMX migration blocker (me)
> * target/i386 fix for LOCK (Richard)
> * fix elf2dmp check (Roman)
> * MAINTAINERS update (Philippe, Thomas)
>
> ----------------------------------------------------------------

Hi; I'm afraid this has compile problems on 32-bit hosts and
on the various BSDs.

Format string issues, 32-bit hosts:

/home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'get_kdbg':
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:90:52: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka
long long unsigned int}' [-Werror=format=]
         if (!SYM_RESOLVE(KernBase, pdb, KiWaitNever) ||
                                                    ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
definition of macro 'SYM_RESOLVE'
     s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
                 ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:91:57: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka
long long unsigned int}' [-Werror=format=]
                 !SYM_RESOLVE(KernBase, pdb, KiWaitAlways) ||
                                                         ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
definition of macro 'SYM_RESOLVE'
     s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
                 ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:92:64: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka
long long unsigned int}' [-Werror=format=]
                 !SYM_RESOLVE(KernBase, pdb, KdpDataBlockEncoded)) {
                                                                ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
definition of macro 'SYM_RESOLVE'
     s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
                 ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:101:16: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka
 long long unsigned int}' [-Werror=format=]
         printf("[KiWaitNever] = 0x%016lx\n", kwn);
                ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:102:16: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka
 long long unsigned int}' [-Werror=format=]
         printf("[KiWaitAlways] = 0x%016lx\n", kwa);
                ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'fix_dtb':
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:205:20: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka
 long long unsigned int}' [-Werror=format=]
             printf("DTB 0x%016lx has been found from CPU #%zu"
                    ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:225:16: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka
 long long unsigned int}' [-Werror=format=]
         printf("DirectoryTableBase = 0x%016lx has been found from CPU #0"
                ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'main':
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:491:12: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
     printf("CPU #0 CR3 is 0x%016lx\n", state->cr[3]);
            ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:500:12: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
     printf("CPU #0 IDT is at 0x%016lx\n", state->idt.base);
            ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:508:12: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
     printf("CPU #0 IDT[0] -> 0x%016lx\n", idt_desc_addr(first_idt_desc));
            ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:511:12: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
     printf("Searching kernel downwards from 0x%16lx...\n", KernBase);
            ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:524:12: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
     printf("KernBase = 0x%16lx, signature is \'%.2s\'\n", KernBase,
            ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:548:57: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
     if (!SYM_RESOLVE(KernBase, &pdb, KdDebuggerDataBlock) ||
                                                         ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
definition of macro 'SYM_RESOLVE'
     s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
                 ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:549:56: error: format
'%lx' expects argument of type 'long unsigned int', but argument 2 has
type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
             !SYM_RESOLVE(KernBase, &pdb, KdVersionBlock)) {
                                                        ^
/home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
definition of macro 'SYM_RESOLVE'
     s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
                 ^
/home/peter.maydell/qemu/contrib/elf2dmp/pdb.c: In function
'pdb_find_public_v3_symbol':
/home/peter.maydell/qemu/contrib/elf2dmp/pdb.c:69:20: error: format
'%lx' expects argument of type 'long unsigned int', but argument 7 has
type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
             printf("%s: 0x%016x(%d:\'%.8s\') + 0x%08x = 0x%09lx\n", name,
                    ^


Compile failure, FreeBSD:

backends/hostmem-file.c:61:5: error: use of undeclared identifier 'path'
    path = object_get_canonical_path(OBJECT(backend));
    ^
backends/hostmem-file.c:63:38: error: use of undeclared identifier 'path'
                                     path,
                                     ^
backends/hostmem-file.c:68:12: error: use of undeclared identifier 'path'
    g_free(path);
           ^

(The variable declaration is in #ifdef CONFIG_LINUX, but the use is
guarded by CONFIG_POSIX.)


Compile failure, OpenBSD and OSX:
In file included from contrib/elf2dmp/addrspace.h:11:0,
                 from contrib/elf2dmp/main.c:10:
contrib/elf2dmp/qemu_elf.h:12:17: fatal error: elf.h: No such file or directory
 #include <elf.h>
                 ^

and a format-descriptor issue not in the 32-bit host lot above:
contrib/elf2dmp/pdb.c: In function 'pdb_find_public_v3_symbol':
contrib/elf2dmp/pdb.c:71:21: warning: format '%lx' expects argument of
type 'long unsigned int', but argument 7 has type 'uint64_t'
[-Wformat=]
                     ((char *)segment - 8), sym->public_v3.offset, rva);
                     ^


thanks
-- PMM

Re: [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3
Posted by Laurent Vivier 7 years, 2 months ago
On 27/11/2018 16:43, Peter Maydell wrote:
> On Tue, 27 Nov 2018 at 14:38, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> The following changes since commit 4822f1ee9efa8df56e29db0a68323b484bdb0335:
>>
>>   Merge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181127-pull-request' into staging (2018-11-27 11:21:38 +0000)
>>
>> are available in the git repository at:
>>
>>
>>   git://github.com/bonzini/qemu.git tags/for-upstream
>>
>> for you to fetch changes up to cb16c8466b6c62868aba47cd95fadcf316541f40:
>>
>>   hostmem: no need to check for host_memory_backend_mr_inited() in alloc() (2018-11-27 15:35:19 +0100)
>>
>> ----------------------------------------------------------------
>> * lsi HBA reselection fix (George)
>> * Small cleanups (Li Qiang)
>> * bugfixes for vhost-user-bridge and hostmem (Marc-André)
>> * single-thread TCG fix (me)
>> * VMX migration blocker (me)
>> * target/i386 fix for LOCK (Richard)
>> * fix elf2dmp check (Roman)
>> * MAINTAINERS update (Philippe, Thomas)
>>
>> ----------------------------------------------------------------
> 
> Hi; I'm afraid this has compile problems on 32-bit hosts and
> on the various BSDs.
> 
> Format string issues, 32-bit hosts:
> 
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'get_kdbg':
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:90:52: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka
> long long unsigned int}' [-Werror=format=]
>          if (!SYM_RESOLVE(KernBase, pdb, KiWaitNever) ||
>                                                     ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
> definition of macro 'SYM_RESOLVE'
>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>                  ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:91:57: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka
> long long unsigned int}' [-Werror=format=]
>                  !SYM_RESOLVE(KernBase, pdb, KiWaitAlways) ||
>                                                          ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
> definition of macro 'SYM_RESOLVE'
>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>                  ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:92:64: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka
> long long unsigned int}' [-Werror=format=]
>                  !SYM_RESOLVE(KernBase, pdb, KdpDataBlockEncoded)) {
>                                                                 ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
> definition of macro 'SYM_RESOLVE'
>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>                  ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:101:16: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka
>  long long unsigned int}' [-Werror=format=]
>          printf("[KiWaitNever] = 0x%016lx\n", kwn);
>                 ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:102:16: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka
>  long long unsigned int}' [-Werror=format=]
>          printf("[KiWaitAlways] = 0x%016lx\n", kwa);
>                 ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'fix_dtb':
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:205:20: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka
>  long long unsigned int}' [-Werror=format=]
>              printf("DTB 0x%016lx has been found from CPU #%zu"
>                     ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:225:16: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka
>  long long unsigned int}' [-Werror=format=]
>          printf("DirectoryTableBase = 0x%016lx has been found from CPU #0"
>                 ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'main':
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:491:12: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>      printf("CPU #0 CR3 is 0x%016lx\n", state->cr[3]);
>             ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:500:12: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>      printf("CPU #0 IDT is at 0x%016lx\n", state->idt.base);
>             ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:508:12: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>      printf("CPU #0 IDT[0] -> 0x%016lx\n", idt_desc_addr(first_idt_desc));
>             ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:511:12: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>      printf("Searching kernel downwards from 0x%16lx...\n", KernBase);
>             ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:524:12: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>      printf("KernBase = 0x%16lx, signature is \'%.2s\'\n", KernBase,
>             ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:548:57: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>      if (!SYM_RESOLVE(KernBase, &pdb, KdDebuggerDataBlock) ||
>                                                          ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
> definition of macro 'SYM_RESOLVE'
>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>                  ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:549:56: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 2 has
> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>              !SYM_RESOLVE(KernBase, &pdb, KdVersionBlock)) {
>                                                         ^
> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
> definition of macro 'SYM_RESOLVE'
>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>                  ^
> /home/peter.maydell/qemu/contrib/elf2dmp/pdb.c: In function
> 'pdb_find_public_v3_symbol':
> /home/peter.maydell/qemu/contrib/elf2dmp/pdb.c:69:20: error: format
> '%lx' expects argument of type 'long unsigned int', but argument 7 has
> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>              printf("%s: 0x%016x(%d:\'%.8s\') + 0x%08x = 0x%09lx\n", name,
>                     ^
> 
> 
> Compile failure, FreeBSD:
> 
> backends/hostmem-file.c:61:5: error: use of undeclared identifier 'path'
>     path = object_get_canonical_path(OBJECT(backend));
>     ^
> backends/hostmem-file.c:63:38: error: use of undeclared identifier 'path'
>                                      path,
>                                      ^
> backends/hostmem-file.c:68:12: error: use of undeclared identifier 'path'
>     g_free(path);
>            ^
> 
> (The variable declaration is in #ifdef CONFIG_LINUX, but the use is
> guarded by CONFIG_POSIX.)
> 
> 
> Compile failure, OpenBSD and OSX:
> In file included from contrib/elf2dmp/addrspace.h:11:0,
>                  from contrib/elf2dmp/main.c:10:
> contrib/elf2dmp/qemu_elf.h:12:17: fatal error: elf.h: No such file or directory
>  #include <elf.h>
>                  ^
> 
> and a format-descriptor issue not in the 32-bit host lot above:
> contrib/elf2dmp/pdb.c: In function 'pdb_find_public_v3_symbol':
> contrib/elf2dmp/pdb.c:71:21: warning: format '%lx' expects argument of
> type 'long unsigned int', but argument 7 has type 'uint64_t'
> [-Wformat=]
>                      ((char *)segment - 8), sym->public_v3.offset, rva);

I think PATCH 15/15 should be "$mingw32" = "yes" as the intend of the tool 
is to convert ELF dump to Windows MEMORY.DMP:

commit 3fa2d384c245bcee3a9ecfa11f298b76ea4c9d57
Author: Viktor Prutyanov <viktor.prutyanov@virtuozzo.com>
Date:   Wed Aug 29 15:41:25 2018 +0300

    contrib: add elf2dmp tool
    
    elf2dmp is a converter from ELF dump (produced by 'dump-guest-memory') to
    Windows MEMORY.DMP format (also know as 'Complete Memory Dump') which can be
    opened in WinDbg.
    
    This tool can help if VMCoreInfo device/driver is absent in Windows VM and
    'dump-guest-memory -w' is not available but dump can be created in ELF format.
    
    The tool works as follows:
    1. Determine the system paging root looking at GS_BASE or KERNEL_GS_BASE
    to locate the PRCB structure and finds the kernel CR3 nearby if QEMU CPU
    state CR3 is not suitable.
    2. Find an address within the kernel image by dereferencing the first
    IDT entry and scans virtual memory upwards until the start of the
    kernel.
    3. Download a PDB matching the kernel from the Microsoft symbol store,
    and figure out the layout of certain relevant structures necessary for
    the dump.
    4. Populate the corresponding structures in the memory image and create
    the appropriate dump header.



Re: [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3
Posted by Paolo Bonzini 7 years, 2 months ago
On 27/11/18 16:47, Laurent Vivier wrote:
> On 27/11/2018 16:43, Peter Maydell wrote:
>> On Tue, 27 Nov 2018 at 14:38, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>
>>> The following changes since commit 4822f1ee9efa8df56e29db0a68323b484bdb0335:
>>>
>>>   Merge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181127-pull-request' into staging (2018-11-27 11:21:38 +0000)
>>>
>>> are available in the git repository at:
>>>
>>>
>>>   git://github.com/bonzini/qemu.git tags/for-upstream
>>>
>>> for you to fetch changes up to cb16c8466b6c62868aba47cd95fadcf316541f40:
>>>
>>>   hostmem: no need to check for host_memory_backend_mr_inited() in alloc() (2018-11-27 15:35:19 +0100)
>>>
>>> ----------------------------------------------------------------
>>> * lsi HBA reselection fix (George)
>>> * Small cleanups (Li Qiang)
>>> * bugfixes for vhost-user-bridge and hostmem (Marc-André)
>>> * single-thread TCG fix (me)
>>> * VMX migration blocker (me)
>>> * target/i386 fix for LOCK (Richard)
>>> * fix elf2dmp check (Roman)
>>> * MAINTAINERS update (Philippe, Thomas)
>>>
>>> ----------------------------------------------------------------
>>
>> Hi; I'm afraid this has compile problems on 32-bit hosts and
>> on the various BSDs.
>>
>> Format string issues, 32-bit hosts:
>>
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'get_kdbg':
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:90:52: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>>          if (!SYM_RESOLVE(KernBase, pdb, KiWaitNever) ||
>>                                                     ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>>                  ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:91:57: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>>                  !SYM_RESOLVE(KernBase, pdb, KiWaitAlways) ||
>>                                                          ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>>                  ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:92:64: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>> long long unsigned int}' [-Werror=format=]
>>                  !SYM_RESOLVE(KernBase, pdb, KdpDataBlockEncoded)) {
>>                                                                 ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>>                  ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:101:16: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>>  long long unsigned int}' [-Werror=format=]
>>          printf("[KiWaitNever] = 0x%016lx\n", kwn);
>>                 ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:102:16: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>>  long long unsigned int}' [-Werror=format=]
>>          printf("[KiWaitAlways] = 0x%016lx\n", kwa);
>>                 ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'fix_dtb':
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:205:20: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>>  long long unsigned int}' [-Werror=format=]
>>              printf("DTB 0x%016lx has been found from CPU #%zu"
>>                     ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:225:16: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka
>>  long long unsigned int}' [-Werror=format=]
>>          printf("DirectoryTableBase = 0x%016lx has been found from CPU #0"
>>                 ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c: In function 'main':
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:491:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>>      printf("CPU #0 CR3 is 0x%016lx\n", state->cr[3]);
>>             ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:500:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>>      printf("CPU #0 IDT is at 0x%016lx\n", state->idt.base);
>>             ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:508:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>>      printf("CPU #0 IDT[0] -> 0x%016lx\n", idt_desc_addr(first_idt_desc));
>>             ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:511:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>>      printf("Searching kernel downwards from 0x%16lx...\n", KernBase);
>>             ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:524:12: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>>      printf("KernBase = 0x%16lx, signature is \'%.2s\'\n", KernBase,
>>             ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:548:57: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>>      if (!SYM_RESOLVE(KernBase, &pdb, KdDebuggerDataBlock) ||
>>                                                          ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>>                  ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:549:56: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 2 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>>              !SYM_RESOLVE(KernBase, &pdb, KdVersionBlock)) {
>>                                                         ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/main.c:44:17: note: in
>> definition of macro 'SYM_RESOLVE'
>>      s ? printf(#s" = 0x%016lx\n", s) : eprintf("Failed to resolve "#s"\n"), s)
>>                  ^
>> /home/peter.maydell/qemu/contrib/elf2dmp/pdb.c: In function
>> 'pdb_find_public_v3_symbol':
>> /home/peter.maydell/qemu/contrib/elf2dmp/pdb.c:69:20: error: format
>> '%lx' expects argument of type 'long unsigned int', but argument 7 has
>> type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
>>              printf("%s: 0x%016x(%d:\'%.8s\') + 0x%08x = 0x%09lx\n", name,
>>                     ^
>>
>>
>> Compile failure, FreeBSD:
>>
>> backends/hostmem-file.c:61:5: error: use of undeclared identifier 'path'
>>     path = object_get_canonical_path(OBJECT(backend));
>>     ^
>> backends/hostmem-file.c:63:38: error: use of undeclared identifier 'path'
>>                                      path,
>>                                      ^
>> backends/hostmem-file.c:68:12: error: use of undeclared identifier 'path'
>>     g_free(path);
>>            ^
>>
>> (The variable declaration is in #ifdef CONFIG_LINUX, but the use is
>> guarded by CONFIG_POSIX.)
>>
>>
>> Compile failure, OpenBSD and OSX:
>> In file included from contrib/elf2dmp/addrspace.h:11:0,
>>                  from contrib/elf2dmp/main.c:10:
>> contrib/elf2dmp/qemu_elf.h:12:17: fatal error: elf.h: No such file or directory
>>  #include <elf.h>
>>                  ^
>>
>> and a format-descriptor issue not in the 32-bit host lot above:
>> contrib/elf2dmp/pdb.c: In function 'pdb_find_public_v3_symbol':
>> contrib/elf2dmp/pdb.c:71:21: warning: format '%lx' expects argument of
>> type 'long unsigned int', but argument 7 has type 'uint64_t'
>> [-Wformat=]
>>                      ((char *)segment - 8), sym->public_v3.offset, rva);
> 
> I think PATCH 15/15 should be "$mingw32" = "yes" as the intend of the tool 
> is to convert ELF dump to Windows MEMORY.DMP:

No, the tool can be run on POSIX systems, the ones where you get the ELF
dump, and produces a MEMORY.DMP that you can load in windbg, so
mingw32=no is correct; it simply hasn't been ported to Windows yet.

Anyway the fix can wait for 3.2, I'll just drop the patch.

Paolo

> commit 3fa2d384c245bcee3a9ecfa11f298b76ea4c9d57
> Author: Viktor Prutyanov <viktor.prutyanov@virtuozzo.com>
> Date:   Wed Aug 29 15:41:25 2018 +0300
> 
>     contrib: add elf2dmp tool
>     
>     elf2dmp is a converter from ELF dump (produced by 'dump-guest-memory') to
>     Windows MEMORY.DMP format (also know as 'Complete Memory Dump') which can be
>     opened in WinDbg.
>     
>     This tool can help if VMCoreInfo device/driver is absent in Windows VM and
>     'dump-guest-memory -w' is not available but dump can be created in ELF format.
>     
>     The tool works as follows:
>     1. Determine the system paging root looking at GS_BASE or KERNEL_GS_BASE
>     to locate the PRCB structure and finds the kernel CR3 nearby if QEMU CPU
>     state CR3 is not suitable.
>     2. Find an address within the kernel image by dereferencing the first
>     IDT entry and scans virtual memory upwards until the start of the
>     kernel.
>     3. Download a PDB matching the kernel from the Microsoft symbol store,
>     and figure out the layout of certain relevant structures necessary for
>     the dump.
>     4. Populate the corresponding structures in the memory image and create
>     the appropriate dump header.
> 
> 


Re: [Qemu-devel] [PULL v2 00/15] Misc patches for QEMU 3.1-rc3
Posted by Peter Maydell 7 years, 2 months ago
On Tue, 27 Nov 2018 at 14:38, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit 4822f1ee9efa8df56e29db0a68323b484bdb0335:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/fixes-31-20181127-pull-request' into staging (2018-11-27 11:21:38 +0000)
>
> are available in the git repository at:
>
>
>   git://github.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to cb16c8466b6c62868aba47cd95fadcf316541f40:
>
>   hostmem: no need to check for host_memory_backend_mr_inited() in alloc() (2018-11-27 15:35:19 +0100)
>
> ----------------------------------------------------------------
> * lsi HBA reselection fix (George)
> * Small cleanups (Li Qiang)
> * bugfixes for vhost-user-bridge and hostmem (Marc-André)
> * single-thread TCG fix (me)
> * VMX migration blocker (me)
> * target/i386 fix for LOCK (Richard)
> * fix elf2dmp check (Roman)
> * MAINTAINERS update (Philippe, Thomas)
>
> ----------------------------------------------------------------

I'll delay rc3 til tomorrow so we can get a v3 of this pullreq
in, in the hope of making rc3 our last before release...

thanks
-- PMM