qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 1af000: dump: Replace opaque DumpState pointe


From: Paolo Bonzini
Subject: [Qemu-commits] [qemu/qemu] 1af000: dump: Replace opaque DumpState pointer with a type...
Date: Tue, 11 Oct 2022 06:31:54 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 1af0006ab959864dfa2f59e9136c5fb93000b61f
      
https://github.com/qemu/qemu/commit/1af0006ab959864dfa2f59e9136c5fb93000b61f
  Author: Janosch Frank <frankja@linux.ibm.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M include/hw/core/sysemu-cpu-ops.h
    M include/qemu/typedefs.h
    M target/arm/arch_dump.c
    M target/arm/cpu.h
    M target/i386/arch_dump.c
    M target/i386/cpu.h
    M target/ppc/arch_dump.c
    M target/ppc/cpu.h
    M target/riscv/arch_dump.c
    M target/riscv/cpu.h
    M target/s390x/arch_dump.c
    M target/s390x/s390x-internal.h

  Log Message:
  -----------
  dump: Replace opaque DumpState pointer with a typed one

It's always better to convey the type of a pointer if at all
possible. So let's add the DumpState typedef to typedefs.h and move
the dump note functions from the opaque pointers to DumpState
pointers.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
CC: Peter Maydell <peter.maydell@linaro.org>
CC: Cédric Le Goater <clg@kaod.org>
CC: Daniel Henrique Barboza <danielhb413@gmail.com>
CC: David Gibson <david@gibson.dropbear.id.au>
CC: Greg Kurz <groug@kaod.org>
CC: Palmer Dabbelt <palmer@dabbelt.com>
CC: Alistair Francis <alistair.francis@wdc.com>
CC: Bin Meng <bin.meng@windriver.com>
CC: Cornelia Huck <cohuck@redhat.com>
CC: Thomas Huth <thuth@redhat.com>
CC: Richard Henderson <richard.henderson@linaro.org>
CC: David Hildenbrand <david@redhat.com>
Acked-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220811121111.9878-2-frankja@linux.ibm.com>


  Commit: afae6056ea79e2d89fd90867de3a01732eae724f
      
https://github.com/qemu/qemu/commit/afae6056ea79e2d89fd90867de3a01732eae724f
  Author: Janosch Frank <frankja@linux.ibm.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c

  Log Message:
  -----------
  dump: Rename write_elf_loads to write_elf_phdr_loads

Let's make it a bit clearer that we write the program headers of the
PT_LOAD type.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@ibm.linux.com>
Message-Id: <20220811121111.9878-3-frankja@linux.ibm.com>


  Commit: 1e8113032f5b1efc5da66382470ce4809c76f8f2
      
https://github.com/qemu/qemu/commit/1e8113032f5b1efc5da66382470ce4809c76f8f2
  Author: Janosch Frank <frankja@linux.ibm.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c

  Log Message:
  -----------
  dump: Refactor dump_iterate and introduce dump_filter_memblock_*()

The iteration over the memblocks in dump_iterate() is hard to
understand so it's about time to clean it up. Instead of manually
grabbing the next memblock we can use QTAILQ_FOREACH to iterate over
all memblocks.

Additionally we move the calculation of the offset and length out by
introducing and using the dump_filter_memblock_*() functions. These
functions will later be used to cleanup other parts of dump.c.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220811121111.9878-4-frankja@linux.ibm.com>


  Commit: 0c2994ac9009577b967529ce18e269da5b280351
      
https://github.com/qemu/qemu/commit/0c2994ac9009577b967529ce18e269da5b280351
  Author: Janosch Frank <frankja@linux.ibm.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c
    M include/sysemu/dump.h

  Log Message:
  -----------
  dump: Rework get_start_block

get_start_block() returns the start address of the first memory block
or -1.

