From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV3iK-0007pD-Rr for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UV3iF-0002m6-Dv for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:42:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41514) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV3iF-0002lo-5K for qemu-devel@nongnu.org; Wed, 24 Apr 2013 13:42:35 -0400 Date: Wed, 24 Apr 2013 19:42:16 +0200 From: Igor Mammedov Message-ID: <20130424194216.55e15463@thinkpad> In-Reply-To: <5178157D.9010204@suse.de> References: <1366705795-24732-1-git-send-email-imammedo@redhat.com> <1366705795-24732-20-git-send-email-imammedo@redhat.com> <5178157D.9010204@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 19/21] add hot_add_cpu hook to QEMUMachine and export machine_args List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?ISO-8859-1?B?RuRyYmVy?= Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, ehabkost@redhat.com, gleb@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, quintela@redhat.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, aderumier@odiso.com, lcapitulino@redhat.com, blauwirbel@gmail.com, yang.z.zhang@intel.com, alex.williamson@redhat.com, kraxel@redhat.com, anthony.perard@citrix.com, pbonzini@redhat.com, armbru@redhat.com, stefano.stabellini@eu.citrix.com, rth@twiddle.net On Wed, 24 Apr 2013 19:25:17 +0200 Andreas F=E4rber wrote: > Am 23.04.2013 10:29, schrieb Igor Mammedov: > > hot_add_cpu hook should be overriden by target that implements > > cpu hot-add via cpu-add QMP command. > >=20 > > Make machine_args available to machine init code, it allows > > to centralize cpu_model starage instead of adding target > > specific globals to keep it. > >=20 > > Signed-off-by: Igor Mammedov > > --- > > include/hw/boards.h | 3 +++ > > vl.c | 6 +++++- > > 2 files changed, 8 insertions(+), 1 deletions(-) > >=20 > > diff --git a/include/hw/boards.h b/include/hw/boards.h > > index 425bdc7..de8f92a 100644 > > --- a/include/hw/boards.h > > +++ b/include/hw/boards.h > > @@ -18,6 +18,8 @@ typedef struct QEMUMachineInitArgs { > > const char *cpu_model; > > } QEMUMachineInitArgs; > > =20 > > +extern QEMUMachineInitArgs *machine_args; > > + > > typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args); > > =20 > > typedef void QEMUMachineResetFunc(void); > > @@ -43,6 +45,7 @@ typedef struct QEMUMachine { > > GlobalProperty *compat_props; > > struct QEMUMachine *next; > > const char *hw_version; > > + void (*hot_add_cpu)(const int64_t id, Error **errp); > > } QEMUMachine; > > =20 > > int qemu_register_machine(QEMUMachine *m); > > diff --git a/vl.c b/vl.c > > index 5612c33..6a612e6 100644 > > --- a/vl.c > > +++ b/vl.c > > @@ -179,6 +179,8 @@ int main(int argc, char **argv) > > #define MAX_VIRTIO_CONSOLES 1 > > #define MAX_SCLP_CONSOLES 1 > > =20 > > +QEMUMachineInitArgs *machine_args; > > + > > static const char *data_dir[16]; > > static int data_dir_idx; > > const char *bios_name =3D NULL; > > @@ -4295,13 +4297,15 @@ int main(int argc, char **argv, char **envp) > > .kernel_cmdline =3D kernel_cmdline, > > .initrd_filename =3D initrd_filename, > > .cpu_model =3D cpu_model }; > > + machine_args =3D &args; >=20 > args is a stack variable, so making it global does not strike me as a > good idea... (I did have a patch to split main() in two at one time) True, but it lives till main() exits, and by that time nothing accesses it. I can make it global though it will produce more code churn. >=20 > > + current_machine =3D machine; > > + > > machine->init(&args); > > =20 > > cpu_synchronize_all_post_init(); > > =20 > > set_numa_modes(); > > =20 > > - current_machine =3D machine; >=20 > Did you look up why it was placed here? Eduardo? > I'm not strongly opinionated but I wonder whether we may want to leave > it after machine->init? it was added by 6f338c34 for the sake of device hotplug. Moving it earlier allows to use it during machine->init() as well, it's improves variable utilization. next patch sets hot_add_cpu hook from machine->init() for x86 target. >=20 > Andreas >=20 > > =20 > > /* init USB devices */ > > if (usb_enabled(false)) { > >=20 >=20 >=20 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg >=20 --=20 Regards, Igor