qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Benoît Canet" <benoit.canet@irqsave.net>,
	"Igor Mammedov" <imammedo@redhat.com>,
	qemu-devel@nongnu.org, liguang <lig.fnst@cn.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH v2] i386: Use #defines instead of magic numbers for CPUID cache information
Date: Mon, 02 Sep 2013 13:01:48 +0200	[thread overview]
Message-ID: <5224701C.6070108@suse.de> (raw)
In-Reply-To: <20130830194952.GC3041@otherpad.lan.raisama.net>

Am 30.08.2013 21:49, schrieb Eduardo Habkost:
> On Fri, Aug 30, 2013 at 04:51:20PM +0200, Andreas Färber wrote:
>> Am 27.08.2013 17:24, schrieb Eduardo Habkost:
>>> This is an attempt to make the CPUID cache topology code clearer, by
>>> replacing the magic numbers in the code with #defines, and moving all
>>> the cache information to the same place in the file.
>>>
>>> I took care of comparing the assembly output of compiling
>>> target-i386/cpu.c before and after applying this change, to make sure
>>> not a single bit was changed on cpu_x86_cpuid() before and after
>>> applying this patch (unfortunately I had to manually check existing
>>> differences, because of __LINE__ expansions on
>>> object_class_dynamic_cast_assert() calls).
>>>
>>> This even keeps the code bug-compatible with the previous version: today
>>> the cache information returned on AMD cache information leaves (CPUID
>>> 0x80000005 & 0x80000006) do not match the information returned on CPUID
>>> leaves 2 and 4. The L2 cache information on CPUID leaf 2 also doesn't
>>> match the information on CPUID leaf 2. The new constants should make it
>>> easier to eventually fix those inconsistencies. All inconsistencies I
>>> have found are documented in code comments.
>>>
>>> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>>> Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>
>>> ---
>>> Changes v1 -> v2:
>>>  * s/leafs/leaves/ on code comments
>>> ---
>>>  target-i386/cpu.c | 184 +++++++++++++++++++++++++++++++++++++++++++++++-------
>>>  1 file changed, 162 insertions(+), 22 deletions(-)
>>
>> I think this is a good idea and the code looked sane, but it is unclear
>> to me from v1 whether Li Guang has verified as part of his review that
>> all the bits match the original ones or just that Coding Style and
>> general idea is okay?
>>
>> I'm therefore holding off applying this one for today's pull, waiting
>> until either someone confirms Eduardo's results or I find the time to do
>> so myself, the former being appreciated. :)
> 
> In case anybody wants to verify it: compile it before/after applying the
> patch, with:
>   make CFLAGS='-save-temps -DNDEBUG
> and save x86_64-softmmu/cpu.s file from each run.
> 
> You are going to see some differences between both files due to __LINE__
> being used as argument to object*_dynamic_cast_assert(), but nothing
> else.

So the only difference I see is movl lines changing slightly before
object_dynamic_cast_assert() calls, so I'm applying it to qom-cpu:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu

(Since for backporting commits I consider it more important to have
consistent prefixes, I have shortened the end of the subject instead.)

Thanks,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

      reply	other threads:[~2013-09-02 11:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27 15:24 [Qemu-devel] [PATCH v2] i386: Use #defines instead of magic numbers for CPUID cache information Eduardo Habkost
2013-08-30 14:51 ` Andreas Färber
2013-08-30 19:49   ` Eduardo Habkost
2013-09-02 11:01     ` Andreas Färber [this message]

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=5224701C.6070108@suse.de \
    --to=afaerber@suse.de \
    --cc=benoit.canet@irqsave.net \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lig.fnst@cn.fujitsu.com \
    --cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).