qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] f9734d: error: Use error_fatal to simplify ob


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] f9734d: error: Use error_fatal to simplify obvious fatal e...
Date: Fri, 27 Aug 2021 01:57:55 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: f9734d5d4078f17daf328b9e113aaffe3d00ecaf
      
https://github.com/qemu/qemu/commit/f9734d5d4078f17daf328b9e113aaffe3d00ecaf
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/s390x/ipl.c
    M migration/migration.c
    M qemu-img.c
    M qemu-io.c
    M qemu-nbd.c
    M scsi/qemu-pr-helper.c
    M softmmu/vl.c
    M target/i386/sev.c
    M ui/console.c
    M ui/spice-core.c

  Log Message:
  -----------
  error: Use error_fatal to simplify obvious fatal errors (again)

We did this with scripts/coccinelle/use-error_fatal.cocci before, in
commit 50beeb68094 and 007b06578ab.  This commit cleans up rarer
variations that don't seem worth matching with Coccinelle.

Cc: Thomas Huth <thuth@redhat.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-2-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  Commit: e2ef4fc7aeb7e5856594f3172e08e6650011084a
      
https://github.com/qemu/qemu/commit/e2ef4fc7aeb7e5856594f3172e08e6650011084a
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/ppc/spapr_events.c

  Log Message:
  -----------
  spapr: Plug memory leak when we can't add a migration blocker

Fixes: 2500fb423adb17995485de0b4d507cf2f09e3a7f
Cc: Aravinda Prasad <arawinda.p@gmail.com>
Cc: Ganesh Goudar <ganeshgr@linux.ibm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-3-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  Commit: d7f5013e122e14c6f5ac8d973e6567413cfa3790
      
https://github.com/qemu/qemu/commit/d7f5013e122e14c6f5ac8d973e6567413cfa3790
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/ppc/spapr_events.c

  Log Message:
  -----------
  spapr: Explain purpose of ->fwnmi_migration_blocker more clearly

spapr_mce_req_event() makes an effort to prevent migration from
degrading the reporting of FWNMIs.  It adds a migration blocker when
it receives one, and deletes it when it's done handling it.  This is a
best effort.

Commit 2500fb423a "migration: Include migration support for machine
check handling" tried to explain this in a comment.  Rewrite the
comment for clarity, and reposition it to make it clear it applies to
all failure modes, not just "migration already in progress".

Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Aravinda Prasad <arawinda.p@gmail.com>
Cc: Ganesh Goudar <ganeshgr@linux.ibm.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-4-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 96ac9719331c0fd6e928b340f850b8cb617a3cea
      
https://github.com/qemu/qemu/commit/96ac9719331c0fd6e928b340f850b8cb617a3cea
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/remote/proxy.c

  Log Message:
  -----------
  multi-process: Fix pci_proxy_dev_realize() error handling

The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL.  Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.

pci_proxy_dev_realize() is wrong that way: it passes @errp to
qio_channel_new_fd() without checking for failure.  If it runs into
another failure, it trips error_setv()'s assertion.

Fix it to check for failure properly.

Fixes: 9f8112073aad8e485ac012ee18809457ab7f23a6
Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Cc: Jagannathan Raman <jag.raman@oracle.com>
Cc: John G Johnson <john.g.johnson@oracle.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-5-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Jagannathan Raman <jag.raman@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: aa6f7448ebef35249374508c503f53a8859d8a1e
      
https://github.com/qemu/qemu/commit/aa6f7448ebef35249374508c503f53a8859d8a1e
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/scsi/vhost-scsi.c

  Log Message:
  -----------
  vhost-scsi: Plug memory leak on migrate_add_blocker() failure

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-6-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: a5c051b2cf11197b1663dfb470e80dbc32d77cd0
      
https://github.com/qemu/qemu/commit/a5c051b2cf11197b1663dfb470e80dbc32d77cd0
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M target/i386/kvm/kvm.c

  Log Message:
  -----------
  i386: Never free migration blocker objects instead of sometimes

invtsc_mig_blocker has static storage duration.  When a CPU with
certain features is initialized, and invtsc_mig_blocker is still null,
we add a migration blocker and store it in invtsc_mig_blocker.

The object is freed when migrate_add_blocker() fails, leaving
invtsc_mig_blocker dangling.  It is not freed on later failures.

Same for hv_passthrough_mig_blocker and hv_no_nonarch_cs_mig_blocker.

All failures are actually fatal, so whether we free or not doesn't
really matter, except as bad examples to be copied / imitated.

Clean this up in a minimal way: never free these blocker objects.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-7-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: eb24a23e15580c2c6ab144a6bbf7f825506849ae
      
