All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	david@gibson.dropbear.id.au, groug@kaod.org,
	nikunj@linux.vnet.ibm.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH v0 2/5] cpu: Optionally use arch_id instead of cpu_index in cpu vmstate_register()
Date: Wed, 6 Jul 2016 13:55:25 +0530	[thread overview]
Message-ID: <20160706075546.GD25522@in.ibm.com> (raw)
In-Reply-To: <20160706072544.4c379034@172-15-179-184.lightspeed.austtx.sbcglobal.net>

On Wed, Jul 06, 2016 at 07:25:44AM +0200, Igor Mammedov wrote:
> On Tue, 5 Jul 2016 18:13:22 +0530
> Bharata B Rao <bharata@linux.vnet.ibm.com> wrote:
> 
> > On Tue, Jul 05, 2016 at 09:15:51AM +0200, Igor Mammedov wrote:
> > > On Tue,  5 Jul 2016 10:12:49 +0530
> > > Bharata B Rao <bharata@linux.vnet.ibm.com> wrote:
> > > 
> > > > Introduce CPUState.prefer_arch_id_over_cpu_index and
> > > > MachineClass.prefer_arch_id_over_cpu_index that allow target
> > > > machines to optionally switch to using arch_id instead of
> > > > cpu_index as instance_id in vmstate_register(). This will help
> > > > allow successful migration in cases where holes are introduced in
> > > > cpu_index range after CPU hot removals.
> > > > 
> > > > Whether to use arch_id or cpu_index is based on machine type
> > > > version and hence added
> > > > MachineClass.prefer_arch_id_over_cpu_index. However the
> > > > enforcement is via and during CPU creation and hence added
> > > > CPUState.prefer_arch_id_over_cpu_index. So it becomes a two step
> > > > process for the target to enable the use of arch_id:
> > > > 
> > > > 1. Set MachineClass.prefer_arch_id_over_cpu_index.
> > > > 2. Ensure CPUState.prefer_arch_id_over_cpu_index is set for all
> > > > CPUs based on 1. above.
> > > > 
> > > > Suggested-by: Igor Mammedov <imammedo@redhat.com>
> > > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > > > ---
> > > >  exec.c              | 10 ++++++++--
> > > >  include/hw/boards.h |  1 +
> > > >  include/qom/cpu.h   |  4 ++++
> > > >  3 files changed, 13 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/exec.c b/exec.c
> > > > index 8ce8e90..7cc1d06 100644
> > > > --- a/exec.c
> > > > +++ b/exec.c
> > > > @@ -616,15 +616,21 @@ static void cpu_release_index(CPUState *cpu)
> > > >      bitmap_clear(cpu_index_map, cpu->cpu_index, 1);
> > > >  }
> > > >  
> > > > +/*
> > > > + * TODO: cpu_index and instance_id are of type int
> > > > while .get_arch_id()is
> > > > + * of type int64_t. What is the consequence of changing
> > > > instance_id to int64_t ?
> > > > + */
> > > ARM potentially could have get_arch_id() == MPIDR (return 64bit int)
> > > that would get truncated in this case.
> > > 
> > > I wonder if we could add "int CPUState::migration_id" and let
> > > machine code set it to what it uses for stable cpu id and then
> > > cpu_realize could call vmstate_register with it.
> > 
> > Hmm how would that help ? instance_id argument to vmstate_register()
> > is being treated as 32 bit integer as pointed by Greg earlier.
> > 
> > If we want to use 64 bit arch_id/migration_id as instance_id arg in
> > vmstate_register, shouldn't we be changing instance_id to 64 bit ?
> Trying to extend instance_id from 32bit to 64bit, looks hard to me as
> it's on wire format so it's not possible to change without breaking
> compatibility.
> 
> That's why dedicated migration_id should also be 32bit integer to keep
> it compatible with vmstate_foo() magic. On x86 and ARM that id will be
> in range [0..maxcpus), it's stable index in possible_cpus array.

Since we were planning to use arch_id (aka device tree id) as the stable
index for CPU cores on PowerPC, we would have to use int64_t arch_id
itself as int instance_id I suppose. The range could be
[0...maxcpus*8] for us.

Regards,
Bharata.

  reply	other threads:[~2016-07-06  8:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05  4:42 [Qemu-devel] [RFC PATCH v0 0/5] sPAPR: Fix migration when CPUs are removed in random order Bharata B Rao
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 1/5] cpu: Factor out cpu vmstate_[un]register into separate routines Bharata B Rao
2016-07-05  4:56   ` David Gibson
2016-07-05  5:16     ` Bharata B Rao
2016-07-05  5:49       ` Igor Mammedov
2016-07-05  6:35         ` Bharata B Rao
2016-07-05  7:22           ` Igor Mammedov
2016-07-05  7:38             ` Bharata B Rao
2016-07-05  8:01               ` Igor Mammedov
2016-07-05  7:29           ` Greg Kurz
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 2/5] cpu: Optionally use arch_id instead of cpu_index in cpu vmstate_register() Bharata B Rao
2016-07-05  4:56   ` David Gibson
2016-07-05  5:22     ` Bharata B Rao
2016-07-05  6:59   ` Igor Mammedov
2016-07-05  7:15   ` Igor Mammedov
2016-07-05 12:43     ` Bharata B Rao
2016-07-06  5:25       ` Igor Mammedov
2016-07-06  8:25         ` Bharata B Rao [this message]
2016-07-07  2:08           ` David Gibson
2016-07-07 17:19         ` Greg Kurz
2016-07-05  7:20   ` Greg Kurz
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 3/5] spapr: Implement CPUClass.get_arch_id() for PowerPC CPUs Bharata B Rao
2016-07-05  4:58   ` David Gibson
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 4/5] xics: Use arch_id instead of cpu_index in XICS code Bharata B Rao
2016-07-05  4:59   ` David Gibson
2016-07-05  7:03     ` Igor Mammedov
2016-07-05  4:42 ` [Qemu-devel] [RFC PATCH v0 5/5] spapr: Prefer arch_id over cpu_index Bharata B Rao
2016-07-05  7:10 ` [Qemu-devel] [RFC PATCH v0 0/5] sPAPR: Fix migration when CPUs are removed in random order Greg Kurz

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=20160706075546.GD25522@in.ibm.com \
    --to=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=imammedo@redhat.com \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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.