qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] ae3f88: dump: fill in the flat header signatu


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] ae3f88: dump: fill in the flat header signature more pleas...
Date: Wed, 11 Jun 2014 14:30:06 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: ae3f88f60fb9f42bb3679311c2fbff8e1868ea47
      
https://github.com/qemu/qemu/commit/ae3f88f60fb9f42bb3679311c2fbff8e1868ea47
  Author: Laszlo Ersek <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M dump.c

  Log Message:
  -----------
  dump: fill in the flat header signature more pleasingly to the eye

The "mh.signature" array field has size 16, and is zeroed by the preceding
memset(). MAKEDUMPFILE_SIGNATURE expands to a string literal with string
length 12 (size 13). There's no need to measure the length of
MAKEDUMPFILE_SIGNATURE at runtime, nor for the extra zero-filling of
"mh.signature" with strncpy().

Use memcpy() with MIN(sizeof, sizeof) for robustness (which is an integer
constant expression, evaluable at compile time.)

Approximately-suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 92ba1401e0f81ea170803045c1ae366bf5d9d87e
      
https://github.com/qemu/qemu/commit/92ba1401e0f81ea170803045c1ae366bf5d9d87e
  Author: Laszlo Ersek <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M dump.c

  Log Message:
  -----------
  dump: simplify write_start_flat_header()

Currently, the function
- defines and populates an auto variable of type MakedumpfileHeader
- allocates and zeroes a buffer of size MAX_SIZE_MDF_HEADER (4096)
- copies the former into the latter (covering an initial portion of the
  latter)

Fill in the MakedumpfileHeader structure in its final place (the alignment
is OK because the structure lives at the address returned by g_malloc0()).

Approximately-suggested-by: Luiz Capitulino <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 22227f121bddb038a0335cf83a3c24f451e2e836
      
https://github.com/qemu/qemu/commit/22227f121bddb038a0335cf83a3c24f451e2e836
  Author: Laszlo Ersek <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

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

  Log Message:
  -----------
  dump: eliminate DumpState.page_shift ("guest's page shift")

Just use TARGET_PAGE_BITS.

"DumpState.page_shift" used to have type "uint32_t", while the replacement
TARGET_PAGE_BITS has type "int". Since "DumpState.page_shift" was only
used as bit shift counts in the paddr_to_pfn() and pfn_to_paddr() macros,
this is safe.

Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 2f859f80c2077e00237ea1dfae2523ebd8377f5f
      
https://github.com/qemu/qemu/commit/2f859f80c2077e00237ea1dfae2523ebd8377f5f
  Author: Laszlo Ersek <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M dump.c

  Log Message:
  -----------
  dump: eliminate DumpState.page_size ("guest's page size")

Use TARGET_PAGE_SIZE and ~TARGET_PAGE_MASK instead.

"DumpState.page_size" has type "size_t", whereas TARGET_PAGE_SIZE has type
"int". TARGET_PAGE_MASK is of type "int" and has negative value. The patch
affects the implicit type conversions as follows:

- create_header32() and create_header64(): assigned to "block_size", which
  has type "uint32_t". No change.

- get_next_page(): "block->target_start", "block->target_end" and "addr"
  have type "hwaddr" (uint64_t).

  Before the patch,
  - if "size_t" was "uint64_t", then no additional conversion was done as
    part of the usual arithmetic conversions,
  - If "size_t" was "uint32_t", then it was widened to uint64_t as part of
    the usual arithmetic conversions,
  for the remainder and addition operators.

  After the patch,
  - "~TARGET_PAGE_MASK" expands to  ~~((1 << TARGET_PAGE_BITS) - 1). It
    has type "int" and positive value (only least significant bits set).
    That's converted (widened) to "uint64_t" for the bit-ands. No visible
    change.
  - The same holds for the (addr + TARGET_PAGE_SIZE) addition.

- write_dump_pages():
  - TARGET_PAGE_SIZE passed as argument to a bunch of functions that all
    have prototypes. No change.

  - When incrementing "offset_data" (of type "off_t"): given that we never
    build for ILP32_OFF32 (see "-D_FILE_OFFSET_BITS=64" in configure),
    "off_t" is always "int64_t", and we only need to consider:
    - ILP32_OFFBIG: "size_t" is "uint32_t".
      - before: int64_t += uint32_t. Page size converted to int64_t for
  the addition.
      - after:  int64_t += int32_t. No change.
    - LP64_OFF64: "size_t" is "uint64_t".
      - before: int64_t += uint64_t. Offset converted to uint64_t for the
  addition, then the uint64_t result is converted to int64_t for
  storage.
      - after:  int64_t += int32_t. Same as the ILP32_OFFBIG/after case.
  No visible change.

  - (size_out < s->page_size) comparisons, and (size_out = s->page_size)
    assignment:
    - before: "size_out" is of type "size_t", no implicit conversion for
        either operator.
    - after: TARGET_PAGE_SIZE (of type "int" and positive value) is
       converted to "size_t" (for the relop because the latter is
       one of "uint32_t" and "uint64_t"). No visible change.

