From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmQv9-00062q-ES for qemu-devel@nongnu.org; Tue, 11 Jun 2013 11:55:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UmQv8-0004mA-4U for qemu-devel@nongnu.org; Tue, 11 Jun 2013 11:55:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmQv7-0004m3-Rq for qemu-devel@nongnu.org; Tue, 11 Jun 2013 11:55:42 -0400 Date: Tue, 11 Jun 2013 11:55:37 -0400 From: Luiz Capitulino Message-ID: <20130611115537.0addf646@redhat.com> In-Reply-To: <1370794247-28267-16-git-send-email-afaerber@suse.de> References: <1370794247-28267-1-git-send-email-afaerber@suse.de> <1370794247-28267-16-git-send-email-afaerber@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-cpu v4 15/18] dump: Abstract dump_init() further with qemu_for_each_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?UTF-8?B?RsOkcmJlcg==?= Cc: qiaonuohan@cn.fujitsu.com, qemu-devel@nongnu.org On Sun, 9 Jun 2013 18:10:44 +0200 Andreas F=C3=A4rber wrote: > Allows to drop CPUArchState variable. >=20 > Signed-off-by: Andreas F=C3=A4rber > --- > dump.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) >=20 > diff --git a/dump.c b/dump.c > index 44a1339..4e6b855 100644 > --- a/dump.c > +++ b/dump.c > @@ -702,10 +702,16 @@ static ram_addr_t get_start_block(DumpState *s) > return -1; > } > =20 > +static void count_one_cpu(CPUState *cpu, void *data) > +{ > + int *nr =3D data; > + > + *nr =3D *nr + 1; > +} > + > static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, > int64_t begin, int64_t length, Error **errp) > { > - CPUArchState *env; > int nr_cpus; > Error *err =3D NULL; > int ret; > @@ -738,9 +744,7 @@ static int dump_init(DumpState *s, int fd, bool pagin= g, bool has_filter, > */ > cpu_synchronize_all_states(); > nr_cpus =3D 0; > - for (env =3D first_cpu; env !=3D NULL; env =3D env->next_cpu) { > - nr_cpus++; > - } > + qemu_for_each_cpu(count_one_cpu, &nr_cpus); Isn't it worth it to have an API for this? Reviewed-by: Luiz Capitulino > =20 > ret =3D cpu_get_dump_info(&s->dump_info); > if (ret < 0) {