From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18E9DEB64DB for ; Thu, 15 Jun 2023 13:35:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q9n7M-0008Oj-Dc; Thu, 15 Jun 2023 09:34:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q9jyi-0006st-CA for qemu-devel@nongnu.org; Thu, 15 Jun 2023 06:13:24 -0400 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q9jyf-0004f6-87 for qemu-devel@nongnu.org; Thu, 15 Jun 2023 06:13:20 -0400 Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-39a505b901dso4682320b6e.0 for ; Thu, 15 Jun 2023 03:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20221208.gappssmtp.com; s=20221208; t=1686823994; x=1689415994; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PaSqevC+d57LNLHXFi5Bt7ZRuwojxy8DW7Pqvd0xai4=; b=PCbiojSwCulbxY90kV3DkWBK2LT9CqnxmuhuPvWEhOLBgc3+GlYWXrDQs0CfWSdfk5 GFwDtI35BHggbNBZrW2H09/6XIZbEJJh+od3t5VtXT3yo6+hwhelNCYS9oRnwZlxY8Co ReZEIr4b9HPiSWvW/o7S9uHbF78ZZs9O1/jQET3r8e1ahK+Cyt5bVgFiXnxwiSH0/5ry 0kZJwII/pH58oEXPtLrRijL/ftDALsqaYjqk5CNdhVruzQw4nR0Cuz5gr1AFO4uSxY7c wVsK94i0PWFghDsDW9m18H9SKeKqY8zBs3Cu2md2LvnzOF5jtTmwi6BrO8S2MHllE6XK qAyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686823994; x=1689415994; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PaSqevC+d57LNLHXFi5Bt7ZRuwojxy8DW7Pqvd0xai4=; b=a31xcPMBxqDCyeNz3/Q4ULzQYwC/aCozDTujRxxInmYiDa/C8rqsZhuu+MWQVWfAts Ieguy+cwaJxKzaKh4wVZd9q7gHB0gu8zI6V++iTwAvyPSBaOcIsi1sSLmihFkwDeBQEr g/99ImnlicudAJE500os478u7KEupnTFlpoAAWrNkJB5bQcUM9TpLnpnjL+RNlmTEe41 PWSUZLtY+D5Xd8nPG1ZiT4yfMXR6KhlQtvxzoaF8/8XkU6Ip6YK4Jw+9t89PdP9Ph7lO L4HGF6L4DEKCLgmuj1IYBnVCwG4yWllfejFpYPlUWcJXc0hVwb9as4uJxuiqRlXU4B5k 5sFQ== X-Gm-Message-State: AC+VfDxmkBpCgUTPbZDN3cYiZO6G9qXeNk48JlZF1waNjk19oGpVGBp2 iJYWTtaPlOs3weBt9kP8Xy3Q+N5sU3LCPJD4epUqUg== X-Google-Smtp-Source: ACHHUZ7lWSJw+yH38vP2wGgUfP9ddMkj3e392aEmgpdmmIC7r54TAYCwNxCGJo+vMF6hKQcPNzU3Bhf0MZ6Ok50x7fQ= X-Received: by 2002:a05:6808:1405:b0:398:5893:f0c5 with SMTP id w5-20020a056808140500b003985893f0c5mr17038132oiv.37.1686823994136; Thu, 15 Jun 2023 03:13:14 -0700 (PDT) MIME-Version: 1.0 References: <168618975839.6361.17407633874747688653-6@git.sr.ht> <87ttvbckv3.fsf@secure.mitica> In-Reply-To: <87ttvbckv3.fsf@secure.mitica> From: Yong Huang Date: Thu, 15 Jun 2023 18:12:57 +0800 Message-ID: Subject: Re: [PATCH QEMU v5 6/8] migration: Implement dirty-limit convergence algo To: quintela@redhat.com Cc: "~hyman" , qemu-devel , Peter Xu , Paolo Bonzini , "Dr. David Alan Gilbert" , Eric Blake , Markus Armbruster , Thomas Huth , Laurent Vivier , Richard Henderson , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Content-Type: multipart/alternative; boundary="000000000000f8328a05fe285028" Received-SPF: none client-ip=2607:f8b0:4864:20::231; envelope-from=yong.huang@smartx.com; helo=mail-oi1-x231.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 15 Jun 2023 09:34:24 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org --000000000000f8328a05fe285028 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jun 14, 2023 at 1:50=E2=80=AFAM Juan Quintela = wrote: > ~hyman wrote: > > From: Hyman Huang(=E9=BB=84=E5=8B=87) > > To speed thinkng up, 1-5 are included on next Migration PULL request. > OK, I'll post the next version only contain the last 3 commits. > > Implement dirty-limit convergence algo for live migration, > > which is kind of like auto-converge algo but using dirty-limit > > instead of cpu throttle to make migration convergent. > > > > Enable dirty page limit if dirty_rate_high_cnt greater than 2 > > when dirty-limit capability enabled, Disable dirty-limit if > > migration be cancled. > > Nit: canceled. get it. > > > > Note that "set_vcpu_dirty_limit", "cancel_vcpu_dirty_limit" > > commands are not allowed during dirty-limit live migration. > > > > Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) > > Signed-off-by: Markus Armbruster > > > > + * Enable dirty-limit to throttle down the guest > > + */ > > +static void migration_dirty_limit_guest(void) > > +{ > > + static int64_t quota_dirtyrate; > > quota_dirtyrate deserves at least a comment. > > I guess it means the current quota_dirty_rate that is set, but no clue. OK. I'll comment it next version. > > > + MigrationState *s =3D migrate_get_current(); > > + > > + /* > > + * If dirty limit already enabled and migration parameter > > + * vcpu-dirty-limit untouched. > > + */ > > + if (dirtylimit_in_service() && > > + quota_dirtyrate =3D=3D s->parameters.vcpu_dirty_limit) { > > + return; > > + } > > + > > + quota_dirtyrate =3D s->parameters.vcpu_dirty_limit; > > + > > + /* Set or update quota dirty limit */ > > + qmp_set_vcpu_dirty_limit(false, -1, quota_dirtyrate, NULL); > > Care to explain why do we have to "reset" the quota? Or why we can't > set it when the user issues the command, only when we throttle the guest? Indeed, -1 is misleading, the first parameter means the set all vcpu a quota dirtyrate, and the second parameter is meaningless if the first parameter is false. The comment will be like this next version? /* Set all vCPU a quota dirtyrate, note that the second parameter will be ignored if setting all vCPU for a vm. */ > > + trace_migration_dirty_limit_guest(quota_dirtyrate); > > +} > > + > > Split this patch in two: > > a - the logic change > b - the introduction of dirty limit. > > Ok, get it. > > Old code: > > /* During block migration the auto-converge logic incorrectly detects > * that ram migration makes no progress. Avoid this by disabling the > * throttling logic during the bulk phase of block migration. */ > if (blk_mig_bulk_active()) { > return; > } > > if (migrate_auto_converge()) { > /* The following detection logic can be refined later. For now: > Check to see if the ratio between dirtied bytes and the approx= . > amount of bytes that just got transferred since the last time > we were in this routine reaches the threshold. If that happens > twice, start or increase throttling. */ > > if ((bytes_dirty_period > bytes_dirty_threshold) && > (++rs->dirty_rate_high_cnt >=3D 2)) { > trace_migration_throttle(); > rs->dirty_rate_high_cnt =3D 0; > mig_throttle_guest_down(bytes_dirty_period, > bytes_dirty_threshold); > } > } > > New code: > /* > * The following detection logic can be refined later. For now: > * Check to see if the ratio between dirtied bytes and the approx. > * amount of bytes that just got transferred since the last time > * we were in this routine reaches the threshold. If that happens > * twice, start or increase throttling. > */ > > if ((bytes_dirty_period > bytes_dirty_threshold) && > (++rs->dirty_rate_high_cnt >=3D 2)) { > rs->dirty_rate_high_cnt =3D 0; > /* > * During block migration the auto-converge logic incorrectly > detects > * that ram migration makes no progress. Avoid this by disabling > the > * throttling logic during the bulk phase of block migration > */ > if (blk_mig_bulk_active()) { > return; > } > > if (migrate_auto_converge()) { > trace_migration_throttle(); > mig_throttle_guest_down(bytes_dirty_period, > bytes_dirty_threshold); > } else if (migrate_dirty_limit()) { > migration_dirty_limit_guest(); > } > } > > Questions: > > - Why are we changing blk_mig_bulk_active() position? > I think that the old code have it in the right place. Additionally, > you just changefd to this version a couple of patches agon. > Yes, indeed, this modification make no sense, i'll fix it next version. > > > > > > int64_t cpu_index, > > Error **errp) > > { > > + MigrationState *ms =3D migrate_get_current(); > > + > > if (!kvm_enabled() || !kvm_dirty_ring_enabled()) { > > return; > > } > > @@ -453,6 +455,15 @@ void qmp_cancel_vcpu_dirty_limit(bool has_cpu_inde= x, > > return; > > } > > > > + if (migration_is_running(ms->state) && > > + (!qemu_thread_is_self(&ms->thread)) && > > + migrate_dirty_limit() && > > + dirtylimit_in_service()) { > > + error_setg(errp, "can't cancel dirty page limit while" > > + " migration is running"); > > Error message is bad or wrong. > You can cancel the dirty page, you ust need to be on the main thread. > > Or I am missing something? > > Migration, IMHO, shares the same quota dirty rate stored in the global variable "dirtylimit_state ", if we cancel the dirty limit, it will make the throttle not work and the migration will be affected. > > > > + return; > > + } > > + > > dirtylimit_state_lock(); > > > > if (has_cpu_index) { > > @@ -488,6 +499,8 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index, > > uint64_t dirty_rate, > > Error **errp) > > { > > + MigrationState *ms =3D migrate_get_current(); > > + > > if (!kvm_enabled() || !kvm_dirty_ring_enabled()) { > > error_setg(errp, "dirty page limit feature requires KVM with" > > " accelerator property 'dirty-ring-size' set'") > > @@ -504,6 +517,15 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index, > > return; > > } > > > > + if (migration_is_running(ms->state) && > > + (!qemu_thread_is_self(&ms->thread)) && > > + migrate_dirty_limit() && > > + dirtylimit_in_service()) { > > + error_setg(errp, "can't cancel dirty page limit while" > > + " migration is running"); > > + return; > > + } > > If you use such a complex expression twice, I think that creating a > helper function is a good idea. > Ok, get it > > Later, Juan. > > Hyman --=20 Best regards --000000000000f8328a05fe285028 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Jun 14, 20= 23 at 1:50=E2=80=AFAM Juan Quintela <quintela@redhat.com> wrote:
~hyman <= ;hyman@git.sr.ht&g= t; wrote:
> From: Hyman Huang(=E9=BB=84=E5=8B=87) <yong.huang@smartx.com>

To speed thinkng up, 1-5 are included on next Migration PULL request.
=C2=A0
=C2=A0OK, I'll post the next version= only contain the last 3 commits.
=C2=A0
> Implement dirty-limit convergence algo for live migration,
> which is kind of like auto-converge algo but using dirty-limit
> instead of cpu throttle to make migration convergent.
>
> Enable dirty page limit if dirty_rate_high_cnt greater than 2
> when dirty-limit capability enabled, Disable dirty-limit if
> migration be cancled.

Nit: canceled.=C2=A0
=C2=A0
= =C2=A0get = it.
>
> Note that "set_vcpu_dirty_limit", "cancel_vcpu_dirty_li= mit"
> commands are not allowed during dirty-limit live migration.
>
> Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) <yong.huang@smartx.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>


> + * Enable dirty-limit to throttle down the guest
> + */
> +static void migration_dirty_limit_guest(void)
> +{
> +=C2=A0 =C2=A0 static int64_t quota_dirtyrate;

quota_dirtyrate deserves at least a comment.

I guess it means the current quota_dirty_rate that is set, but no clue.=C2= =A0
=C2=A0OK. I'll comment it next version.

> +=C2=A0 =C2=A0 MigrationState *s =3D migrate_get_current();
> +
> +=C2=A0 =C2=A0 /*
> +=C2=A0 =C2=A0 =C2=A0* If dirty limit already enabled and migration pa= rameter
> +=C2=A0 =C2=A0 =C2=A0* vcpu-dirty-limit untouched.
> +=C2=A0 =C2=A0 =C2=A0*/
> +=C2=A0 =C2=A0 if (dirtylimit_in_service() &&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 quota_dirtyrate =3D=3D s->parameters.v= cpu_dirty_limit) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
> +=C2=A0 =C2=A0 }
> +
> +=C2=A0 =C2=A0 quota_dirtyrate =3D s->parameters.vcpu_dirty_limit;<= br> > +
> +=C2=A0 =C2=A0 /* Set or update quota dirty limit */
> +=C2=A0 =C2=A0 qmp_set_vcpu_dirty_limit(false, -1, quota_dirtyrate, NU= LL);

Care to explain why do we have to "reset" the quota?=C2=A0 Or why= we can't
set it when the user issues the command, only when we throttle the guest?= =C2=A0
=C2=A0
=C2=A0Indeed, -1 is misleading, the first parameter mea= ns the set all vcpu a=C2=A0
quota dirtyrate,= and the second parameter is meaningless if the first=C2=A0
parameter=C2=A0is false.=C2= =A0
The comment will be like this next version?
/* Set all vCPU a quota dirtyrate, note that the second parameter will= =C2=A0
=C2=A0 =C2=A0 be ignored if setting all vCPU = for a vm.
*/
> +=C2=A0 =C2=A0 trace_migration_dirty_limit_guest(quota_dirtyrate);
> +}
> +