- dump_init():
  - DIV_ROUND_UP(DIV_ROUND_UP(s->max_mapnr, CHAR_BIT), s->page_size): The
    innermost "DumpState.max_mapnr" field has type uint64_t, which
    propagates through all implicit conversions at hand:

    #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))

    regardless of the page size macro argument's type. In the outer macro
    replacement, the page size is converted from uint32_t and int32_t
    alike to uint64_t.

  - (tmp * s->page_size) multiplication: "tmp" has size "uint64_t"; the
    RHS is converted to that type from uint32_t and int32_t just the same
    if it's not uint64_t to begin with.

Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 24aeeace7a9f264688e9eda77b6c04db607cbdfd
      
https://github.com/qemu/qemu/commit/24aeeace7a9f264688e9eda77b6c04db607cbdfd
  Author: Laszlo Ersek <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M dump.c

  Log Message:
  -----------
  dump: select header bitness based on ELF class, not ELF architecture

The specific ELF architecture (d_machine) carries Too Much Information
(TM) for deciding between create_header32() and create_header64(), use
"d_class" instead (ELFCLASS32 vs. ELFCLASS64).

This change adapts write_dump_header() to write_elf_loads(), dump_begin()
etc. that also rely on the ELF class of the target for bitness selection.

Considering the current targets that support dumping, cpu_get_dump_info()
works as follows:
- target-s390x/arch_dump.c: (EM_S390, ELFCLASS64) only
- target-ppc/arch_dump.c (EM_PPC64, ELFCLASS64) only
- target-i386/arch_dump.c: sets (EM_X86_64, ELFCLASS64) vs. (EM_386,
  ELFCLASS32) keying off the same Long Mode Active flag.

Hence no observable change.

Approximately-suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: c998acb03df614ddf2f3e206582586f191d07fff
      
https://github.com/qemu/qemu/commit/c998acb03df614ddf2f3e206582586f191d07fff
  Author: Laszlo Ersek <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M dump.c

  Log Message:
  -----------
  dump: hoist lzo_init() from get_len_buf_out() to dump_init()

qmp_dump_guest_memory()
  dump_init()
    lzo_init() <---------+
  create_kdump_vmcore()  |
    write_dump_pages()   |
      get_len_buf_out()  |
  lzo_init() ------+

This patch doesn't change the fact that lzo_init() is called for every
LZO-compressed dump, but it makes get_len_buf_out() more focused (single
responsibility).

Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: b87ef3518b2eeb9a57ee0d06d7e82a07ab5e4ffd
      
https://github.com/qemu/qemu/commit/b87ef3518b2eeb9a57ee0d06d7e82a07ab5e4ffd
  Author: Laszlo Ersek <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M dump.c

  Log Message:
  -----------
  dump: simplify get_len_buf_out()

We can (and should) rely on the fact that s->flag_compress is exactly one
of DUMP_DH_COMPRESSED_ZLIB, DUMP_DH_COMPRESSED_LZO, and
DUMP_DH_COMPRESSED_SNAPPY.

This is ensured by the QMP schema and dump_init() in combination.

Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Laszlo Ersek <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 8e5977797d76e33856506c9a0c454ae9ab23034c
      
https://github.com/qemu/qemu/commit/8e5977797d76e33856506c9a0c454ae9ab23034c
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M hmp-commands.hx
    M hmp.h
    M include/sysemu/char.h
    M monitor.c
    M qemu-char.c

  Log Message:
  -----------
  monitor: Add ringbuf_write and ringbuf_read argument completion

Export chr_is_ringbuf() function. Also remove left-over function prototypes
while at it.

Signed-off-by: Hani Benhabiles <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: d0ece345cbe3a58a9952f0f539641009bfd7ddf9
      
https://github.com/qemu/qemu/commit/d0ece345cbe3a58a9952f0f539641009bfd7ddf9
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M hmp-commands.hx
    M hmp.h
    M monitor.c

  Log Message:
  -----------
  monitor: Add watchdog_action argument completion

Signed-off-by: Hani Benhabiles <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: c68a0409b388c30c7f4ee8be44081c143f280279
      
