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 v1 1/5] cpu, target-ppc: Move cpu_vmstate_[un]register calls to cpu_common_[un]realize
Date: Wed, 6 Jul 2016 22:22:21 +0530	[thread overview]
Message-ID: <20160706165221.GI25522@in.ibm.com> (raw)
In-Reply-To: <20160706164417.414af317@172-15-179-184.lightspeed.austtx.sbcglobal.net>

On Wed, Jul 06, 2016 at 04:44:17PM +0200, Igor Mammedov wrote:
> On Wed, 6 Jul 2016 19:46:13 +0530
> Bharata B Rao <bharata@linux.vnet.ibm.com> wrote:
> 
> > On Wed, Jul 06, 2016 at 12:57:49PM +0200, Igor Mammedov wrote:
> > > On Wed,  6 Jul 2016 14:29:17 +0530
> > > Bharata B Rao <bharata@linux.vnet.ibm.com> wrote:
> > > 
> > > > Move vmstate_register() call to cpu_common_realize().
> > > > Introduce cpu_common_unrealize() and move vmstate_unregister() to
> > > > it.
> > > > 
> > > > Change those archs that implement their own CPU unrealize routine
> > > > to mandatorily call CPUClass::unrealize().
> > > > 
> > > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > > > ---
> > > >  exec.c                      | 53
> > > > ++++++++++++++++++++++++++++-----------------
> > > > include/qom/cpu.h           |  2 ++ qom/cpu.c
> > > > |  7 ++++++ target-ppc/cpu-qom.h        |  2 ++
> > > >  target-ppc/translate_init.c |  3 +++
> > > >  5 files changed, 47 insertions(+), 20 deletions(-)
> > > > 
> > > > diff --git a/exec.c b/exec.c
> > > > index 0122ef7..fb73910 100644
> > > > --- a/exec.c
> > > > +++ b/exec.c
> > > > @@ -594,9 +594,7 @@ AddressSpace *cpu_get_address_space(CPUState
> > > > *cpu, int asidx) /* Return the AddressSpace corresponding to the
> > > > specified index */ return cpu->cpu_ases[asidx].as;
> > > >  }
> > > > -#endif
> > > >  
> > > > -#ifndef CONFIG_USER_ONLY
> > > >  static DECLARE_BITMAP(cpu_index_map, MAX_CPUMASK_BITS);
> > > >  
> > > >  static int cpu_get_free_index(Error **errp)
> > > > @@ -617,6 +615,31 @@ static void cpu_release_index(CPUState *cpu)
> > > >  {
> > > >      bitmap_clear(cpu_index_map, cpu->cpu_index, 1);
> > > >  }
> > > > +
> > > > +void cpu_vmstate_register(CPUState *cpu)
> > > > +{
> > > > +    CPUClass *cc = CPU_GET_CLASS(cpu);
> > > > +
> > > > +    if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
> > > > +        vmstate_register(NULL, cpu->cpu_index,
> > > > &vmstate_cpu_common, cpu);
> > > > +    }
> > > > +    if (cc->vmsd != NULL) {
> > > > +        vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu);
> > > > +    }
> > > > +}
> > > > +
> > > > +void cpu_vmstate_unregister(CPUState *cpu)
> > > > +{
> > > > +    CPUClass *cc = CPU_GET_CLASS(cpu);
> > > > +
> > > > +    if (cc->vmsd != NULL) {
> > > > +        vmstate_unregister(NULL, cc->vmsd, cpu);
> > > > +    }
> > > > +    if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
> > > > +        vmstate_unregister(NULL, &vmstate_cpu_common, cpu);
> > > > +    }
> > > > +}
> > > 
> > > Is there any reason to keep these in exec.c,
> > > I'd put them in qom/cpu.c
> > 
> > I started with it, had to move vmstate_cpu_common and its
> > pre/post_load routines and one of them called tlb_flush() whose
> > header qom/cpu.c didn't like. So I saved the movement for later.
> ok,
> 
> alternatively you can check for use_migration_id in exec.c without
> moving vmstate_* around.

Ok, just to be clear, you are suggesting that I move back to my
first implementation which just consolidated vmstate_* calls
and called them from within cpu_exec_init/exit() ?

Regards,
Bharata.

  reply	other threads:[~2016-07-06 16:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06  8:59 [Qemu-devel] [RFC PATCH v1 0/5] sPAPR: Fix migration when CPUs are removed in random order Bharata B Rao
2016-07-06  8:59 ` [Qemu-devel] [RFC PATCH v1 1/5] cpu, target-ppc: Move cpu_vmstate_[un]register calls to cpu_common_[un]realize Bharata B Rao
2016-07-06 10:57   ` Igor Mammedov
2016-07-06 14:16     ` Bharata B Rao
2016-07-06 14:44       ` Igor Mammedov
2016-07-06 16:52         ` Bharata B Rao [this message]
2016-07-07  0:47   ` David Gibson
2016-07-06  8:59 ` [Qemu-devel] [RFC PATCH v1 2/5] cpu: Introduce CPUState::migration_id Bharata B Rao
2016-07-06 11:34   ` Igor Mammedov
2016-07-06 14:18     ` Bharata B Rao
2016-07-06 14:47       ` Igor Mammedov
2016-07-07  0:53   ` David Gibson
2016-07-06  8:59 ` [Qemu-devel] [RFC PATCH v1 3/5] spapr: Implement CPUClass::get_migration_id() for PowerPC CPUs Bharata B Rao
2016-07-06 12:01   ` Igor Mammedov
2016-07-06 14:21     ` Bharata B Rao
2016-07-06 14:37       ` Greg Kurz
2016-07-07  0:57       ` David Gibson
2016-07-07 12:32         ` Greg Kurz
2016-07-07  0:55     ` David Gibson
2016-07-06 14:35   ` Greg Kurz
2016-07-06 16:53     ` Bharata B Rao
2016-07-07  1:00   ` David Gibson
2016-07-07 13:43     ` [Qemu-devel] [Qemu-ppc] " Mark Cave-Ayland
2016-07-06  8:59 ` [Qemu-devel] [RFC PATCH v1 4/5] xics: Use migration_id instead of cpu_index in XICS code Bharata B Rao
2016-07-06  9:08   ` Nikunj A Dadhania
2016-07-06  8:59 ` [Qemu-devel] [RFC PATCH v1 5/5] cpu, spapr: Use migration_id from pseries-2.7 onwards Bharata B Rao
2016-07-06 11:44   ` Igor Mammedov
2016-07-06 11:45   ` Igor Mammedov
2016-07-06 14:24     ` Bharata B Rao

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=20160706165221.GI25522@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.