Split this patch in two:

a - the logic change
b - the introduction of dirty limit.

Ok, get it.

Old code:

=C2=A0 =C2=A0 /* During block migration the auto-converge logic incorrectly= detects
=C2=A0 =C2=A0 =C2=A0* that ram migration makes no progress. Avoid this by d= isabling the
=C2=A0 =C2=A0 =C2=A0* throttling logic during the bulk phase of block migra= tion. */
=C2=A0 =C2=A0 if (blk_mig_bulk_active()) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
=C2=A0 =C2=A0 }

=C2=A0 =C2=A0 if (migrate_auto_converge()) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The following detection logic can be refined= later. For now:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Check to see if the ratio between = dirtied bytes and the approx.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0amount of bytes that just got tran= sferred since the last time
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0we were in this routine reaches th= e threshold. If that happens
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0twice, start or increase throttlin= g. */

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((bytes_dirty_period > bytes_dirty_thresh= old) &&
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (++rs->dirty_rate_high_cnt >= ;=3D 2)) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 trace_migration_throttle();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 rs->dirty_rate_high_cnt =3D 0;=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mig_throttle_guest_down(bytes_dir= ty_period,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bytes_dirty_threshold)= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }

New code:
=C2=A0 =C2=A0 /*
=C2=A0 =C2=A0 =C2=A0* The following detection logic can be refined later. F= or now:
=C2=A0 =C2=A0 =C2=A0* Check to see if the ratio between dirtied bytes and t= he approx.
=C2=A0 =C2=A0 =C2=A0* amount of bytes that just got transferred since the l= ast time
=C2=A0 =C2=A0 =C2=A0* we were in this routine reaches the threshold. If tha= t happens
=C2=A0 =C2=A0 =C2=A0* twice, start or increase throttling.
=C2=A0 =C2=A0 =C2=A0*/

