All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Peter Maydell <peter.maydell@linaro.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	James Hogan <james.hogan@imgtec.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Leon Alrae <leon.alrae@imgtec.com>,
	Alexander Graf <agraf@suse.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	kvm@vger.kernel.org, qemu-ppc@nongnu.org
Subject: Re: [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated
Date: Mon, 9 Nov 2015 16:37:09 +0000	[thread overview]
Message-ID: <20151109163709.GB9020@work-vm> (raw)
In-Reply-To: <20151109160123.GB4180@thinpad.lan.raisama.net>

* Eduardo Habkost (ehabkost@redhat.com) wrote:
> On Mon, Nov 09, 2015 at 08:33:55AM +0800, haozhong.zhang@intel.com wrote:
> > On 11/06/15 13:12, Eduardo Habkost wrote:
> > > On Fri, Nov 06, 2015 at 10:32:24AM +0800, haozhong.zhang@intel.com wrote:
> > > > On 11/05/15 14:05, Eduardo Habkost wrote:
> > > > > On Thu, Nov 05, 2015 at 09:30:51AM +0800, Haozhong Zhang wrote:
> > > > > > On 11/04/15 19:42, Eduardo Habkost wrote:
> > > [...]
> > > > > > > > +        env->tsc_khz_saved = r;
> > > > > > > > +    }
> > > > > > > 
> > > > > > > Why do you need a separate tsc_khz_saved field, and don't simply use
> > > > > > > tsc_khz? It would have the additional feature of letting QMP clients
> > > > > > > query the current TSC rate by asking for the tsc-freq property on CPU
> > > > > > > objects.
> > > > > > >
> > > > > > 
> > > > > > It's to avoid overriding env->tsc_khz on the destination in the
> > > > > > migration. I can change this line to
> > > > > >              env->tsc_khz = env->tsc_khz_saved = r;
> > > > > 
> > > > > You are already avoiding overriding env->tsc_khz, because you use
> > > > > KVM_GET_TSC_KHZ only if tsc_khz is not set yet. I still don't see why
> > > > > you need a tsc_khz_saved field that requires duplicating the SET_TSC_KHZ
> > > > > code, if you could just do this:
> > > > > 
> > > > >     if (!env->tsc_khz) {
> > > > >         env->tsc_khz = kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ);
> > > > >     }
> > > > >
> > > > 
> > > > Consider an example that we migrate a VM from machine A to machine B
> > > > and then to machine C, and QEMU on machine B is launched with the cpu
> > > > option 'tsc-freq' (i.e. env->tsc_khz on B is non-zero at the
> > > > beginning):
> > > >  1) In the migration from B to C, the user-specified TSC frequency by
> > > >     'tsc-freq' on B is expected to be migrated to C. That is, the
> > > >     value of env->tsc_khz on B is migrated.
> > > >  2) If TSC frequency is migrated through env->tsc_khz, then
> > > >     env->tsc_khz on B will be overrode in the migration from A to B
> > > >     before kvm_arch_setup_tsc_khz(). If the guest TSC frequency is
> > > >     different than the user-specified TSC frequency on B, the
> > > >     expectation in 1) will not be satisfied anymore.
> > > 
> > > Setting tsc-freq on B when tsc-freq was not used on A is invalid usage.
> > > This is not different from changing the CPU model and adding or removing
> > > CPU flags when migrating, which is also incorrect. The command-line
> > > parameters defining the VM must be the same when you migrate.
> > >
> > 
> > Good to know it's an invalid usage. Then the question is what QEMU is
> > expected to do for this invalid usage?
> > 
> >  1) Abort the migration? But I find that the current QEMU does not
> >     abort the migration between different CPU models (e.g. Nehalem and
> >     Haswell).
> > 
> >  2) Or do not abort the migration and ignore tsc-freq option? If so,
> >     tsc_khz_saved will be not needed.
> 
> My first choice is to abort migration. If we decide to abort today and
> find it to cause problems, we can easily fix it. If we decide to
> continue without aborting, it is difficult to change that behavior
> without breaking existing setups.

Yes, if it's a bad config please abort the migration and put a clear
message in the log so we can tell easily.

Dave

> 
> -- 
> Eduardo
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	James Hogan <james.hogan@imgtec.com>,
	kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-ppc@nongnu.org, Cornelia Huck <cornelia.huck@de.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Leon Alrae <leon.alrae@imgtec.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated
Date: Mon, 9 Nov 2015 16:37:09 +0000	[thread overview]
Message-ID: <20151109163709.GB9020@work-vm> (raw)
In-Reply-To: <20151109160123.GB4180@thinpad.lan.raisama.net>

* Eduardo Habkost (ehabkost@redhat.com) wrote:
> On Mon, Nov 09, 2015 at 08:33:55AM +0800, haozhong.zhang@intel.com wrote:
> > On 11/06/15 13:12, Eduardo Habkost wrote:
> > > On Fri, Nov 06, 2015 at 10:32:24AM +0800, haozhong.zhang@intel.com wrote:
> > > > On 11/05/15 14:05, Eduardo Habkost wrote:
> > > > > On Thu, Nov 05, 2015 at 09:30:51AM +0800, Haozhong Zhang wrote:
> > > > > > On 11/04/15 19:42, Eduardo Habkost wrote:
> > > [...]
> > > > > > > > +        env->tsc_khz_saved = r;
> > > > > > > > +    }
> > > > > > > 
> > > > > > > Why do you need a separate tsc_khz_saved field, and don't simply use
> > > > > > > tsc_khz? It would have the additional feature of letting QMP clients
> > > > > > > query the current TSC rate by asking for the tsc-freq property on CPU
> > > > > > > objects.
> > > > > > >
> > > > > > 
> > > > > > It's to avoid overriding env->tsc_khz on the destination in the
> > > > > > migration. I can change this line to
> > > > > >              env->tsc_khz = env->tsc_khz_saved = r;
> > > > > 
> > > > > You are already avoiding overriding env->tsc_khz, because you use
> > > > > KVM_GET_TSC_KHZ only if tsc_khz is not set yet. I still don't see why
> > > > > you need a tsc_khz_saved field that requires duplicating the SET_TSC_KHZ
> > > > > code, if you could just do this:
> > > > > 
> > > > >     if (!env->tsc_khz) {
> > > > >         env->tsc_khz = kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ);
> > > > >     }
> > > > >
> > > > 
> > > > Consider an example that we migrate a VM from machine A to machine B
> > > > and then to machine C, and QEMU on machine B is launched with the cpu
> > > > option 'tsc-freq' (i.e. env->tsc_khz on B is non-zero at the
> > > > beginning):
> > > >  1) In the migration from B to C, the user-specified TSC frequency by
> > > >     'tsc-freq' on B is expected to be migrated to C. That is, the
> > > >     value of env->tsc_khz on B is migrated.
> > > >  2) If TSC frequency is migrated through env->tsc_khz, then
> > > >     env->tsc_khz on B will be overrode in the migration from A to B
> > > >     before kvm_arch_setup_tsc_khz(). If the guest TSC frequency is
> > > >     different than the user-specified TSC frequency on B, the
> > > >     expectation in 1) will not be satisfied anymore.
> > > 
> > > Setting tsc-freq on B when tsc-freq was not used on A is invalid usage.
> > > This is not different from changing the CPU model and adding or removing
> > > CPU flags when migrating, which is also incorrect. The command-line
> > > parameters defining the VM must be the same when you migrate.
> > >
> > 
> > Good to know it's an invalid usage. Then the question is what QEMU is
> > expected to do for this invalid usage?
> > 
> >  1) Abort the migration? But I find that the current QEMU does not
> >     abort the migration between different CPU models (e.g. Nehalem and
> >     Haswell).
> > 
> >  2) Or do not abort the migration and ignore tsc-freq option? If so,
> >     tsc_khz_saved will be not needed.
> 
> My first choice is to abort migration. If we decide to abort today and
> find it to cause problems, we can easily fix it. If we decide to
> continue without aborting, it is difficult to change that behavior
> without breaking existing setups.

Yes, if it's a bad config please abort the migration and put a clear
message in the log so we can tell easily.

Dave

> 
> -- 
> Eduardo
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2015-11-09 16:37 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-02  9:26 [PATCH v3 0/3] target-i386: save/restore vcpu's TSC rate during migration Haozhong Zhang
2015-11-02  9:26 ` [Qemu-devel] " Haozhong Zhang
2015-11-02  9:26 ` [PATCH v3 1/3] target-i386: add a subsection for migrating vcpu's TSC rate Haozhong Zhang
2015-11-02  9:26   ` [Qemu-devel] " Haozhong Zhang
2015-11-11 14:16   ` Eduardo Habkost
2015-11-11 14:16     ` Eduardo Habkost
2015-11-11 14:27     ` Haozhong Zhang
2015-11-11 14:27       ` [Qemu-devel] " Haozhong Zhang
2015-11-13  2:23       ` Haozhong Zhang
2015-11-13  2:23         ` [Qemu-devel] " Haozhong Zhang
2015-11-13 15:21         ` Eduardo Habkost
2015-11-13 15:21           ` [Qemu-devel] " Eduardo Habkost
2015-11-16  0:10           ` Haozhong Zhang
2015-11-16  0:10             ` Haozhong Zhang
2015-11-02  9:26 ` [PATCH v3 2/3] target-i386: calculate vcpu's TSC rate to be migrated Haozhong Zhang
2015-11-02  9:26   ` [Qemu-devel] " Haozhong Zhang
2015-11-02  9:40   ` James Hogan
2015-11-02  9:40     ` [Qemu-devel] " James Hogan
2015-11-02 13:26     ` Haozhong Zhang
2015-11-02 13:26       ` [Qemu-devel] " Haozhong Zhang
2015-11-05  8:05     ` Christian Borntraeger
2015-11-05  8:05       ` [Qemu-devel] " Christian Borntraeger
2015-11-05  8:14       ` Haozhong Zhang
2015-11-05  8:14         ` [Qemu-devel] " Haozhong Zhang
2015-11-04 21:42   ` Eduardo Habkost
2015-11-04 21:42     ` [Qemu-devel] " Eduardo Habkost
2015-11-05  1:30     ` Haozhong Zhang
2015-11-05  1:30       ` [Qemu-devel] " Haozhong Zhang
2015-11-05 16:05       ` Eduardo Habkost
2015-11-05 16:05         ` [Qemu-devel] " Eduardo Habkost
2015-11-06  2:32         ` haozhong.zhang
2015-11-06  2:32           ` [Qemu-devel] " haozhong.zhang
2015-11-06 15:12           ` Eduardo Habkost
2015-11-06 15:12             ` [Qemu-devel] " Eduardo Habkost
2015-11-09  0:33             ` haozhong.zhang
2015-11-09  0:33               ` [Qemu-devel] " haozhong.zhang
2015-11-09 16:01               ` Eduardo Habkost
2015-11-09 16:01                 ` [Qemu-devel] " Eduardo Habkost
2015-11-09 16:37                 ` Dr. David Alan Gilbert [this message]
2015-11-09 16:37                   ` Dr. David Alan Gilbert
2015-11-10  1:08                 ` Haozhong Zhang
2015-11-10  1:08                   ` [Qemu-devel] " Haozhong Zhang
2015-11-11 14:54                   ` Eduardo Habkost
2015-11-11 14:54                     ` [Qemu-devel] " Eduardo Habkost
2015-11-11 15:35                     ` Haozhong Zhang
2015-11-11 15:35                       ` [Qemu-devel] " Haozhong Zhang
2015-11-10 16:57                 ` Haozhong Zhang
2015-11-10 16:57                   ` [Qemu-devel] " Haozhong Zhang
2015-11-11 15:23                   ` Eduardo Habkost
2015-11-11 15:23                     ` [Qemu-devel] " Eduardo Habkost
2015-11-11 15:33                     ` Haozhong Zhang
2015-11-11 15:33                       ` [Qemu-devel] " Haozhong Zhang
2015-11-02  9:26 ` [PATCH v3 3/3] target-i386: load the migrated vcpu's TSC rate Haozhong Zhang
2015-11-02  9:26   ` [Qemu-devel] " Haozhong Zhang
2015-11-05 16:10   ` Eduardo Habkost
2015-11-05 16:10     ` [Qemu-devel] " Eduardo Habkost
2015-11-06  2:32     ` Haozhong Zhang
2015-11-06  2:32       ` [Qemu-devel] " Haozhong Zhang
2015-11-06 15:15       ` Eduardo Habkost
2015-11-06 15:15         ` [Qemu-devel] " Eduardo Habkost

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=20151109163709.GB9020@work-vm \
    --to=dgilbert@redhat.com \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=james.hogan@imgtec.com \
    --cc=kvm@vger.kernel.org \
    --cc=leon.alrae@imgtec.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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.