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: [RFC PATCH v2 0/9] migration/multifd: Remove multifd_send_state->pages
Date: Tue, 23 Jul 2024 17:11:41 -0400 [thread overview]
Message-ID: <ZqAcjYU-86NNbZZX@x1n> (raw)
In-Reply-To: <87zfq7ygrz.fsf@suse.de>
On Tue, Jul 23, 2024 at 05:50:24PM -0300, Fabiano Rosas wrote:
> The natural thing would be to put the hooks inside the data
> type. Something like this:
>
> struct MultiFDRecvData {
> MultiFDMethods *ops; <---
> void *opaque;
> size_t size;
> /* for preadv */
> off_t file_offset;
> };
>
> struct MultiFDSendData {
> MultiFDPayloadType type;
> MultiFDMethods *ops; <---
> union {
> MultiFDPages_t ram;
> } u;
> };
>
> multifd_ram_save_setup()
> {
> multifd_ram_send = multifd_send_data_alloc();
> multifd_register_ops(multifd_ram_send, &multifd_ram_ops);
> }
>
> void multifd_register_ops(MultiFDSendData *data, MultiFDMethods *ops)
> {
> if (data->type == RAM) {
> method = migrate_multifd_compression();
> assert(0 < method && method < MULTIFD_COMPRESSION__MAX);
> ops = multifd_ops[method];
> }
>
> data->ops = ops;
> }
>
> I'm just not sure whether we have some compiler cleverness optimizing
> these function pointer accesses due to multifd_send_state being static
> and multifd_send_state->ops being unchanged throughout the
> migration. But AFAICS, the proposal above is almost the same thing as we
> already have.
Right, this looks as pretty when you can put the ops inside, and iff the
perf goes as well. E.g., you'll need to register the Ops for each batch
too, besides the pointer jumps. You'll also need to check the hooks one by
one, even if we know most of them will be noop at least for VFIO.
IMHO it's a matter of whether the Ops is useful to VFIO / other devices
first in the forseeable future. My current gut feeling is they're mostly
not usable.. while supporting device state with an opaque buffer to send /
recv, plus a pretty static device state protocol seems relatively easy to
do.
--
Peter Xu
prev parent reply other threads:[~2024-07-23 21:12 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 17:59 [RFC PATCH v2 0/9] migration/multifd: Remove multifd_send_state->pages Fabiano Rosas
2024-07-22 17:59 ` [RFC PATCH v2 1/9] migration/multifd: Reduce access to p->pages Fabiano Rosas
2024-07-22 17:59 ` [RFC PATCH v2 2/9] migration/multifd: Pass in MultiFDPages_t to file_write_ramblock_iov Fabiano Rosas
2024-07-22 19:21 ` Peter Xu
2024-07-22 17:59 ` [RFC PATCH v2 3/9] migration/multifd: Introduce MultiFDSendData Fabiano Rosas
2024-07-22 19:22 ` Peter Xu
2024-07-22 17:59 ` [RFC PATCH v2 4/9] migration/multifd: Make MultiFDPages_t:offset a flexible array member Fabiano Rosas
2024-07-22 19:20 ` Peter Xu
2024-07-22 20:36 ` Fabiano Rosas
2024-07-22 17:59 ` [RFC PATCH v2 5/9] migration/multifd: Replace p->pages with an union pointer Fabiano Rosas
2024-07-22 17:59 ` [RFC PATCH v2 6/9] migration/multifd: Move pages accounting into multifd_send_zero_page_detect() Fabiano Rosas
2024-07-22 19:29 ` Peter Xu
2024-07-22 20:07 ` Fabiano Rosas
2024-07-22 20:38 ` Peter Xu
2024-07-22 17:59 ` [RFC PATCH v2 7/9] migration/multifd: Isolate ram pages packet data Fabiano Rosas
2024-07-22 19:37 ` Peter Xu
2024-07-22 20:34 ` Fabiano Rosas
2024-07-22 21:06 ` Peter Xu
2024-07-24 9:30 ` Maciej S. Szmigiero
2024-07-22 17:59 ` [RFC PATCH v2 8/9] migration/multifd: Don't send ram data during SYNC Fabiano Rosas
2024-07-22 21:03 ` Peter Xu
2024-07-22 21:24 ` Fabiano Rosas
2024-07-22 17:59 ` [RFC PATCH v2 9/9] migration/multifd: Replace multifd_send_state->pages with client data Fabiano Rosas
2024-07-22 19:55 ` Peter Xu
2024-07-22 20:26 ` Fabiano Rosas
2024-07-22 20:41 ` Peter Xu
2024-07-22 19:58 ` [RFC PATCH v2 0/9] migration/multifd: Remove multifd_send_state->pages Peter Xu
2024-07-22 20:21 ` Fabiano Rosas
2024-07-22 20:54 ` Peter Xu
2024-07-22 21:20 ` Fabiano Rosas
2024-07-22 23:01 ` Peter Xu
2024-07-23 17:48 ` Fabiano Rosas
2024-07-23 18:20 ` Peter Xu
2024-07-23 20:50 ` Fabiano Rosas
2024-07-23 21:11 ` Peter Xu [this message]
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=ZqAcjYU-86NNbZZX@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).