Skip to content
Snippets Groups Projects
  1. Apr 22, 2022
  2. Apr 06, 2022
  3. Mar 21, 2022
  4. Dec 15, 2021
  5. Nov 01, 2021
  6. May 02, 2021
  7. Jan 28, 2021
  8. Oct 09, 2020
  9. Sep 23, 2020
    • Stefan Hajnoczi's avatar
      qemu/atomic.h: rename atomic_ to qatomic_ · d73415a3
      Stefan Hajnoczi authored
      
      clang's C11 atomic_fetch_*() functions only take a C11 atomic type
      pointer argument. QEMU uses direct types (int, etc) and this causes a
      compiler error when a QEMU code calls these functions in a source file
      that also included <stdatomic.h> via a system header file:
      
        $ CC=clang CXX=clang++ ./configure ... && make
        ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid)
      
      Avoid using atomic_*() names in QEMU's atomic.h since that namespace is
      used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h
      and <stdatomic.h> can co-exist. I checked /usr/include on my machine and
      searched GitHub for existing "qatomic_" users but there seem to be none.
      
      This patch was generated using:
      
        $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \
          sort -u >/tmp/changed_identifiers
        $ for identifier in $(</tmp/changed_identifiers); do
              sed -i "s%\<$identifier\>%q$identifier%g" \
                  $(git grep -I -l "\<$identifier\>")
          done
      
      I manually fixed line-wrap issues and misaligned rST tables.
      
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
      d73415a3
  10. Sep 16, 2020
  11. Jul 10, 2020
  12. Apr 29, 2020
    • Philippe Mathieu-Daudé's avatar
      various: Remove suspicious '\' character outside of #define in C code · 78ee6bd0
      Philippe Mathieu-Daudé authored
      
      Fixes the following coccinelle warnings:
      
        $ spatch --sp-file --verbose-parsing  ... \
            scripts/coccinelle/remove_local_err.cocci
        ...
        SUSPICIOUS: a \ character appears outside of a #define at ./target/ppc/translate_init.inc.c:5213
        SUSPICIOUS: a \ character appears outside of a #define at ./target/ppc/translate_init.inc.c:5261
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:166
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:167
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:169
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:170
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:171
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:172
        SUSPICIOUS: a \ character appears outside of a #define at ./target/microblaze/cpu.c:173
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5787
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5789
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5800
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5801
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5802
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5804
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5805
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:5806
        SUSPICIOUS: a \ character appears outside of a #define at ./target/i386/cpu.c:6329
        SUSPICIOUS: a \ character appears outside of a #define at ./hw/sd/sdhci.c:1133
        SUSPICIOUS: a \ character appears outside of a #define at ./hw/scsi/scsi-disk.c:3081
        SUSPICIOUS: a \ character appears outside of a #define at ./hw/net/virtio-net.c:1529
        SUSPICIOUS: a \ character appears outside of a #define at ./hw/riscv/sifive_u.c:468
        SUSPICIOUS: a \ character appears outside of a #define at ./dump/dump.c:1895
        SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2209
        SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2215
        SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2221
        SUSPICIOUS: a \ character appears outside of a #define at ./block/vhdx.c:2222
        SUSPICIOUS: a \ character appears outside of a #define at ./block/replication.c:172
        SUSPICIOUS: a \ character appears outside of a #define at ./block/replication.c:173
      
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Message-Id: <20200412223619.11284-2-f4bug@amsat.org>
      Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
      Acked-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      78ee6bd0
  13. Apr 03, 2020
  14. Aug 16, 2019
    • Markus Armbruster's avatar
      sysemu: Split sysemu/runstate.h off sysemu/sysemu.h · 54d31236
      Markus Armbruster authored
      
      sysemu/sysemu.h is a rather unfocused dumping ground for stuff related
      to the system-emulator.  Evidence:
      
      * It's included widely: in my "build everything" tree, changing
        sysemu/sysemu.h still triggers a recompile of some 1100 out of 6600
        objects (not counting tests and objects that don't depend on
        qemu/osdep.h, down from 5400 due to the previous two commits).
      
      * It pulls in more than a dozen additional headers.
      
      Split stuff related to run state management into its own header
      sysemu/runstate.h.
      
      Touching sysemu/sysemu.h now recompiles some 850 objects.  qemu/uuid.h
      also drops from 1100 to 850, and qapi/qapi-types-run-state.h from 4400
      to 4200.  Touching new sysemu/runstate.h recompiles some 500 objects.
      
      Since I'm touching MAINTAINERS to add sysemu/runstate.h anyway, also
      add qemu/main-loop.h.
      
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190812052359.30071-30-armbru@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      [Unbreak OS-X build]
      54d31236
    • Markus Armbruster's avatar
      Include qemu/main-loop.h less · db725815
      Markus Armbruster authored
      
      In my "build everything" tree, changing qemu/main-loop.h triggers a
      recompile of some 5600 out of 6600 objects (not counting tests and
      objects that don't depend on qemu/osdep.h).  It includes block/aio.h,
      which in turn includes qemu/event_notifier.h, qemu/notify.h,
      qemu/processor.h, qemu/qsp.h, qemu/queue.h, qemu/thread-posix.h,
      qemu/thread.h, qemu/timer.h, and a few more.
      
      Include qemu/main-loop.h only where it's needed.  Touching it now
      recompiles only some 1700 objects.  For block/aio.h and
      qemu/event_notifier.h, these numbers drop from 5600 to 2800.  For the
      others, they shrink only slightly.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190812052359.30071-21-armbru@redhat.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Tested-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      db725815
  15. Jul 02, 2019
  16. Jun 12, 2019
    • Markus Armbruster's avatar
      Include qemu-common.h exactly where needed · a8d25326
      Markus Armbruster authored
      
      No header includes qemu-common.h after this commit, as prescribed by
      qemu-common.h's file comment.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-5-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
      block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
      target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
      target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
      target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
      target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
      net/tap-bsd.c fixed up]
      a8d25326
  17. Feb 06, 2019
  18. Jan 11, 2019
  19. Aug 28, 2018
  20. Aug 23, 2018
  21. Jun 29, 2018
  22. Apr 09, 2018
    • Eric Blake's avatar
      dump: Fix build with newer gcc · 84c868f6
      Eric Blake authored
      
      gcc 8 on rawhide is picky enough to complain:
      
      /home/dummy/qemu/dump.c: In function 'create_header32':
      /home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before terminating nul copying 8 bytes from a string of the same length [-Werror=stringop-truncation]
           strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE));
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      But we already have SIG_LEN defined as the right length without needing
      to do a strlen(), and memcpy() is better than strncpy() when we know
      we do not want a trailing NUL byte.
      
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      84c868f6
  23. Mar 21, 2018
    • Yasmin Beatriz's avatar
      dump.c: allow fd_write_vmcore to return errno on failure · 0c33659d
      Yasmin Beatriz authored
      
      fd_write_vmcore can fail to execute for a lot of reasons that can be
      retrieved by errno, but it only returns -1. This makes difficult for
      the caller to know what happened and only a generic error message is
      propagated back to the user. This is an example using dump-guest-memory:
      
      (qemu) dump-guest-memory /home/yasmin/mnt/test.dump
      dump: failed to save memory
      
      All callers of fd_write_vmcore of dump.c does error handling via
      error_setg(), so at first it seems feasible to add the Error pointer as
      an argument of fd_write_vmcore. This proved to be more complex than it
      first looked. fd_write_vmcore is used by write_elf64_notes and
      write_elf32_notes as a WriteCoreDumpFunction prototype. WriteCoreDumpFunction
      is declared in include/qom/cpu.h and is used all around the code. This
      leaves us with few alternatives:
      
      - change the WriteCoreDumpFunction prototype to include an error pointer.
      This would require to change all functions that implements this prototype
      to also receive an Error pointer;
      
      - change both write_elf64_notes and write_elf32_notes to no use the
      WriteCoreDumpFunction. These functions use not only fd_write_vmcore
      but also buf_write_note, so this would require to change buf_write_note
      to handle an Error pointer. Considerable easier than the alternative
      above, but it's still a lot of code just for the benefit of the callers
      of fd_write_vmcore.
      
      This patch presents an easier solution that benefits all fd_write_vmcore
      callers:
      
      - instead of returning -1 on error, return -errno. All existing callers
      already checks for ret < 0 so there is no need to change the caller's
      logic too much. This also allows the retrieval of the errno.
      
      - all callers were updated to use error_setg_errno instead of just
      errno_setg. Now that fd_write_vmcore can return an errno, let's update
      all callers so they can benefit from a more detailed error message.
      
      This is the same dump-guest-memory example with this patch applied:
      
      (qemu) dump-guest-memory /home/yasmin/mnt/test.dump
      dump: failed to save memory: No space left on device
      (qemu)
      
      This example illustrates an error of fd_write_vmcore when called
      from write_data. All other callers will benefit from better
      error messages as well.
      
      Reported-by: default avatar <yilzhang@redhat.com>
      Cc: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
      Signed-off-by: default avatarYasmin Beatriz <yasmins@linux.vnet.ibm.com>
      Signed-off-by: default avatarDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Message-Id: <20180212142506.28445-2-danielhb@linux.vnet.ibm.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
      0c33659d
  24. Mar 19, 2018
  25. Mar 02, 2018
    • Markus Armbruster's avatar
      qapi: Empty out qapi-schema.json · 112ed241
      Markus Armbruster authored
      
      The previous commit improved compile time by including less of the
      generated QAPI headers.  This is impossible for stuff defined directly
      in qapi-schema.json, because that ends up in headers that that pull in
      everything.
      
      Move everything but include directives from qapi-schema.json to new
      sub-module qapi/misc.json, then include just the "misc" shard where
      possible.
      
      It's possible everywhere, except:
      
      * monitor.c needs qmp-command.h to get qmp_init_marshal()
      
      * monitor.c, ui/vnc.c and the generated qapi-event-FOO.c need
        qapi-event.h to get enum QAPIEvent
      
      Perhaps we'll get rid of those some other day.
      
      Adding a type to qapi/migration.json now recompiles some 120 instead
      of 2300 out of 5100 objects.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20180211093607.27351-25-armbru@redhat.com>
      [eblake: rebase to master]
      Signed-off-by: default avatarEric Blake <eblake@redhat.com>
      112ed241
  26. Feb 09, 2018
  27. Jan 02, 2018
  28. Oct 15, 2017
Loading