Re: [PATCH 1/4] x86: introduce hypervisor_cpuid_base()

2013-07-23 Thread H. Peter Anvin
On 07/23/2013 09:44 PM, Jason Wang wrote: > > Since it's just a minor optimization. How about just keep using the > strcmp()? > It's more that it enables the rest of the cleanup, making the code easier to read. -hpa -- To unsubscribe from this list: send the line "unsubscribe kvm" in t

Re: [PATCH 1/4] x86: introduce hypervisor_cpuid_base()

2013-07-23 Thread Jason Wang
On 07/24/2013 12:03 AM, H. Peter Anvin wrote: > On 07/23/2013 04:16 AM, Paolo Bonzini wrote: >> That's nicer, though strcmp is what the replaced code used to do in >> patches 2 and 3. >> >> Note that memcmp requires the caller to use "KVMKVMKVM\0\0" as the >> signature (or alternatively hypervisor_

Re: [PATCH 1/4] x86: introduce hypervisor_cpuid_base()

2013-07-23 Thread Jason Wang
On 07/23/2013 09:48 PM, Gleb Natapov wrote: > On Tue, Jul 23, 2013 at 05:41:02PM +0800, Jason Wang wrote: >> > This patch introduce hypervisor_cpuid_base() which loop test the hypervisor >> > existence function until the signature match and check the number of >> > leaves if >> > required. This co

Re: [PATCH 1/4] x86: introduce hypervisor_cpuid_base()

2013-07-23 Thread H. Peter Anvin
On 07/23/2013 04:16 AM, Paolo Bonzini wrote: > > That's nicer, though strcmp is what the replaced code used to do in > patches 2 and 3. > > Note that memcmp requires the caller to use "KVMKVMKVM\0\0" as the > signature (or alternatively hypervisor_cpuid_base can copy the argument > into another 1

Re: [PATCH 1/4] x86: introduce hypervisor_cpuid_base()

2013-07-23 Thread Gleb Natapov
On Tue, Jul 23, 2013 at 05:41:02PM +0800, Jason Wang wrote: > This patch introduce hypervisor_cpuid_base() which loop test the hypervisor > existence function until the signature match and check the number of leaves if > required. This could be used by Xen/KVM guest to detect the existence of > hyp

Re: [PATCH 1/4] x86: introduce hypervisor_cpuid_base()

2013-07-23 Thread Paolo Bonzini
Il 23/07/2013 12:04, H. Peter Anvin ha scritto: > On 07/23/2013 02:41 AM, Jason Wang wrote: >> >> +static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t >> leaves) >> +{ >> +uint32_t base, eax, ebx, ecx, edx; >> +char signature[13]; >> + >> +for (base = 0x4000; b

Re: [PATCH 1/4] x86: introduce hypervisor_cpuid_base()

2013-07-23 Thread H. Peter Anvin
On 07/23/2013 02:41 AM, Jason Wang wrote: > > +static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t > leaves) > +{ > + uint32_t base, eax, ebx, ecx, edx; > + char signature[13]; > + > + for (base = 0x4000; base < 0x4001; base += 0x100) { > + cpui

[PATCH 1/4] x86: introduce hypervisor_cpuid_base()

2013-07-23 Thread Jason Wang
This patch introduce hypervisor_cpuid_base() which loop test the hypervisor existence function until the signature match and check the number of leaves if required. This could be used by Xen/KVM guest to detect the existence of hypervisor. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin"