qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Joao Martins <joao.m.martins@oracle.com>
Cc: qemu-devel@nongnu.org, "Zhiyi Guo" <zhguo@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Leonardo Bras Soares Passos" <lsoaresp@redhat.com>,
	"Fabiano Rosas" <farosas@suse.de>,
	"Juan Quintela" <quintela@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Chensheng Dong" <chdong@redhat.com>
Subject: Re: [PATCH for-8.2 v2 2/2] migration: Allow user to specify migration switchover bandwidth
Date: Tue, 5 Sep 2023 11:31:15 -0400	[thread overview]
Message-ID: <ZPdJwx7hg41GXRle@x1n> (raw)
In-Reply-To: <ec2f4daa-f094-a1b4-107c-509e21aa4553@oracle.com>

On Fri, Sep 01, 2023 at 07:39:07PM +0100, Joao Martins wrote:
> 
> 
> On 01/09/2023 18:59, Joao Martins wrote:
> > On 03/08/2023 16:53, Peter Xu wrote:
> >> @@ -2694,7 +2694,17 @@ static void migration_update_counters(MigrationState *s,
> >>      transferred = current_bytes - s->iteration_initial_bytes;
> >>      time_spent = current_time - s->iteration_start_time;
> >>      bandwidth = (double)transferred / time_spent;
> >> -    s->threshold_size = bandwidth * migrate_downtime_limit();
> >> +    if (migrate_max_switchover_bandwidth()) {
> >> +        /*
> >> +         * If the user specified an available bandwidth, let's trust the
> >> +         * user so that can be more accurate than what we estimated.
> >> +         */
> >> +        avail_bw = migrate_max_switchover_bandwidth();
> >> +    } else {
> >> +        /* If the user doesn't specify bandwidth, we use the estimated */
> >> +        avail_bw = bandwidth;
> >> +    }
> >> +    s->threshold_size = avail_bw * migrate_downtime_limit();
> >>  
> > 
> > [ sorry for giving review comments in piecemeal :/ ]

This is never a problem.

> > 
> > There might be something odd with the calculation. It would be right if
> > downtime_limit was in seconds. But we are multipling a value that is in
> > bytes/sec with a time unit that is in miliseconds. When avail_bw is set to
> > switchover_bandwidth, it sounds to me this should be a:
> > 
> > 	/* bytes/msec; @max-switchover-bandwidth is per-seconds */
> > 	avail_bw = migrate_max_switchover_bandwidth() / 1000.0;
> > 
> > Otherwise it looks like that we end up overestimating how much we can still send
> > during switchover? If this is correct and I am not missing some assumption, 
> 
> (...)
> 
> > then
> > same is applicable to the threshold_size calculation in general without
> > switchover-bandwidth but likely in a different way:
> > 
> > 	/* bytes/msec; but @bandwidth is calculated in 100msec quantas */
> > 	avail_bw = bandwidth / 100.0;
> > 
> 
> Nevermind this part. I was wrong in the @bandwidth adjustment as it is already
> calculated in bytes/ms. It's max_switchover_bandwidth that needs an adjustment
> it seems.
> 
> > There's a very good chance I'm missing details, so apologies beforehand on
> > wasting your time if I didn't pick up on it through the code.

My fault, thanks for catching this.  So it seems even if the test will
switchover with this patch, it might be too aggresive if we calculate with
a number 1000x larger than the real bandwidth provided..

I'll rename this to expected_bw_per_ms to be clear when repost, too.

Thanks,

-- 
Peter Xu



      reply	other threads:[~2023-09-05 15:32 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 15:53 [PATCH for-8.2 v2 0/2] migration: Add max-switchover-bandwidth parameter Peter Xu
2023-08-03 15:53 ` [PATCH for-8.2 v2 1/2] qapi/migration: Deduplicate migration parameter field comments Peter Xu
2023-08-04 12:28   ` Markus Armbruster
2023-08-04 13:59     ` Daniel P. Berrangé
2023-08-04 16:01       ` Peter Xu
2023-08-04 16:29         ` Daniel P. Berrangé
2023-08-04 16:46           ` Peter Xu
2023-08-04 16:48             ` Daniel P. Berrangé
2023-08-04 21:02               ` Peter Xu
2023-08-05  8:12                 ` Markus Armbruster
2023-08-06 15:49                   ` Peter Xu
2023-08-08 20:03                     ` Peter Xu
2023-08-14 22:24                       ` Peter Xu
2023-08-03 15:53 ` [PATCH for-8.2 v2 2/2] migration: Allow user to specify migration switchover bandwidth Peter Xu
2023-08-31 18:14   ` Joao Martins
2023-08-31 18:34     ` Peter Xu
2023-09-01  6:55   ` Wang, Lei
2023-09-01  8:37     ` Daniel P. Berrangé
2023-09-01 14:40       ` Peter Xu
2023-09-05 16:46       ` Peter Xu
2023-09-05 17:39         ` Daniel P. Berrangé
2023-09-06  2:27         ` Wang, Lei
2023-09-01 17:59   ` Joao Martins
2023-09-01 18:39     ` Joao Martins
2023-09-05 15:31       ` 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=ZPdJwx7hg41GXRle@x1n \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=chdong@redhat.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=joao.m.martins@oracle.com \
    --cc=lsoaresp@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=zhguo@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.
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).