From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org,
"Maciej S . Szmigiero" <mail@maciej.szmigiero.name>
Subject: Re: [PATCH v3 07/14] migration/multifd: Replace p->pages with an union pointer
Date: Wed, 21 Aug 2024 17:27:44 -0400 [thread overview]
Message-ID: <ZsZb0JTNn8P-KQAu@x1n> (raw)
In-Reply-To: <20240801123516.4498-8-farosas@suse.de>
On Thu, Aug 01, 2024 at 09:35:09AM -0300, Fabiano Rosas wrote:
> We want multifd to be able to handle more types of data than just ram
> pages. To start decoupling multifd from pages, replace p->pages
> (MultiFDPages_t) with the new type MultiFDSendData that hides the
> client payload inside an union.
>
> The general idea here is to isolate functions that *need* to handle
> MultiFDPages_t and move them in the future to multifd-ram.c, while
> multifd.c will stay with only the core functions that handle
> MultiFDSendData/MultiFDRecvData.
>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
[...]
> +static MultiFDSendData *multifd_send_data_alloc(void)
> +{
> + size_t max_payload_size, size_minus_payload;
> +
> + /*
> + * MultiFDPages_t has a flexible array at the end, account for it
> + * when allocating MultiFDSendData. Use max() in case other types
> + * added to the union in the future are larger than
> + * (MultiFDPages_t + flex array).
> + */
> + max_payload_size = MAX(multifd_ram_payload_size(), sizeof(MultiFDPayload));
> +
> + /*
> + * Account for any holes the compiler might insert. We can't pack
> + * the structure because that misaligns the members and triggers
> + * Waddress-of-packed-member.
> + */
> + size_minus_payload = sizeof(MultiFDSendData) - sizeof(MultiFDPayload);
> +
> + return g_malloc0(size_minus_payload + max_payload_size);
> +}
Hmm I didn't notice the hole issue for sure..
For the mid term we really should remove this in one way or another.. what
I was thinking is mentioned in the other thread:
https://lore.kernel.org/qemu-devel/ZsZZFwws5tlOMmZk@x1n/
I hope we can simply statically define offset[] to be the max.
I don't think we must stick with size-per-packet, in this case IMHO we
should choose whatever is easier for us, and I never worried on regression
yet so far as long as the relevant n_pages is still relatively large. Not
to mention AFAIU for production use, x86/s390 always uses 4K psize, while
arm64 doesn't yet have a stable kvm-avail vcpu model, which might be a
bigger issue as of now to solve..
Let's see how it goes..
--
Peter Xu
next prev parent reply other threads:[~2024-08-21 21:29 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 12:35 [PATCH v3 00/14] migration/multifd: Remove multifd_send_state->pages Fabiano Rosas
2024-08-01 12:35 ` [PATCH v3 01/14] migration/multifd: Reduce access to p->pages Fabiano Rosas
2024-08-01 12:35 ` [PATCH v3 02/14] migration/multifd: Inline page_size and page_count Fabiano Rosas
2024-08-21 20:25 ` Peter Xu
2024-08-01 12:35 ` [PATCH v3 03/14] migration/multifd: Remove pages->allocated Fabiano Rosas
2024-08-21 20:32 ` Peter Xu
2024-08-01 12:35 ` [PATCH v3 04/14] migration/multifd: Pass in MultiFDPages_t to file_write_ramblock_iov Fabiano Rosas
2024-08-01 12:35 ` [PATCH v3 05/14] migration/multifd: Introduce MultiFDSendData Fabiano Rosas
2024-08-01 12:35 ` [PATCH v3 06/14] migration/multifd: Make MultiFDPages_t:offset a flexible array member Fabiano Rosas
2024-08-21 20:38 ` Peter Xu
2024-08-01 12:35 ` [PATCH v3 07/14] migration/multifd: Replace p->pages with an union pointer Fabiano Rosas
2024-08-21 21:27 ` Peter Xu [this message]
2024-08-01 12:35 ` [PATCH v3 08/14] migration/multifd: Move pages accounting into multifd_send_zero_page_detect() Fabiano Rosas
2024-08-01 12:35 ` [PATCH v3 09/14] migration/multifd: Isolate ram pages packet data Fabiano Rosas
2024-08-21 21:38 ` Peter Xu
2024-08-22 14:13 ` Fabiano Rosas
2024-08-22 14:30 ` Peter Xu
2024-08-22 14:55 ` Fabiano Rosas
2024-08-01 12:35 ` [PATCH v3 10/14] migration/multifd: Don't send ram data during SYNC Fabiano Rosas
2024-08-22 15:50 ` Peter Xu
2024-08-01 12:35 ` [PATCH v3 11/14] migration/multifd: Replace multifd_send_state->pages with client data Fabiano Rosas
2024-08-22 15:59 ` Peter Xu
2024-08-01 12:35 ` [PATCH v3 12/14] migration/multifd: Allow multifd sync without flush Fabiano Rosas
2024-08-22 16:03 ` Peter Xu
2024-08-22 16:10 ` Peter Xu
2024-08-22 17:05 ` Fabiano Rosas
2024-08-22 17:36 ` Peter Xu
2024-08-22 18:07 ` Fabiano Rosas
2024-08-22 19:11 ` Peter Xu
2024-08-01 12:35 ` [PATCH v3 13/14] migration/multifd: Register nocomp ops dynamically Fabiano Rosas
2024-08-22 16:23 ` Peter Xu
2024-08-22 17:20 ` Fabiano Rosas
2024-08-01 12:35 ` [PATCH v3 14/14] migration/multifd: Move ram code into multifd-ram.c Fabiano Rosas
2024-08-22 16:25 ` Peter Xu
2024-08-22 17:21 ` Fabiano Rosas
2024-08-22 17:27 ` Peter Xu
2024-08-01 12:45 ` [PATCH v3 00/14] migration/multifd: Remove multifd_send_state->pages Fabiano Rosas
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=ZsZb0JTNn8P-KQAu@x1n \
--to=peterx@redhat.com \
--cc=farosas@suse.de \
--cc=mail@maciej.szmigiero.name \
--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 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).