https://github.com/qemu/qemu/commit/c68a0409b388c30c7f4ee8be44081c143f280279
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M hmp-commands.hx
    M hmp.h
    M monitor.c

  Log Message:
  -----------
  monitor: Add migrate_set_capability completion

Signed-off-by: Hani Benhabiles <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 84007e81814bd1b523eb36b027ef8a84d7f00206
      
https://github.com/qemu/qemu/commit/84007e81814bd1b523eb36b027ef8a84d7f00206
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M include/net/net.h
    M net/net.c

  Log Message:
  -----------
  net: Export valid host network devices list

Signed-off-by: Hani Benhabiles <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: e3bb532cc795a394b74d08c9d5eb1d95bb0e1e86
      
https://github.com/qemu/qemu/commit/e3bb532cc795a394b74d08c9d5eb1d95bb0e1e86
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M hmp-commands.hx
    M hmp.h
    M monitor.c

  Log Message:
  -----------
  monitor: Add host_net_add device argument completion

Also fix the parameters documentation.

Signed-off-by: Hani Benhabiles <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: e70871d8b5c92e40cedd6fd0b7687c4f0b6ce3ff
      
https://github.com/qemu/qemu/commit/e70871d8b5c92e40cedd6fd0b7687c4f0b6ce3ff
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M util/readline.c

  Log Message:
  -----------
  readline: Make completion strings always unique

There is no need to clutter the user's choices with repeating the same value
multiple times.

Signed-off-by: Hani Benhabiles <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: ddd6b45ce25281a5894e2df0f7af014e83af19f7
      
https://github.com/qemu/qemu/commit/ddd6b45ce25281a5894e2df0f7af014e83af19f7
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M hmp-commands.hx
    M hmp.h
    M monitor.c

  Log Message:
  -----------
  monitor: Add host_net_remove arguments completion

Relies on readline unique completion strings patch to make the added vlan/hub
completion values unique, instead of using something like a hash table.

Signed-off-by: Hani Benhabiles <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: b21631f3b5cdecd14114034cd9e4e7f63ed7fde1
      
https://github.com/qemu/qemu/commit/b21631f3b5cdecd14114034cd9e4e7f63ed7fde1
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M hmp-commands.hx
    M hmp.h
    M monitor.c

  Log Message:
  -----------
  monitor: Add delvm and loadvm argument completion

Signed-off-by: Hani Benhabiles <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 075ccb6cd3f7abe648a3e708ed34cfced378647f
      
https://github.com/qemu/qemu/commit/075ccb6cd3f7abe648a3e708ed34cfced378647f
  Author: Hani Benhabiles <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M util/readline.c

  Log Message:
  -----------
  readline: Clear screen on form feed.

Signed-off-by: Hani Benhabiles <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: a491af471bf8f1188b2665f54d109065d4591e45
      
https://github.com/qemu/qemu/commit/a491af471bf8f1188b2665f54d109065d4591e45
  Author: Gonglei <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M qobject/json-parser.c

  Log Message:
  -----------
  json-parser: drop superfluous assignment for token variable

Signed-off-by: ChenLiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>


  Commit: 05fedeef835c3c889e5d2e44f8abb11dcfcadefc
      
https://github.com/qemu/qemu/commit/05fedeef835c3c889e5d2e44f8abb11dcfcadefc
  Author: Peter Maydell <address@hidden>
  Date:   2014-06-11 (Wed, 11 Jun 2014)

  Changed paths:
    M dump.c
    M hmp-commands.hx
    M hmp.h
    M include/net/net.h
    M include/sysemu/char.h
    M include/sysemu/dump.h
    M monitor.c
    M net/net.c
    M qemu-char.c
    M qobject/json-parser.c
    M util/readline.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  json-parser: drop superfluous assignment for token variable
  readline: Clear screen on form feed.
  monitor: Add delvm and loadvm argument completion
  monitor: Add host_net_remove arguments completion
  readline: Make completion strings always unique
  monitor: Add host_net_add device argument completion
  net: Export valid host network devices list
  monitor: Add migrate_set_capability completion
  monitor: Add watchdog_action argument completion
  monitor: Add ringbuf_write and ringbuf_read argument completion
  dump: simplify get_len_buf_out()
  dump: hoist lzo_init() from get_len_buf_out() to dump_init()
  dump: select header bitness based on ELF class, not ELF architecture
  dump: eliminate DumpState.page_size ("guest's page size")
  dump: eliminate DumpState.page_shift ("guest's page shift")
  dump: simplify write_start_flat_header()
  dump: fill in the flat header signature more pleasingly to the eye

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/706808585a49...05fedeef835c

reply via email to

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