From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E094D46BF7 for ; Wed, 28 Jan 2026 19:36:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vlBKU-0005ns-JG; Wed, 28 Jan 2026 14:35:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vlBKI-0005a4-GY for qemu-devel@nongnu.org; Wed, 28 Jan 2026 14:35:44 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vlBKE-0004pp-Px for qemu-devel@nongnu.org; Wed, 28 Jan 2026 14:35:42 -0500 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A0DB233D3B; Wed, 28 Jan 2026 19:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769628935; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Cvks/Y8JobLO7WKCWYLlZ3IGD/bXhTkFarrB++FDlSA=; b=vf8cxCCCDhYdHHy4SJ7E/7HUPnrDRHflCMrKr//zitsQ5LTLkmhX9FH6HphBd/Qs7EKVzm Xph8v7Zpt8pk4s7OXpHZzF8l9tNNNhzGZwgeTeb7167uxTA41r+nifcC7Wq8nI4vSStTlt KoVeO0DFWuWlu8GbDBZCSZDmiAwfqcw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769628935; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Cvks/Y8JobLO7WKCWYLlZ3IGD/bXhTkFarrB++FDlSA=; b=9c7MgJKApMG1LpQ7zmnKbFL0wORoOBv0wRkiXaMYP49ttjZ/AZU6LXcF28wiVQTqa7sunP gi3pkf3YMFe1JgDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=vf8cxCCC; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=9c7MgJKA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1769628935; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Cvks/Y8JobLO7WKCWYLlZ3IGD/bXhTkFarrB++FDlSA=; b=vf8cxCCCDhYdHHy4SJ7E/7HUPnrDRHflCMrKr//zitsQ5LTLkmhX9FH6HphBd/Qs7EKVzm Xph8v7Zpt8pk4s7OXpHZzF8l9tNNNhzGZwgeTeb7167uxTA41r+nifcC7Wq8nI4vSStTlt KoVeO0DFWuWlu8GbDBZCSZDmiAwfqcw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1769628935; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Cvks/Y8JobLO7WKCWYLlZ3IGD/bXhTkFarrB++FDlSA=; b=9c7MgJKApMG1LpQ7zmnKbFL0wORoOBv0wRkiXaMYP49ttjZ/AZU6LXcF28wiVQTqa7sunP gi3pkf3YMFe1JgDw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 103603EA61; Wed, 28 Jan 2026 19:35:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id +5LoMAZlemnhJwAAD6G6ig (envelope-from ); Wed, 28 Jan 2026 19:35:34 +0000 From: Fabiano Rosas To: Peter Xu , qemu-devel@nongnu.org Cc: peterx@redhat.com, Lukas Straub , Prasad Pandit , Juraj Marcin Subject: Re: [PATCH v2 19/24] migration: Refactor qemu_savevm_state_setup() In-Reply-To: <20260127185254.3954634-20-peterx@redhat.com> References: <20260127185254.3954634-1-peterx@redhat.com> <20260127185254.3954634-20-peterx@redhat.com> Date: Wed, 28 Jan 2026 16:35:32 -0300 Message-ID: <87wm11ediz.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVRCPT(0.00)[web.de]; FREEMAIL_CC(0.00)[redhat.com,web.de]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+]; MISSING_XM_UA(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:rdns, imap1.dmz-prg2.suse.org:helo, suse.de:dkim, suse.de:mid, suse.de:email] X-Rspamd-Action: no action X-Rspamd-Queue-Id: A0DB233D3B X-Rspamd-Server: rspamd1.dmz-prg2.suse.org Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Peter Xu writes: > Split it into two smaller chunks: > > - Dump of early_setup VMSDs > - Dump of save_setup() sections > > They're mutual exclusive, hence we can run two loops and do them > sequentially. This will cause migration thread to loop one more time, but > it should be fine when migration just started and only do it once. It's > needed because we will need to reuse the early_vmsd helper later to > deduplicate code elsewhere. > > QEMU almost sticks with qemu_savevm_state_XXX() to represent the dump of > vmstates's section XXX. > With that in mind, this patch renamed the original > qemu_savevm_state_setup() to qemu_savevm_state_do_setup() instead. > > So after this patch: > > - qemu_savevm_state_non_iterable_early() dumps early_vmsds only, > - qemu_savevm_state_setup() dumps save_setup() sections only, > - qemu_savevm_state_do_setup() does all things needed during setup > phase (including migration SETUP notifies) > > Signed-off-by: Peter Xu Reviewed-by: Fabiano Rosas Not for this series, but I think we could try to standardize the naming in savevm.c a bit. Here's a list of functions from savevm.c plus the main function called by them. You'll see that there's room from improvement. Removing this "qemu" prefix and choosing when to put "state" in the name would already be a win. Also maybe making more clear what calls vmstate code and what deals with se->ops only. --- qemu_loadvm_state_setup { se->ops->load_setup } qemu_savevm_state_active { se->ops->is_active } qemu_savevm_state_blocked { se->vmsd->unmigratable } qemu_savevm_state_cleanup { se->ops->save_cleanup } qemu_savevm_state_guest_unplug_pending { se->vmsd->dev_unplug_pending } qemu_savevm_state_iterate { se->ops->save_live_iterate } qemu_savevm_state_non_iterable_early { se->vmsd->early_setup; vmstate_save } qemu_savevm_state_pending_estimate { se->ops->state_pending_estimate } qemu_savevm_state_pending_exact { se->ops->state_pending_exact } qemu_savevm_state_postcopy_prepare { se->ops->save_postcopy_prepare } qemu_savevm_state_prepare { se->ops->save_prepare } qemu_savevm_state_resume_prepare { se->ops->resume_prepare } loadvm_postcopy_handle_switchover_start { se->ops->switchover_start } qemu_loadvm_load_state_buffer { se->ops->load_state_buffer } qemu_loadvm_state_switchover_ack_needed { se->ops->switchover_ack_needed } qemu_savevm_complete { se->ops->save_complete } qemu_savevm_complete_exists { se->ops->save_complete } qemu_savevm_non_migratable_list { se->vmsd->unmigratable } qemu_savevm_se_iterable { se->ops->save_setup } save_state_priority { se->vmsd->priority } vmstate_load { se->ops->load_state } vmstate_save_old_style { se->ops->save_state } loadvm_handle_cmd_packaged { qemu_loadvm_state_main } qemu_load_device_state { qemu_loadvm_state_main } qemu_savevm_maybe_send_switchover_start { qemu_savevm_send_switchover_start } qemu_savevm_send_* { qemu_savevm_command_send } qemu_savevm_state_complete_postcopy { qemu_savevm_complete } qemu_savevm_state_complete_precopy_iterable { qemu_savevm_complete } qemu_savevm_state_end_precopy { qemu_savevm_state_end } qemu_savevm_state_header { qemu_savevm_send_header } qemu_savevm_state_do_setup { qemu_savevm_state_non_iterable_early; qemu_savevm_state_setup } qemu_loadvm_state { qemu_loadvm_state_header; qemu_loadvm_state_setup; qemu_loadvm_state_switchover_ack_needed; qemu_loadvm_state_main; qemu_loadvm_thread_pool_wait } qemu_loadvm_state_main { qemu_loadvm_section_start_full; qemu_loadvm_section_part_end; loadvm_process_command } qemu_savevm_state { qemu_savevm_state_header; qemu_savevm_state_do_setup; qemu_savevm_state_iterate; qemu_savevm_state_complete_precopy; qemu_savevm_state_cleanup } qemu_savevm_state_complete_precopy { qemu_savevm_state_complete_precopy_iterable; qemu_savevm_state_non_iterable; qemu_savevm_state_end_precopy } qemu_save_device_state { qemu_savevm_state_non_iterable_early; qemu_savevm_state_non_iterable; qemu_savevm_state_end } loadvm_handle_recv_bitmap { migrate_send_rp_recv_bitmap } loadvm_postcopy_handle_advise { ram_postcopy_incoming_init } loadvm_postcopy_handle_listen { postcopy_incoming_setup } loadvm_postcopy_handle_resume { mis->postcopy_pause_sem_fault } loadvm_postcopy_handle_run { loadvm_postcopy_handle_run_bh } loadvm_postcopy_handle_run_bh { vm_start } loadvm_postcopy_ram_handle_discard { postcopy_ram_prepare_discard } loadvm_process_command { switch (cmd) } loadvm_process_enable_colo { colo_init_ram_cache } qemu_loadvm_approve_switchover { migrate_send_rp_switchover_ack } qemu_loadvm_load_thread { data->function } qemu_loadvm_section_part_end { vmstate_load } qemu_loadvm_section_start_full { vmstate_load } qemu_loadvm_start_load_thread { thread_pool_submit } qemu_loadvm_state_cleanup { se->ops->load_cleanup } qemu_loadvm_state_header { QEMU_VM_FILE_MAGIC } qemu_loadvm_thread_pool_create { thread_pool_new } qemu_loadvm_thread_pool_destroy { thread_pool_free } qemu_loadvm_thread_pool_wait { thread_pool_wait } qemu_savevm_command_send { QEMU_VM_COMMAND } qemu_savevm_send_colo_enable { MIG_CMD_ENABLE_COLO } qemu_savevm_send_configuration { vmstate_save_state(&vmstate_configuration) } qemu_savevm_send_header { QEMU_VM_FILE_MAGIC } qemu_savevm_state_end { QEMU_VM_EOF } qemu_savevm_state_non_iterable { vmstate_save } qemu_savevm_state_setup { se->ops->save_setup } qemu_savevm_state_vm_desc { QEMU_VM_VMDESCRIPTION } register_savevm_live { savevm_state_handler_insert } save_section_footer { QEMU_VM_SECTION_FOOTER } save_section_header { section_type } savevm_state_handler_insert { QTAILQ_INSERT_TAIL } savevm_state_handler_remove { QTAILQ_REMOVE } unregister_savevm { savevm_state_handler_remove } vmstate_register_with_alias_id { savevm_state_handler_insert } vmstate_save { vmstate_save_old_style; vmstate_save_state } vmstate_unregister { savevm_state_handler_remove }