https://github.com/qemu/qemu/commit/eb24a23e15580c2c6ab144a6bbf7f825506849ae
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/vfio/migration.c

  Log Message:
  -----------
  vfio: Avoid error_propagate() after migrate_add_blocker()

When migrate_add_blocker(blocker, &err) is followed by
error_propagate(errp, err), we can often just as well do
migrate_add_blocker(..., errp).  This is the case in
vfio_migration_probe().

Prior art: commit 386f6c07d2 "error: Avoid error_propagate() after
migrate_add_blocker()".

Cc: Kirti Wankhede <kwankhede@nvidia.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-8-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed by: Kirti Wankhede <kwankhede@nvidia.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 650126f838f763fe02f5b41584fd9f13cb8cbf13
      
https://github.com/qemu/qemu/commit/650126f838f763fe02f5b41584fd9f13cb8cbf13
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M target/i386/nvmm/nvmm-all.c
    M target/i386/whpx/whpx-all.c

  Log Message:
  -----------
  whpx nvmm: Drop useless migrate_del_blocker()

There is nothing to delete after migrate_add_blocker() failed.  Trying
anyway is safe, but useless.  Don't.

Cc: Sunil Muthuswamy <sunilmut@microsoft.com>
Cc: Kamil Rytarowski <kamil@netbsd.org>
Cc: Reinoud Zandijk <reinoud@netbsd.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-9-armbru@redhat.com>
Reviewed-by: Reinoud Zandijk <reinoud@NetBSD.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 436c831a281ed950110dbc3e3baea24054c37298
      
https://github.com/qemu/qemu/commit/436c831a281ed950110dbc3e3baea24054c37298
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M backends/tpm/tpm_emulator.c
    M hw/virtio/vhost.c
    M target/i386/kvm/kvm.c
    M target/i386/nvmm/nvmm-all.c
    M target/i386/whpx/whpx-all.c

  Log Message:
  -----------
  migration: Unify failure check for migrate_add_blocker()

Most callers check the return value.  Some check whether it set an
error.  Functionally equivalent, but the former tends to be easier on
the eyes, so do that everywhere.

Prior art: commit c6ecec43b2 "qemu-option: Check return value instead
of @err where convenient".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-10-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 7d6f6933aa73a67e3ab6a70b0f17b9f48620bf13
      
https://github.com/qemu/qemu/commit/7d6f6933aa73a67e3ab6a70b0f17b9f48620bf13
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M migration/migration.c

  Log Message:
  -----------
  migration: Handle migration_incoming_setup() errors consistently

Commit b673eab4e2 "multifd: Make multifd_load_setup() get an Error
parameter" changed migration_incoming_setup() to take an Error **
argument, and adjusted the callers accordingly.  It neglected to
change adjust multifd_load_setup(): it still exit()s on error.  Clean
that up.

The error now gets propagated up two call chains: via
migration_fd_process_incoming() to rdma_accept_incoming_migration(),
and via migration_ioc_process_incoming() to
migration_channel_process_incoming().  Both chain ends report the
error with error_report_err(), but otherwise ignore it.  Behavioral
change: we no longer exit() on this error.

This is consistent with how we handle other errors here, e.g. from
multifd_recv_new_channel() via migration_ioc_process_incoming() to
migration_channel_process_incoming().  Whether it's consistently right
or consistently wrong I can't tell.

Also clean up the return value from the unusual 0 on success, 1 on
error to the more common true on success, false on error.

Cc: Juan Quintela <quintela@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-11-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 0d9a6654512a6b7ab18c53fc3f5a6bba8de2dde8
      
https://github.com/qemu/qemu/commit/0d9a6654512a6b7ab18c53fc3f5a6bba8de2dde8
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/i386/microvm.c

  Log Message:
  -----------
  microvm: Drop dead error handling in microvm_machine_state_init()

Stillborn in commit 0ebf007dda "hw/i386: Introduce the microvm machine
type".

Cc: Sergio Lopez <slp@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-12-armbru@redhat.com>
Reviewed-by: Sergio Lopez <slp@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: 66647ed4591572e7928cb5865909bb6c572d7e40
      
https://github.com/qemu/qemu/commit/66647ed4591572e7928cb5865909bb6c572d7e40
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/virtio/vhost-user.c
    M hw/virtio/vhost.c

  Log Message:
  -----------
  vhost: Clean up how VhostOpts method vhost_get_config() fails

vhost_user_get_config() can fail without setting an error.  Unclean.
Its caller vhost_dev_get_config() compensates by substituting a
generic error then.  Goes back to commit 50de51387f "vhost:
Distinguish errors in vhost_dev_get_config()".

