qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
	Jiri Denemark <jdenemar@redhat.com>,
	qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 1/4] target/i386: Use simple static property for "model-id"
Date: Mon, 24 Jul 2017 20:04:58 -0300	[thread overview]
Message-ID: <20170724230458.GK2757@localhost.localdomain> (raw)
In-Reply-To: <4c8330a1-8ba8-ff9e-bea2-8670df744e90@redhat.com>

On Mon, Jul 24, 2017 at 11:11:34PM +0200, Paolo Bonzini wrote:
> On 18/07/2017 13:29, Igor Mammedov wrote:
> >> It may add a few additional CPU cycles, but I really doubt we can
> >> find a workload where CPUID speed has measurable impact.  See,
> >> for example, how expensive the kernel KVM CPUID code
> >> (kvm_cpuid(), kvm_find_cpuid_entry()) is.
> > 
> > I don't expect that it would affect KVM, but for TCG any instruction
> > execution is 'fast' path, so I'd leave current cpu_x86_cpuid()
> > not to loose those few cycles, it's not worth sacrifice for the sake of cleanup.
> 
> It's not like this does a QOM property lookup or anything.  I think the
> patch is a good idea.
> 
> Even simpler way to write the cpuid code:
> 
>             int base = (index - 0x80000002) * 16;
>             char model[16];
> 
>             if (strnlen(env->model_id, base) < base) {
>                 memset(model, 0, sizeof(model));
>             } else {
>                 strncpy(model, env->model_id + base, sizeof(model));
>             }
>             *eax = ldl_le_p(&model[0]);
>             *ebx = ldl_le_p(&model[4]);
>             *ecx = ldl_le_p(&model[8]);
>             *edx = ldl_le_p(&model[12]);

Neat.  I will use it in v2.  Thanks!

-- 
Eduardo

  reply	other threads:[~2017-07-24 23:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12 16:20 [Qemu-devel] [PATCH 0/4] Fix SVM and KVM features reported on "max" CPU model Eduardo Habkost
2017-07-12 16:20 ` [Qemu-devel] [PATCH 1/4] target/i386: Use simple static property for "model-id" Eduardo Habkost
2017-07-17 12:03   ` Igor Mammedov
2017-07-17 17:18     ` Eduardo Habkost
2017-07-18 11:29       ` Igor Mammedov
2017-07-24 21:11         ` Paolo Bonzini
2017-07-24 23:04           ` Eduardo Habkost [this message]
2017-07-12 16:20 ` [Qemu-devel] [PATCH 2/4] target/i386: Use host_vendor_fms() in max_x86_cpu_initfn() Eduardo Habkost
2017-07-18 11:48   ` Igor Mammedov
2017-07-12 16:20 ` [Qemu-devel] [PATCH 3/4] target/i386: Define CPUID_MODEL_ID_SZ macro Eduardo Habkost
2017-07-12 16:20 ` [Qemu-devel] [PATCH 4/4] target/i386: Don't use x86_cpu_load_def() on "max" CPU model Eduardo Habkost
2017-07-18 13:27   ` Igor Mammedov
2017-07-19  0:02     ` Eduardo Habkost
2017-07-19  7:23       ` Igor Mammedov

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=20170724230458.GK2757@localhost.localdomain \
    --to=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).