From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgHMy-0006Vn-4l for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:58:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgHMs-0000dr-P7 for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:58:44 -0500 Received: from cantor2.suse.de ([195.135.220.15]:47035 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgHMs-0000dU-Fd for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:58:38 -0500 Message-ID: <50BF6F2A.4080306@suse.de> Date: Wed, 05 Dec 2012 16:58:34 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1354649683-9078-1-git-send-email-ehabkost@redhat.com> <1354649683-9078-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1354649683-9078-3-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/6] target-i386: cpu: separate feature string parsing from CPU model lookup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Igor Mammedov , Don Slutz , qemu-devel@nongnu.org Am 04.12.2012 20:34, schrieb Eduardo Habkost: > Instead of using parsing the whole cpu_model string inside Dropped "using". > cpu_x86_find_by_name(), first split it into the CPU model name and the > full feature string, then parse the feature string into pieces. [...] > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 7afe839..70ba323 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1208,25 +1208,10 @@ static void x86_cpuid_set_tsc_freq(Object *obj,= Visitor *v, void *opaque, > cpu->env.tsc_khz =3D value / 1000; > } > =20 > -static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cp= u_model) > +static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *na= me) > { > - unsigned int i; > x86_def_t *def; > =20 > - char *s =3D g_strdup(cpu_model); > - char *featurestr, *name =3D strtok(s, ","); > - /* Features to be added*/ [...] > @@ -1235,16 +1220,37 @@ static int cpu_x86_find_by_name(x86_def_t *x86_= cpu_def, const char *cpu_model) > if (kvm_enabled() && name && strcmp(name, "host") =3D=3D 0) { > kvm_cpu_fill_host(x86_cpu_def); > } else if (!def) { > - goto error; > + return -1; > } else { > memcpy(x86_cpu_def, def, sizeof(*def)); > } > =20 > + return 0; > +} > + > +/* Parse "+feature,-feature,feature=3Dfoo" CPU feature string > + */ > +static int cpu_x86_parse_featurestr(x86_def_t *x86_cpu_def, char *feat= ures) > +{ > + unsigned int i; > + char *featurestr; /* Single 'key=3Dvalue" string being parsed */ > + /* Features to be added*/ I took the liberty of adding a space above by editing patches 1 & 2. Also, in Linux, multi-level topics such as "PPC: KVM: " seem to be common, whereas in QEMU we've been using paths ("tcg/ppc: "); Anthony has once used "isa: pic: " when he meant affecting both isa and pic (8f04ee0882aec9fe91fb70f767edf5dacff59835), so since this does not touch on the QOM cpu.c that I usually label "cpu: ", in a previous case I have edited your patch as "target-i386/cpu: ", but since this subject redundantly mentions CPU later on I'm dropping it. Hope this explains the rationale! Generally I found the GNOME guidelines pretty convincing: https://live.gnome.org/Git/CommitMessages (capitalizing after the lowercase topic makes the main message stand out when reading through shortlogs IMO) Thanks, applied patches 1-2 to qom-cpu: https://github.com/afaerber/qemu-cpu/commits/qom-cpu Andreas --=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