=C2=A0 =C2=A0 if ((bytes_dirty_period > bytes_dirty_threshold) &&= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (++rs->dirty_rate_high_cnt >=3D 2)) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 rs->dirty_rate_high_cnt =3D 0;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* During block migration the auto-converg= e logic incorrectly detects
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* that ram migration makes no progress. A= void this by disabling the
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* throttling logic during the bulk phase = of block migration
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (blk_mig_bulk_active()) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (migrate_auto_converge()) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 trace_migration_throttle();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mig_throttle_guest_down(bytes_dir= ty_period,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bytes_dirty_threshold)= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 } else if (migrate_dirty_limit()) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 migration_dirty_limit_guest(); =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }

Questions:

- Why are we changing blk_mig_bulk_active() position?= =C2=A0

=C2=A0 I think that the old code have it in the right place.=C2=A0 Addition= ally,
=C2=A0 you just changefd to this version a couple of patches agon.
Yes, indeed, this modification make no sense, i'll= fix it next version.




>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int64_t cpu_index, >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Error **errp)
>=C2=A0 {
> +=C2=A0 =C2=A0 MigrationState *ms =3D migrate_get_current();
> +
>=C2=A0 =C2=A0 =C2=A0 if (!kvm_enabled() || !kvm_dirty_ring_enabled()) {=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
>=C2=A0 =C2=A0 =C2=A0 }
> @@ -453,6 +455,15 @@ void qmp_cancel_vcpu_dirty_limit(bool has_cpu_ind= ex,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
>=C2=A0 =C2=A0 =C2=A0 }
>=C2=A0
> +=C2=A0 =C2=A0 if (migration_is_running(ms->state) &&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (!qemu_thread_is_self(&ms->thread)= ) &&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 migrate_dirty_limit() &&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 dirtylimit_in_service()) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "can't cancel d= irty page limit while"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= " migration is running");

