1. 21 3月, 2018 3 次提交
    • Y
      dump.c: allow fd_write_vmcore to return errno on failure · 0c33659d
      Yasmin Beatriz 提交于
      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: yilzhang@redhat.com
      Cc: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
      Signed-off-by: NYasmin Beatriz <yasmins@linux.vnet.ibm.com>
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Message-Id: <20180212142506.28445-2-danielhb@linux.vnet.ibm.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      Signed-off-by: NMarc-André Lureau <marcandre.lureau@redhat.com>
      0c33659d
    • P
      Update version for v2.12.0-rc0 release · f1a63fcf
      Peter Maydell 提交于
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      f1a63fcf
    • P
      Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20180320' into staging · a9b47e53
      Peter Maydell 提交于
      HMP fixes for 2.12
      
      # gpg: Signature made Tue 20 Mar 2018 12:39:24 GMT
      # gpg:                using RSA key 0516331EBC5BFDE7
      # gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
      # Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7
      
      * remotes/dgilbert/tags/pull-hmp-20180320:
        hmp: free sev info
        HMP: Initialize err before using
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      a9b47e53
  2. 20 3月, 2018 37 次提交