Clean up by moving the generic error from vhost_dev_get_config() to
all the failure paths that neglect to set an error.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-13-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[Sign of error_setg_errno()'s second argument fixed in both calls]


  Commit: 998647dc8feb32b9b75a8afb834ce971ee36a426
      
https://github.com/qemu/qemu/commit/998647dc8feb32b9b75a8afb834ce971ee36a426
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/virtio/vhost-user.c
    M hw/virtio/vhost.c

  Log Message:
  -----------
  vhost: Clean up how VhostOpts method vhost_backend_init() fails

vhost_user_backend_init() can fail without setting an error.  Unclean.
Its caller vhost_dev_init() compensates by substituting a generic
error then.  Goes back to commit 28770ff935 "vhost: Distinguish errors
in vhost_backend_init()".

Clean up by moving the generic error from vhost_dev_init() to all the
failure paths that neglect to set an error.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-14-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


  Commit: fff0e451f3ed3b73224ca91c84fbb13aeae9d844
      
https://github.com/qemu/qemu/commit/fff0e451f3ed3b73224ca91c84fbb13aeae9d844
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M hw/remote/mpqemu-link.c
    M qga/commands-posix-ssh.c
    M qga/commands-win32.c
    M ui/console.c

  Log Message:
  -----------
  Remove superfluous ERRP_GUARD()

Macro ERRP_GUARD() is only needed when we want to dereference @errp or
pass it to error_prepend() or error_append_hint().  Delete superfluous
ones.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-15-armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>


  Commit: f9dfae9cb6b27649085f662a863f6167650402e0
      
https://github.com/qemu/qemu/commit/f9dfae9cb6b27649085f662a863f6167650402e0
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-08-26 (Thu, 26 Aug 2021)

  Changed paths:
    M softmmu/vl.c

  Log Message:
  -----------
  vl: Clean up -smp error handling

The Error ** argument must be NULL, &error_abort, &error_fatal, or a
pointer to a variable containing NULL.  Passing an argument of the
latter kind twice without clearing it in between is wrong: if the
first call sets an error, it no longer points to NULL for the second
call.

machine_parse_property_opt() is wrong that way: it passes @errp to
keyval_parse() without checking for failure, then passes it to
keyval_merge().  Harmless, since the only caller passes &error_fatal.

Clean up: drop the parameter, and use &error_fatal directly.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210720125408.387910-16-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
[Rebased, conflict with commit a3c2f128306 resolved]


  Commit: 0289f62335b2af49f6c30296cc00d009995b35f6
      
https://github.com/qemu/qemu/commit/0289f62335b2af49f6c30296cc00d009995b35f6
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-08-27 (Fri, 27 Aug 2021)

  Changed paths:
    M backends/tpm/tpm_emulator.c
    M hw/i386/microvm.c
    M hw/ppc/spapr_events.c
    M hw/remote/mpqemu-link.c
    M hw/remote/proxy.c
    M hw/s390x/ipl.c
    M hw/scsi/vhost-scsi.c
    M hw/vfio/migration.c
    M hw/virtio/vhost-user.c
    M hw/virtio/vhost.c
    M migration/migration.c
    M qemu-img.c
    M qemu-io.c
    M qemu-nbd.c
    M qga/commands-posix-ssh.c
    M qga/commands-win32.c
    M scsi/qemu-pr-helper.c
    M softmmu/vl.c
    M target/i386/kvm/kvm.c
    M target/i386/nvmm/nvmm-all.c
    M target/i386/sev.c
    M target/i386/whpx/whpx-all.c
    M ui/console.c
    M ui/spice-core.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2021-08-26' into 
staging

Error reporting patches for 2021-08-26

# gpg: Signature made Thu 26 Aug 2021 16:17:05 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-error-2021-08-26:
  vl: Clean up -smp error handling
  Remove superfluous ERRP_GUARD()
  vhost: Clean up how VhostOpts method vhost_backend_init() fails
  vhost: Clean up how VhostOpts method vhost_get_config() fails
  microvm: Drop dead error handling in microvm_machine_state_init()
  migration: Handle migration_incoming_setup() errors consistently
  migration: Unify failure check for migrate_add_blocker()
  whpx nvmm: Drop useless migrate_del_blocker()
  vfio: Avoid error_propagate() after migrate_add_blocker()
  i386: Never free migration blocker objects instead of sometimes
  vhost-scsi: Plug memory leak on migrate_add_blocker() failure
  multi-process: Fix pci_proxy_dev_realize() error handling
  spapr: Explain purpose of ->fwnmi_migration_blocker more clearly
  spapr: Plug memory leak when we can't add a migration blocker
  error: Use error_fatal to simplify obvious fatal errors (again)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/f214d8e01507...0289f62335b2



reply via email to

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