public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 6/6] migrate: Make migration handlers simpler and more flexible
Date: Tue, 4 Feb 2025 10:55:28 +1100	[thread overview]
Message-ID: <Z6FXcDugIzWdF_WD@zatzit> (raw)
In-Reply-To: <20250203112003.1bcc7acd@elisabeth>

[-- Attachment #1: Type: text/plain, Size: 2153 bytes --]

On Mon, Feb 03, 2025 at 11:20:03AM +0100, Stefano Brivio wrote:
> On Mon,  3 Feb 2025 20:26:15 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > +/* Stages for version 1 */
> > +static const struct migrate_stage stages_v1[] = {
> > +	{
> > +		.name = "flow pre",
> > +		.source = flow_migrate_source_pre,
> > +		.target = NULL,
> > +	},
> > +	DATA_STAGE(flow_first_free),
> > +	DATA_STAGE(flowtab),
> > +	DATA_STAGE(flow_hashtab),
> > +	DATA_STAGE(g_hash_secret),
> 
> ...so this one for g_hash_secret (which is the abomination I wanted
> to drop) would eventually turn into a function?

Yes.

> It looks neat, I'm just not sure if we'll really have "data stages"
> after I change the approach to only transfer the data we need as you
> suggested.

I agree, that may well be the case, but we can just drop the macro and
helepr functions then.

> Is that part of your pending queue by the way, or should I go ahead with
> it?

Is which part of my pending queue?  g_hash_secret as a function?  No,
I've thought of it, but I haven't written it yet.

> 
> > [...]
> >
> >  /**
> > - * struct migrate_data - Data sections for given source version
> > - * @v:			Source version this applies to, host order
> > - * @sections:		Array of data sections, NULL-terminated
> > + * migrate_cb_t - Callback function to implement one migration stage
> >   */
> > -struct migrate_data {
> > -	uint32_t v;
> > -	struct iovec *sections;
> > -};
> > +typedef int (*migrate_cb_t)(struct ctx *c, struct migrate_meta *m,
> > +			    const struct migrate_stage *stage, int fd);
> 
> typedef is really annoying, we already have a flow_sidx which kind of
> made sense, but this has really no advantage over something like:

Eh, I guess.  I find the extra . or -> a little annoying, but we can
do this if you'd prefer.

> struct migrate_handler {
> 	int (*fn)(struct ctx *c, struct migrate_meta *m);
> };
> 

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-02-03 23:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03  9:26 [PATCH 0/6] More migration improvements David Gibson
2025-02-03  9:26 ` [PATCH 1/6] vhost-user: Change different vhost-user messages to trace() level David Gibson
2025-02-04  0:42   ` Stefano Brivio
2025-02-03  9:26 ` [PATCH 2/6] migrate, flow: Abort migration on repair_flush() failure David Gibson
2025-02-03  9:26 ` [PATCH 3/6] migrate: Clearer debug message in migrate_request() David Gibson
2025-02-03  9:26 ` [PATCH 4/6] migrate: Handle sending header section from data sections David Gibson
2025-02-03  9:26 ` [PATCH 5/6] util: read_remainder should take const pointer to iovec David Gibson
2025-02-04  0:42   ` Stefano Brivio
2025-02-03  9:26 ` [PATCH 6/6] migrate: Make migration handlers simpler and more flexible David Gibson
2025-02-03 10:20   ` Stefano Brivio
2025-02-03 23:55     ` David Gibson [this message]
2025-02-04  0:12       ` Stefano Brivio
2025-02-04  3:36         ` David Gibson

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=Z6FXcDugIzWdF_WD@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).