With the GuestPhysBlock iterator conversion we don't need to set the
start address and can therefore remove that code and the "start"
DumpState struct member. The only functionality left is the validation
of the start block so it only makes sense to re-name the function to
validate_start_block()

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Message-Id: <20220811121111.9878-5-frankja@linux.ibm.com>


  Commit: dddf725f70bfe7f5adb41fa31dbd06e767271bda
      
https://github.com/qemu/qemu/commit/dddf725f70bfe7f5adb41fa31dbd06e767271bda
  Author: Janosch Frank <frankja@linux.ibm.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c
    M include/sysemu/dump.h

  Log Message:
  -----------
  dump: Rework filter area variables

While the DumpState begin and length variables directly mirror the API
variable names they are not very descriptive. So let's add a
"filter_area_" prefix and make has_filter a function checking length > 0.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220811121111.9878-6-frankja@linux.ibm.com>


  Commit: c370d5300f9ac1f90f8158082d22262b904fe30e
      
https://github.com/qemu/qemu/commit/c370d5300f9ac1f90f8158082d22262b904fe30e
  Author: Janosch Frank <frankja@linux.ibm.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c

  Log Message:
  -----------
  dump: Rework dump_calculate_size function

dump_calculate_size() sums up all the sizes of the guest memory
blocks. Since we already have a function that calculates the size of a
single memory block (dump_get_memblock_size()) we can simply iterate
over the blocks and use the function instead of calculating the size
ourselves.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Message-Id: <20220811121111.9878-7-frankja@linux.ibm.com>


  Commit: 670e76998a61ca171200fcded3865b294a2d1243
      
https://github.com/qemu/qemu/commit/670e76998a61ca171200fcded3865b294a2d1243
  Author: Janosch Frank <frankja@linux.ibm.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c

  Log Message:
  -----------
  dump: Split elf header functions into prepare and write

Let's split the write from the modification of the elf header so we
can consolidate the write of the data in one function.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220811121111.9878-8-frankja@linux.ibm.com>


  Commit: 2341a94d3a0a8a93a5a977e642da1807b8edaab8
      
https://github.com/qemu/qemu/commit/2341a94d3a0a8a93a5a977e642da1807b8edaab8
  Author: Janosch Frank <frankja@linux.ibm.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c

  Log Message:
  -----------
  dump: Rename write_elf*_phdr_note to prepare_elf*_phdr_note

The functions in question do not actually write to the file descriptor
they set up a buffer which is later written to the fd.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220811121111.9878-9-frankja@linux.ibm.com>


  Commit: 08df343874fcddd260021a04ce3c5a34f2c48164
      
https://github.com/qemu/qemu/commit/08df343874fcddd260021a04ce3c5a34f2c48164
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c

  Log Message:
  -----------
  dump: simplify a bit kdump get_next_page()

This should be functionally equivalent, but slightly easier to read,
with simplified paths and checks at the end of the function.

The following patch is a major rewrite to get rid of the assert().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>


  Commit: 94d788408d2d5a6474c99b2c9cf06913b9db7c58
      
https://github.com/qemu/qemu/commit/94d788408d2d5a6474c99b2c9cf06913b9db7c58
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M dump/dump.c

  Log Message:
  -----------
  dump: fix kdump to work over non-aligned blocks

Rewrite get_next_page() to work over non-aligned blocks. When it
encounters non aligned addresses, it will try to fill a page provided by
the caller.

