Received: from eggs.gnu.org ([2001:4830:134:3::10]:57091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yo9tK-0003ug-1c for qemu-devel@nongnu.org; Fri, 01 May 2015 08:18:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yo9tF-00005W-KP for qemu-devel@nongnu.org; Fri, 01 May 2015 08:18:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yo9tF-00005D-Cc for qemu-devel@nongnu.org; Fri, 01 May 2015 08:17:57 -0400 Date: Fri, 1 May 2015 09:17:42 -0300 From: Eduardo Habkost Message-ID: <20150501121742.GJ17796@thinpad.lan.raisama.net> References: <1430421547-18278-1-git-send-email-ehabkost@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] cpu: Register QOM links at /machine/cpus/ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , mimu@linux.vnet.ibm.com, Igor Mammedov , Alexander Graf , "qemu-devel@nongnu.org Developers" , "Christian Borntraeger (s390x)" , bharata@linux.vnet.ibm.com, cornelia.huck@de.ibm.com, Paolo Bonzini , Andreas =?iso-8859-1?Q?F=E4rber?= , David Gibson On Thu, Apr 30, 2015 at 06:51:43PM -0700, Peter Crosthwaite wrote: > On Thu, Apr 30, 2015 at 12:19 PM, Eduardo Habkost wrote: > > This will provide a predictable path for the CPU objects, and a more > > powerful alternative for the query-cpus QMP command, as now every QOM > > property on CPU objects can be easily queried. > > > > Signed-off-by: Eduardo Habkost > > --- > > Note that this doesn't replace any future topology enumeration > > mechanisms we may choose to implement. It just replaces the existing > > topology-unaware VCPU enumeration mechanism that is query-cpus. > > > > Reference to previous discussion: > > > > Date: Thu, 23 Apr 2015 10:17:36 -0300 > > From: Eduardo Habkost > > Subject: Re: [Qemu-devel] cpu modelling and hotplug (was: [PATCH RFC 0/4] target-i386: PC socket/core/thread modeling, part 1) > > Message-ID: <20150423131736.GA17796@thinpad.lan.raisama.net> > > --- > > exec.c | 16 ++++++++++++++++ > > include/qom/cpu.h | 3 +++ > > 2 files changed, 19 insertions(+) > > > > diff --git a/exec.c b/exec.c > > index ae37b98..8bdfa65 100644 > > --- a/exec.c > > +++ b/exec.c > > @@ -519,6 +519,20 @@ void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as) > > } > > #endif > > > > +static void cpu_add_qom_link(CPUState *cpu) > > +{ > > +#if !defined(CONFIG_USER_ONLY) > > + Object *cobj = OBJECT(cpu); > > + Object *cpu_container = container_get(OBJECT(current_machine), "/cpus"); > > + char *path = g_strdup_printf("%d", cpu->cpu_index); > > + > > This pathing is inconsistent with other arrayification efforts where > we use ../foo[N]. > Do we need the container, can we just use /cpu[0], /cpu[1]? Having a container looked simpler and cleaner than using cpu[0], cpu[1], but I don't have a strong preference either way. > > > + cpu->self = cobj; > > Paolo's . property ideal is probably a winner, but see this discussion: > > https://lists.gnu.org/archive/html/qemu-devel/2015-04/msg03557.html > > for how to create RYO links with open coded setters and getters. > You could use the object itself as an opaque data and a trivial getter, > no setter and then you can get rid of the self pointer. True. But I will try to implement that in a generic way instead of duplicating what's already implemented by object_get_link_property() and object_resolve_link_property(). -- Eduardo