qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Hao Xiang <hao.xiang@bytedance.com>
Cc: pbonzini@redhat.com, berrange@redhat.com, eduardo@habkost.net,
	farosas@suse.de, eblake@redhat.com, armbru@redhat.com,
	thuth@redhat.com, lvivier@redhat.com, jdenemar@redhat.com,
	marcel.apfelbaum@gmail.com, philmd@linaro.org,
	wangyanan55@huawei.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v4 2/7] migration/multifd: Implement zero page transmission on the multifd thread.
Date: Mon, 4 Mar 2024 15:16:30 +0800	[thread overview]
Message-ID: <ZeV1TrOvERHN_LOo@x1n> (raw)
In-Reply-To: <20240301022829.3390548-3-hao.xiang@bytedance.com>

On Fri, Mar 01, 2024 at 02:28:24AM +0000, Hao Xiang wrote:
> -GlobalProperty hw_compat_8_2[] = {};
> +GlobalProperty hw_compat_8_2[] = {
> +    { "migration", "zero-page-detection", "legacy"},
> +};

I hope we can make it for 9.0, then this (and many rest places) can be kept
as-is.  Let's see..  soft-freeze is March 12th.

One thing to mention is I just sent a pull which has mapped-ram feature
merged.  You may need a rebase onto that, and hopefully mapped-ram can also
use your feature too within the same patch when you repost.

https://lore.kernel.org/all/20240229153017.2221-1-farosas@suse.de/

That rebase may or may not need much caution, I apologize for that:
mapped-ram as a feature was discussed 1+ years, so it was a plan to merge
it (actually still partly of it) into QEMU 9.0.

[...]

> +static bool multifd_zero_page(void)

multifd_zero_page_enabled()?

> +{
> +    return migrate_zero_page_detection() == ZERO_PAGE_DETECTION_MULTIFD;
> +}
> +
> +static void swap_page_offset(ram_addr_t *pages_offset, int a, int b)
> +{
> +    ram_addr_t temp;
> +
> +    if (a == b) {
> +        return;
> +    }
> +
> +    temp = pages_offset[a];
> +    pages_offset[a] = pages_offset[b];
> +    pages_offset[b] = temp;
> +}
> +
> +/**
> + * multifd_send_zero_page_check: Perform zero page detection on all pages.
> + *
> + * Sorts normal pages before zero pages in p->pages->offset and updates
> + * p->pages->normal_num.
> + *
> + * @param p A pointer to the send params.

Nit: the majority of doc style in QEMU (it seems to me) is:

  @p: pointer to @MultiFDSendParams.

> + */
> +void multifd_send_zero_page_check(MultiFDSendParams *p)

multifd_send_zero_page_detect()?

This patch used "check" on both sides, but neither of them is a pure check
to me.  For the other side, maybe multifd_recv_zero_page_process()?  As
that one applies the zero pages.

> +{
> +    MultiFDPages_t *pages = p->pages;
> +    RAMBlock *rb = pages->block;
> +    int i = 0;
> +    int j = pages->num - 1;
> +
> +    /*
> +     * QEMU older than 9.0 don't understand zero page
> +     * on multifd channel. This switch is required to
> +     * maintain backward compatibility.
> +     */

IMHO we can drop this comment; it is not accurate as the user can disable
it explicitly through the parameter, then it may not always about compatibility.

> +    if (multifd_zero_page()) {

Shouldn't this be "!multifd_zero_page_enabled()"?

> +        pages->normal_num = pages->num;
> +        return;
> +    }

The rest looks all sane.

Thanks,

-- 
Peter Xu



  parent reply	other threads:[~2024-03-04  7:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01  2:28 [PATCH v4 0/7] Introduce multifd zero page checking Hao Xiang
2024-03-01  2:28 ` [PATCH v4 1/7] migration/multifd: Add new migration option zero-page-detection Hao Xiang
2024-03-01  7:24   ` Markus Armbruster
2024-03-04  7:01   ` Peter Xu
2024-03-01  2:28 ` [PATCH v4 2/7] migration/multifd: Implement zero page transmission on the multifd thread Hao Xiang
2024-03-01  7:28   ` Markus Armbruster
2024-03-01 22:49     ` [External] " Hao Xiang
2024-03-04  7:16   ` Peter Xu [this message]
2024-03-04 13:17     ` Fabiano Rosas
2024-03-04 14:31       ` Fabiano Rosas
2024-03-04 14:39         ` Fabiano Rosas
2024-03-04 18:24       ` Fabiano Rosas
     [not found]         ` <CAAYibXiLLztnPnKkGZKgXpD8HfSsFqdmhUGcETpzQDUoURRNwg@mail.gmail.com>
2024-03-09  8:08           ` hao.xiang
     [not found]     ` <CAAYibXi0xjpwayO1u8P4skjpeOuUteyuRmrhFHmjFwoRF2JWJg@mail.gmail.com>
2024-03-09  2:37       ` [External] " hao.xiang
2024-03-01  2:28 ` [PATCH v4 3/7] migration/multifd: Implement ram_save_target_page_multifd to handle multifd version of MigrationOps::ram_save_target_page Hao Xiang
2024-03-04  7:46   ` Peter Xu
     [not found]     ` <CAAYibXhCzozRhHxp2Dk3L9BMhFhZtqyvgbwkj+8ZGMCHURZGug@mail.gmail.com>
2024-03-09  2:06       ` hao.xiang
2024-03-11 13:20         ` Peter Xu
2024-03-11 18:02           ` hao.xiang
2024-03-01  2:28 ` [PATCH v4 4/7] migration/multifd: Enable multifd zero page checking by default Hao Xiang
2024-03-04  7:20   ` Peter Xu
2024-03-01  2:28 ` [PATCH v4 5/7] migration/multifd: Add new migration test cases for legacy zero page checking Hao Xiang
2024-03-04  7:23   ` Peter Xu
2024-03-01  2:28 ` [PATCH v4 6/7] migration/multifd: Add zero pages and zero bytes counter to migration status interface Hao Xiang
2024-03-01  7:40   ` Markus Armbruster
     [not found]     ` <CAAYibXjyMT5YJqOcDheDUB1qzi+JjFhAcv3L57zM9pCFMGbYbw@mail.gmail.com>
2024-03-09  6:56       ` [External] " hao.xiang
2024-03-01  2:28 ` [PATCH v4 7/7] Update maintainer contact for migration multifd zero page checking acceleration Hao Xiang
2024-03-04  7:34   ` Peter Xu
     [not found]     ` <CAAYibXjoji3GY7TW_USFsuT3YyVnv_kGFXpvBgK_kf9i1S1VSw@mail.gmail.com>
2024-03-09  8:13       ` hao.xiang

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=ZeV1TrOvERHN_LOo@x1n \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=farosas@suse.de \
    --cc=hao.xiang@bytedance.com \
    --cc=jdenemar@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wangyanan55@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).