From: Peter Xu <peterx@redhat.com>
To: Prasad Pandit <ppandit@redhat.com>
Cc: Ani Sinha <anisinha@redhat.com>, Fabiano Rosas <farosas@suse.de>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Ani Sinha <ani@anisinha.ca>,
Prasad Pandit <pjp@fedoraproject.org>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [PATCH v6 35/35] migration: return EEXIST when trying to add the same migration blocker
Date: Mon, 2 Mar 2026 15:01:19 -0500 [thread overview]
Message-ID: <aaXsj5osdbUNbttY@x1.local> (raw)
In-Reply-To: <CAE8KmOzmk195FKCK-J6qVnj=wcDp5HC6+xhbNhturYo-Ls0egw@mail.gmail.com>
On Mon, Mar 02, 2026 at 04:58:50PM +0530, Prasad Pandit wrote:
> Hello all,
>
> On Thu, 26 Feb 2026 at 21:46, Ani Sinha <anisinha@redhat.com> wrote:
> > >>> On Wed, Feb 25, 2026 at 09:19:40AM +0530, Ani Sinha wrote:
> > >>>> Currently the code that adds a migration blocker does not check if the same
> > >>>> blocker already exists. Return an EEXIST error code if there is an attempt to
> > >>>> add the same migration blocker again. This way the same migration blocker will
> > >>>> not get added twice.
> > >>>
> > >>> Could you help explain why it will inject two identical errors in the first
> > >>> place, and why the caller cannot make sure it won't be injected twice?
> > >>
> > >> Likely due to a bug in the code. For example if the init function that
> > >> adds the blocker is called again and the caller does not handle the
> > >> second init call properly. This came up as a part of the coco reset work
> > >> where migration blockers are added in init methods. They need not be
> > >> added again when init methods are again called during the reset
> > >> process. The caller can handle it of course but adding a check further
> > >> down the call stack makes things more robust.
> > >
> > > IMHO if we want to make it more robust, we shouldn't return an error
> > > because the caller may not always check for errors.
> > >
> > > Would assertion suites more here? Because migration blockers are not
> > > something the user can manipulate, so it's a solid bug to fix when
> > > triggered.
> >
> > If Prasad agrees, I will send something.
>
> * The majority of the places I see constructs like:
> ===
> if (migrate_add_blocker(&g->migration_blocker, errp) < 0) {
> OR
> ret = migrate_add_blocker(&hv_no_nonarch_cs_mig_blocker, &local_err);
> if (ret < 0) {
> error_report_err(local_err);
> ===
>
> * So setting **errp and returning a negative value is consistent with
> that. Aborting (assert(3)) for trying to add a duplicate blocker
> object seems like a harsh punishment, considering that'll happen at
> run time and the user won't be able to do much then.
If it's a programming error, then it shouldn't happen at runtime. The
current paths to fail this API was not for programming errors.
If this patch isn't required, IMHO we can at least drop it in this series
and make it separate.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2026-03-02 20:02 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 3:49 [PATCH v6 00/35] Introduce support for confidential guest reset (x86) Ani Sinha
2026-02-25 3:49 ` [PATCH v6 01/35] i386/kvm: avoid installing duplicate msr entries in msr_handlers Ani Sinha
2026-02-25 3:49 ` [PATCH v6 02/35] accel/kvm: add confidential class member to indicate guest rebuild capability Ani Sinha
2026-02-25 3:49 ` [PATCH v6 03/35] hw/accel: add a per-accelerator callback to change VM accelerator handle Ani Sinha
2026-02-25 3:49 ` [PATCH v6 04/35] system/physmem: add helper to reattach existing memory after KVM VM fd change Ani Sinha
2026-02-25 3:49 ` [PATCH v6 05/35] accel/kvm: add changes required to support KVM VM file descriptor change Ani Sinha
2026-02-25 3:49 ` [PATCH v6 06/35] accel/kvm: mark guest state as unprotected after vm " Ani Sinha
2026-02-25 3:49 ` [PATCH v6 07/35] accel/kvm: add a notifier to indicate KVM VM file descriptor has changed Ani Sinha
2026-02-25 3:49 ` [PATCH v6 08/35] accel/kvm: notify when KVM VM file fd is about to be changed Ani Sinha
2026-02-25 3:49 ` [PATCH v6 09/35] i386/kvm: unregister smram listeners prior to vm file descriptor change Ani Sinha
2026-02-25 3:49 ` [PATCH v6 10/35] kvm/i386: implement architecture support for kvm " Ani Sinha
2026-02-25 3:49 ` [PATCH v6 11/35] i386/kvm: refactor xen init into a new function Ani Sinha
2026-02-25 3:49 ` [PATCH v6 12/35] hw/i386: refactor x86_bios_rom_init for reuse in confidential guest reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 13/35] hw/i386: export a new function x86_bios_rom_reload Ani Sinha
2026-02-25 3:49 ` [PATCH v6 14/35] kvm/i386: reload firmware for confidential guest reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 15/35] accel/kvm: rebind current VCPUs to the new KVM VM file descriptor upon reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 16/35] i386/tdx: refactor TDX firmware memory initialization code into a new function Ani Sinha
2026-02-25 3:49 ` [PATCH v6 17/35] i386/tdx: finalize TDX guest state upon reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 18/35] i386/tdx: add a pre-vmfd change notifier to reset tdx state Ani Sinha
2026-02-25 3:49 ` [PATCH v6 19/35] i386/sev: add migration blockers only once Ani Sinha
2026-02-25 3:49 ` [PATCH v6 20/35] i386/sev: add notifiers " Ani Sinha
2026-02-25 3:49 ` [PATCH v6 21/35] i386/sev: free existing launch update data and kernel hashes data on init Ani Sinha
2026-02-25 3:49 ` [PATCH v6 22/35] i386/sev: add support for confidential guest reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 23/35] hw/vfio: generate new file fd for pseudo device and rebind existing descriptors Ani Sinha
2026-02-27 7:02 ` Cédric Le Goater
2026-02-27 7:28 ` Ani Sinha
2026-02-25 3:49 ` [PATCH v6 24/35] kvm/i8254: refactor pit initialization into a helper Ani Sinha
2026-02-25 3:49 ` [PATCH v6 25/35] kvm/i8254: add support for confidential guest reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 26/35] kvm/hyperv: add synic feature to CPU only if its not enabled Ani Sinha
2026-02-25 3:49 ` [PATCH v6 27/35] hw/hyperv/vmbus: add support for confidential guest reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 28/35] kvm/xen-emu: re-initialize capabilities during " Ani Sinha
2026-02-25 3:49 ` [PATCH v6 29/35] ppc/openpic: create a new openpic device and reattach mem region on coco reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 30/35] kvm/vcpu: add notifiers to inform vcpu file descriptor change Ani Sinha
2026-02-25 3:49 ` [PATCH v6 31/35] kvm/clock: add support for confidential guest reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 32/35] hw/machine: introduce machine specific option 'x-change-vmfd-on-reset' Ani Sinha
2026-02-25 3:49 ` [PATCH v6 33/35] tests/functional/x86_64: add functional test to exercise vm fd change on reset Ani Sinha
2026-02-25 3:49 ` [PATCH v6 34/35] qom: add 'confidential-guest-reset' property for x86 confidential vms Ani Sinha
2026-02-25 3:49 ` [PATCH v6 35/35] migration: return EEXIST when trying to add the same migration blocker Ani Sinha
2026-02-25 6:05 ` Prasad Pandit
2026-02-25 9:07 ` Daniel P. Berrangé
2026-02-25 9:32 ` Markus Armbruster
2026-02-25 9:45 ` Ani Sinha
2026-02-25 10:04 ` Daniel P. Berrangé
2026-02-25 9:34 ` Ani Sinha
2026-02-25 9:41 ` Daniel P. Berrangé
2026-02-25 17:29 ` Peter Xu
2026-02-26 3:46 ` Ani Sinha
2026-02-26 13:08 ` Peter Xu
2026-02-26 16:14 ` Ani Sinha
2026-03-02 11:28 ` Prasad Pandit
2026-03-02 20:01 ` Peter Xu [this message]
2026-03-03 10:51 ` Ani Sinha
2026-03-09 4:29 ` Ani Sinha
2026-02-26 17:23 ` Paolo Bonzini
2026-02-27 3:19 ` Ani Sinha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aaXsj5osdbUNbttY@x1.local \
--to=peterx@redhat.com \
--cc=ani@anisinha.ca \
--cc=anisinha@redhat.com \
--cc=farosas@suse.de \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=ppandit@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.