All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: "Jaggi, Manish" <Manish.Jaggi@cavium.com>
Cc: Juan Quintela <quintela@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Auger Eric <eric.auger@redhat.com>,
	"peter.maydell@linaro.org qemu-devel@nongnu.org"
	<qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Query] Live Migration between machines with different processor ids
Date: Wed, 5 Sep 2018 14:20:21 +0200	[thread overview]
Message-ID: <20180905122021.dfsvsvk6zn2ijefp@kamzik.brq.redhat.com> (raw)
In-Reply-To: <EF2DEC36-DDCB-4169-A30F-15F29B7F52E9@caviumnetworks.com>

On Wed, Sep 05, 2018 at 11:46:11AM +0000, Jaggi, Manish wrote:
> (a) Changes in KVM:
> 
> - Introducing a specific error code (KVM_EINVARIANT) in case of invariant writes.
> This should not change anything to API SET_ONE_REG KVM API.
> Not sure which is the best place to put the define…
> I have added in include/uapi/linux/kvm_para.h.
> 
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 22fbbdbece3c..c8a4fbe8a8bb 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -1111,7 +1111,7 @@ static int __set_id_reg(const struct sys_reg_desc *rd, void __user *uaddr,
>  
>         /* This is what we mean by invariant: you can't change it. */
>         if (val != read_id_reg(rd, raz))
> -               return -EINVAL;
> +               return -KVM_EINVARIANT;
>  
>         return 0;
>  }
> diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h
> index 6c0ce49931e5..3a49a321d0df 100644
> --- a/include/uapi/linux/kvm_para.h
> +++ b/include/uapi/linux/kvm_para.h
> @@ -17,6 +17,7 @@
>  #define KVM_E2BIG              E2BIG
>  #define KVM_EPERM              EPERM
>  #define KVM_EOPNOTSUPP         95
> +#define KVM_EINVARIANT          96
>  
>  #define KVM_HC_VAPIC_POLL_IRQ          1
>  #define KVM_HC_MMU_OP                  2
> 
> (b) Changes in Qemu code
> 
> 1. Handling of new error code, which would update
> guest state with hosts invariant reg values.
> 
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 65f867d569..0cf14323a2 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -452,7 +452,15 @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level)
>              abort();
>          }
>          ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &r);
> -        if (ret) {
> +        if (ignore_invariant && (ret == -KVM_EINVARIANT)) {
> +            /* Update Guest invariant to match with migrated host regs*/
> +            ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &r);
> +            if (ret)
> +                ok = false;
> +            else
> +                cpu->cpreg_values[i] = r.addr;
> +        }
> +        else if (ret) {
>              /* We might fail for "unknown register" and also for
>               * "you tried to set a register which is constant with
>               * a different value from what it actually contains".
> 
> 2. ignore_invariant is the flag I was referring to which is what you also
> mentioned opt-in. This can be supplied as a command line parameter to qemu on Machine B.

The same libvirt folk also suggest that a QMP command be provided that
allows the selection of this ignore-invariant mode (in addition to or
instead of the command line parameter.) Otherwise a guest that has
already started without the parameter will not be able to migrate to
a "close enough" host - even if it's decided later that it would be OK
to do so.

> 
> PS: I will add code to put warning logs as suggested by Dave.

Yeah, I like that idea too.

This approach looks good to me. Let's see what maintainers say when they
see the patch submission.

Thanks,
drew

  reply	other threads:[~2018-09-05 12:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21  6:39 [Qemu-devel] Live Migration between machines with different processor ids Mjaggi Oss
2018-08-23 11:18 ` [Qemu-devel] [Query] " Jaggi, Manish
2018-08-23 14:29   ` Juan Quintela
2018-08-24  9:24     ` Jaggi, Manish
2018-08-28 17:27       ` Dr. David Alan Gilbert
2018-08-29 12:40         ` Jaggi, Manish
2018-08-29 13:16           ` Andrew Jones
2018-08-31  9:52             ` Jaggi, Manish
2018-08-31 11:11               ` Andrew Jones
2018-09-04  9:16                 ` Jaggi, Manish
2018-09-04  9:54                   ` Andrew Jones
2018-09-04 10:27                     ` Juan Quintela
2018-09-04 10:32                     ` Dr. David Alan Gilbert
2018-09-04 12:17                       ` Peter Maydell
2018-09-05 11:46                     ` Jaggi, Manish
2018-09-05 12:20                       ` Andrew Jones [this message]
2018-09-05 12:42                         ` Jaggi, Manish
2018-09-05 13:17                           ` Andrew Jones
2018-08-29 13:58           ` Dr. David Alan Gilbert
2018-08-31  9:41             ` Juan Quintela

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=20180905122021.dfsvsvk6zn2ijefp@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=Manish.Jaggi@cavium.com \
    --cc=dgilbert@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.