Error message is bad or wrong.
You can cancel the dirty page, you ust need to be on the main thread.

Or I am missing something?

Migration, IMHO, shares the same quota dirty = rate stored in the global variable
"dirtylimit_stat= e ", =C2=A0if we cancel the dirty limit, =C2=A0it will make the thrott= le not work
and the migration will be affected.


> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
> +=C2=A0 =C2=A0 }
> +
>=C2=A0 =C2=A0 =C2=A0 dirtylimit_state_lock();
>=C2=A0
>=C2=A0 =C2=A0 =C2=A0 if (has_cpu_index) {
> @@ -488,6 +499,8 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index,<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 uint64_t dirty_rate,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Error **errp)
>=C2=A0 {
> +=C2=A0 =C2=A0 MigrationState *ms =3D migrate_get_current();
> +
>=C2=A0 =C2=A0 =C2=A0 if (!kvm_enabled() || !kvm_dirty_ring_enabled()) {=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "dirty page li= mit feature requires KVM with"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0" accelerator property 'dirty-ring-size' set'")=
> @@ -504,6 +517,15 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index,=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
>=C2=A0 =C2=A0 =C2=A0 }
>=C2=A0
> +=C2=A0 =C2=A0 if (migration_is_running(ms->state) &&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 (!qemu_thread_is_self(&ms->thread)= ) &&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 migrate_dirty_limit() &&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 dirtylimit_in_service()) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 error_setg(errp, "can't cancel d= irty page limit while"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= " migration is running");
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
> +=C2=A0 =C2=A0 }

If you use such a complex expression twice, I think that creating a
helper function is a good idea.
Ok, get it

Later, Juan.


Hyman

--
Best regards
--000000000000f8328a05fe285028--