public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 2/2] migrate, flow: Don't attempt to migrate TCP flows without passt-repair
Date: Thu, 20 Feb 2025 09:07:26 +0100	[thread overview]
Message-ID: <20250220090726.43432475@elisabeth> (raw)
In-Reply-To: <20250220060318.1796504-3-david@gibson.dropbear.id.au>

On Thu, 20 Feb 2025 17:03:18 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> Migrating TCP flows requires passt-repair in order to use TCP_REPAIR.  If
> passt-repair is not started, our failure mode is pretty ugly though: we'll
> attempt the migration, hitting various problems when we can't enter repair
> mode.  In some cases we may not roll back these changes properly, meaning
> we break network connections on the source.
> 
> Our general approach is not to completely block migration if there are
> problems, but simply to break any flows we can't migrate.  So, if we have
> no connection from passt-repair carry on with the migration, but don't
> attempt to migrate any TCP connections.
> 
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>  flow.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/flow.c b/flow.c
> index 6cf96c26..749c4984 100644
> --- a/flow.c
> +++ b/flow.c
> @@ -923,6 +923,10 @@ static int flow_migrate_repair_all(struct ctx *c, bool enable)
>  	union flow *flow;
>  	int rc;
>  
> +	/* If we don't have a repair helper, there's nothing we can do */
> +	if (c->fd_repair < 0)
> +		return 0;
> +

This doesn't fix the behaviour in a relatively likely failure mode:
passt-repair is there, but we can't communicate to it (LSM policy
issues or similar).

In that case, unconditionally terminating on failure in the rollback
function:

		if (tcp_flow_repair_off(c, &flow->tcp))
			die("Failed to roll back TCP_REPAIR mode");

	if (repair_flush(c))
		die("Failed to roll back TCP_REPAIR mode");

isn't a very productive thing to do: we go from an uneventful failure
where flows were not affected at all to a guest left without
connectivity.

That starts looking less robust than the alternative (e.g. what I
implemented in v12: silently fail and continue) at least without
https://patchew.org/QEMU/20250217092550.1172055-1-lvivier@redhat.com/
in a general case as well: if we continue, we'll have hanging flows
that will expire on timeout, but if we don't, again, we'll have a
guest without connectivity.

I understand that leaving flows around for that long might present a
relevant inconsistency, though.

So I'm wondering about some alternatives: actually, the rollback
function shouldn't be called at all in this case. Or it could just
(indirectly) call tcp_rst() on all the flows that were possibly
affected.

-- 
Stefano


  reply	other threads:[~2025-02-20  8:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20  6:03 [PATCH 0/2] RFC: More graceful handling of migration without passt-repair (UNTESTED) David Gibson
2025-02-20  6:03 ` [PATCH 1/2] migrate, flow: Trivially succeed if migrating with no flows David Gibson
2025-02-20  6:03 ` [PATCH 2/2] migrate, flow: Don't attempt to migrate TCP flows without passt-repair David Gibson
2025-02-20  8:07   ` Stefano Brivio [this message]
2025-02-20 10:18     ` David Gibson
2025-02-20 10:38       ` Stefano Brivio
2025-02-21  2:40         ` David Gibson
2025-02-21  5:59           ` Stefano Brivio
2025-02-21  6:37             ` David Gibson
2025-02-21  7:03               ` Stefano Brivio

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=20250220090726.43432475@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /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).