This solves a kdump crash with "tpm-crb-cmd" RAM memory region,
qemu-kvm: ../dump/dump.c:1162: _Bool get_next_page(GuestPhysBlock **,
uint64_t *, uint8_t **, DumpState *): Assertion `(block->target_start &
~target_page_mask) == 0' failed.

because:
guest_phys_block_add_section: target_start=00000000fed40080 
target_end=00000000fed41000: added (count: 4)

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=2120480

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>


  Commit: 42e1e350bffc8d4614e568a03380b2ec34a131bf
      
https://github.com/qemu/qemu/commit/42e1e350bffc8d4614e568a03380b2ec34a131bf
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2022-10-11 (Tue, 11 Oct 2022)

  Changed paths:
    M dump/dump.c
    M include/hw/core/sysemu-cpu-ops.h
    M include/qemu/typedefs.h
    M include/sysemu/dump.h
    M target/arm/arch_dump.c
    M target/arm/cpu.h
    M target/i386/arch_dump.c
    M target/i386/cpu.h
    M target/ppc/arch_dump.c
    M target/ppc/cpu.h
    M target/riscv/arch_dump.c
    M target/riscv/cpu.h
    M target/s390x/arch_dump.c
    M target/s390x/s390x-internal.h

  Log Message:
  -----------
  Merge tag 'dump-pull-request' of https://gitlab.com/marcandre.lureau/qemu 
into staging

dump patches

Hi

Includes:
- the first patches from "[PATCH v5 00/18] dump: Add arch section and s390x PV 
dump"
- "[PATCH v2 0/2] Fix dumping in kdump format with non-aligned memory"

# -----BEGIN PGP SIGNATURE-----
#
# iQJQBAABCAA6FiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmM+9UocHG1hcmNhbmRy
# ZS5sdXJlYXVAcmVkaGF0LmNvbQAKCRDa6OEJdZac5aoMD/0eya5IqxX0ke9jjUcB
# wWhRbsVdiO9yt2oN3gsQVkUtuK98p7/JpWSKHWXsQQjd7vIYPCj8RBHXZ4Cp71+S
# n+Db/K22fmWvuP0LtCNzYujq1ZxKdQI8KdKmYwHQdGkgy85QwYO+0SgpVgLjRd/2
# 1IWzHuzIcEmraxkSLvR8N0lmz/Z2CBc7ME5izO1mHSZrs8Ria2tDpXnz5rFxPy+q
# TDqo+LP0GIapoHbbE+6JWGL2u9mLiP0sg9SclZOPZG3CsPQ5XYEStyZcLw1YYIO1
# rruom463SbP4NJHIRspC8pADFI+d4uBamj/eUu8/9CUVqetk0UpKyXWiqgEDvmkO
# /2/yFYS60gEghvd3XVnuZnTNeRSDSE1aUXUmKdGqDjYL4DYcsehIQ9z8ut/tuYIO
# D+4RuiuCmEyznV/DDecnwHhrv9jWftNwdwjW5GAniEjDBp/DtoouAeMArQw9rE1Z
# mXqTa5NaeW69VTtzxzN25GzSAjiEzFT7UFRt3bT8fb0NX+UOkluD/agBqRIM5lzh
# KbUJjqWhqA6TnHtDekbNLlmocDCn+NeBeXxDUIa19C4LICCuuxbFU+MG7cvdjSEg
# sXRB6/qAdWgv4O3zGw1SHff+qmvtHjKVj0ihrNkrrYrL+31O2splqTMeaCqGdq9C
# elE/TAS46CcMUSYuWzxy6mAMmA==
# =O9tr
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 06 Oct 2022 11:33:30 EDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg:                issuer "marcandre.lureau@redhat.com"
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" 
[full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" 
[full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'dump-pull-request' of https://gitlab.com/marcandre.lureau/qemu:
  dump: fix kdump to work over non-aligned blocks
  dump: simplify a bit kdump get_next_page()
  dump: Rename write_elf*_phdr_note to prepare_elf*_phdr_note
  dump: Split elf header functions into prepare and write
  dump: Rework dump_calculate_size function
  dump: Rework filter area variables
  dump: Rework get_start_block
  dump: Refactor dump_iterate and introduce dump_filter_memblock_*()
  dump: Rename write_elf_loads to write_elf_phdr_loads
  dump: Replace opaque DumpState pointer with a typed one

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


Compare: https://github.com/qemu/qemu/compare/f1d33f55c47d...42e1e350bffc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]