[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/4] target/i386: Use simple static property for
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 1/4] target/i386: Use simple static property for "model-id" |
Date: |
Mon, 24 Jul 2017 23:11:34 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
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]);
Paolo
[Qemu-devel] [PATCH 2/4] target/i386: Use host_vendor_fms() in max_x86_cpu_initfn(), Eduardo Habkost, 2017/07/12
[Qemu-devel] [PATCH 3/4] target/i386: Define CPUID_MODEL_ID_SZ macro, Eduardo Habkost, 2017/07/12
[Qemu-devel] [PATCH 4/4] target/i386: Don't use x86_cpu_load_def() on "max" CPU model, Eduardo Habkost, 2017/07/12