All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests
@ 2017-09-11 15:20 Gonglei
  2017-09-11 15:27 ` no-reply
  2017-09-11 18:37 ` Eduardo Habkost
  0 siblings, 2 replies; 6+ messages in thread
From: Gonglei @ 2017-09-11 15:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: mst, pbonzini, rth, ehabkost, mtosatti, vrozenfe, weidong.huang, Gonglei

Starting with Windows Server 2012 and Windows 8, if
CPUID.40000005.EAX contains a value of -1, Windows assumes specific
limit to the number of VPs. In this case, Windows Server 2012
guest VMs may use more than 64 VPs, up to the maximum supported
number of processors applicable to the specific Windows
version being used.

https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs

For compatibility, Let's introduce a new property for X86CPU,
named "x-hv-max-vps" as Eduardo's suggestion, and set it
to 0x40 before machine 2.10.

(The "x-" prefix indicates that the property is not supposed to
be a stable user interface.)

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 include/hw/i386/pc.h |  5 +++++
 target/i386/cpu.c    |  1 +
 target/i386/cpu.h    |  2 ++
 target/i386/kvm.c    | 15 ++++++++++++++-
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8226904..087d184 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -371,6 +371,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
 
 #define PC_COMPAT_2_10 \
     HW_COMPAT_2_10 \
+    {\
+        .driver   = TYPE_X86_CPU,\
+        .property = "x-hv-max-vps",\
+        .value    = "0x40",\
+    },
 
 #define PC_COMPAT_2_9 \
     HW_COMPAT_2_9 \
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 69676e1..2702485 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4145,6 +4145,7 @@ static Property x86_cpu_properties[] = {
                      false),
     DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true),
     DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true),
+    DEFINE_PROP_INT32("x-hv-max-vps", X86CPU, hv_max_vps, -1),
     DEFINE_PROP_END_OF_LIST()
 };
 
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 525d35d..5c726f3 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1282,6 +1282,8 @@ struct X86CPU {
     int32_t socket_id;
     int32_t core_id;
     int32_t thread_id;
+
+    int32_t hv_max_vps;
 };
 
 static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 6db7783..a898bef 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -751,7 +751,20 @@ int kvm_arch_init_vcpu(CPUState *cs)
 
         c = &cpuid_data.entries[cpuid_i++];
         c->function = HYPERV_CPUID_IMPLEMENT_LIMITS;
-        c->eax = 0x40;
+
+        /*
+         * From "Requirements for Implementing the Microsoft
+         * Hypervisor Interface":
+         * https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
+         *
+         * "Starting with Windows Server 2012 and Windows 8, if
+         * CPUID.40000005.EAX contains a value of -1, Windows assumes
+         * specific limit to the number of VPs. In this case, Windows
+         * Server 2012 guest VMs may use more than 64 VPs, up to the
+         * maximum supported number of processors applicable to the
+         * specific Windows version being used."
+         */
+        c->eax = cpu->hv_max_vps;
         c->ebx = 0x40;
 
         kvm_base = KVM_CPUID_SIGNATURE_NEXT;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests
  2017-09-11 15:20 [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests Gonglei
@ 2017-09-11 15:27 ` no-reply
  2017-09-11 18:37 ` Eduardo Habkost
  1 sibling, 0 replies; 6+ messages in thread
From: no-reply @ 2017-09-11 15:27 UTC (permalink / raw)
  To: arei.gonglei
  Cc: famz, qemu-devel, weidong.huang, ehabkost, mst, mtosatti,
	vrozenfe, pbonzini, rth

Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests
Message-id: 1505143227-14324-1-git-send-email-arei.gonglei@huawei.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/1505143227-14324-1-git-send-email-arei.gonglei@huawei.com -> patchew/1505143227-14324-1-git-send-email-arei.gonglei@huawei.com
Switched to a new branch 'test'
a1df039c0c i386/cpu/hyperv: support over 64 vcpus for windows guests

=== OUTPUT BEGIN ===
Checking PATCH 1/1: i386/cpu/hyperv: support over 64 vcpus for windows guests...
ERROR: line over 90 characters
#79: FILE: target/i386/kvm.c:758:
+         * https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs

total: 1 errors, 0 warnings, 47 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests
  2017-09-11 15:20 [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests Gonglei
  2017-09-11 15:27 ` no-reply
@ 2017-09-11 18:37 ` Eduardo Habkost
  2017-09-12  1:41   ` Gonglei (Arei)
  1 sibling, 1 reply; 6+ messages in thread
From: Eduardo Habkost @ 2017-09-11 18:37 UTC (permalink / raw)
  To: Gonglei; +Cc: qemu-devel, mst, pbonzini, rth, mtosatti, vrozenfe, weidong.huang

On Mon, Sep 11, 2017 at 11:20:27PM +0800, Gonglei wrote:
> Starting with Windows Server 2012 and Windows 8, if
> CPUID.40000005.EAX contains a value of -1, Windows assumes specific
> limit to the number of VPs. In this case, Windows Server 2012
> guest VMs may use more than 64 VPs, up to the maximum supported
> number of processors applicable to the specific Windows
> version being used.
> 
> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
> 
> For compatibility, Let's introduce a new property for X86CPU,
> named "x-hv-max-vps" as Eduardo's suggestion, and set it
> to 0x40 before machine 2.10.
> 
> (The "x-" prefix indicates that the property is not supposed to
> be a stable user interface.)
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  include/hw/i386/pc.h |  5 +++++
>  target/i386/cpu.c    |  1 +
>  target/i386/cpu.h    |  2 ++
>  target/i386/kvm.c    | 15 ++++++++++++++-
>  4 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 8226904..087d184 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -371,6 +371,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
>  
>  #define PC_COMPAT_2_10 \
>      HW_COMPAT_2_10 \
> +    {\
> +        .driver   = TYPE_X86_CPU,\
> +        .property = "x-hv-max-vps",\
> +        .value    = "0x40",\
> +    },
>  
>  #define PC_COMPAT_2_9 \
>      HW_COMPAT_2_9 \
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 69676e1..2702485 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -4145,6 +4145,7 @@ static Property x86_cpu_properties[] = {
>                       false),
>      DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU, vmware_cpuid_freq, true),
>      DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true),
> +    DEFINE_PROP_INT32("x-hv-max-vps", X86CPU, hv_max_vps, -1),
>      DEFINE_PROP_END_OF_LIST()
>  };
>  
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index 525d35d..5c726f3 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -1282,6 +1282,8 @@ struct X86CPU {
>      int32_t socket_id;
>      int32_t core_id;
>      int32_t thread_id;
> +
> +    int32_t hv_max_vps;
>  };
>  
>  static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 6db7783..a898bef 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -751,7 +751,20 @@ int kvm_arch_init_vcpu(CPUState *cs)
>  
>          c = &cpuid_data.entries[cpuid_i++];
>          c->function = HYPERV_CPUID_IMPLEMENT_LIMITS;
> -        c->eax = 0x40;
> +
> +        /*
> +         * From "Requirements for Implementing the Microsoft
> +         * Hypervisor Interface":
> +         * https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs
> +         *
> +         * "Starting with Windows Server 2012 and Windows 8, if
> +         * CPUID.40000005.EAX contains a value of -1, Windows assumes
> +         * specific limit to the number of VPs. In this case, Windows
> +         * Server 2012 guest VMs may use more than 64 VPs, up to the
> +         * maximum supported number of processors applicable to the
> +         * specific Windows version being used."
> +         */

I would place this comment above the DEFINE_PROP_INT32
declaration, as its purpose is to explain the -1 default.


> +        c->eax = cpu->hv_max_vps;
>          c->ebx = 0x40;
>  
>          kvm_base = KVM_CPUID_SIGNATURE_NEXT;
> -- 
> 1.8.3.1
> 
> 

-- 
Eduardo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests
  2017-09-11 18:37 ` Eduardo Habkost
@ 2017-09-12  1:41   ` Gonglei (Arei)
  2017-09-12  7:58     ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Gonglei (Arei) @ 2017-09-12  1:41 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: qemu-devel, mst, pbonzini, rth, mtosatti, vrozenfe, Huangweidong (C)


> -----Original Message-----
> From: Eduardo Habkost [mailto:ehabkost@redhat.com]
> Sent: Tuesday, September 12, 2017 2:38 AM
> To: Gonglei (Arei)
> Cc: qemu-devel@nongnu.org; mst@redhat.com; pbonzini@redhat.com;
> rth@twiddle.net; mtosatti@redhat.com; vrozenfe@redhat.com;
> Huangweidong (C)
> Subject: Re: [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows
> guests
> 
> On Mon, Sep 11, 2017 at 11:20:27PM +0800, Gonglei wrote:
> > Starting with Windows Server 2012 and Windows 8, if
> > CPUID.40000005.EAX contains a value of -1, Windows assumes specific
> > limit to the number of VPs. In this case, Windows Server 2012
> > guest VMs may use more than 64 VPs, up to the maximum supported
> > number of processors applicable to the specific Windows
> > version being used.
> >
> >
> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/referenc
> e/tlfs
> >
> > For compatibility, Let's introduce a new property for X86CPU,
> > named "x-hv-max-vps" as Eduardo's suggestion, and set it
> > to 0x40 before machine 2.10.
> >
> > (The "x-" prefix indicates that the property is not supposed to
> > be a stable user interface.)
> >
> > Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> > ---
> >  include/hw/i386/pc.h |  5 +++++
> >  target/i386/cpu.c    |  1 +
> >  target/i386/cpu.h    |  2 ++
> >  target/i386/kvm.c    | 15 ++++++++++++++-
> >  4 files changed, 22 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> > index 8226904..087d184 100644
> > --- a/include/hw/i386/pc.h
> > +++ b/include/hw/i386/pc.h
> > @@ -371,6 +371,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *,
> uint64_t *);
> >
> >  #define PC_COMPAT_2_10 \
> >      HW_COMPAT_2_10 \
> > +    {\
> > +        .driver   = TYPE_X86_CPU,\
> > +        .property = "x-hv-max-vps",\
> > +        .value    = "0x40",\
> > +    },
> >
> >  #define PC_COMPAT_2_9 \
> >      HW_COMPAT_2_9 \
> > diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> > index 69676e1..2702485 100644
> > --- a/target/i386/cpu.c
> > +++ b/target/i386/cpu.c
> > @@ -4145,6 +4145,7 @@ static Property x86_cpu_properties[] = {
> >                       false),
> >      DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU,
> vmware_cpuid_freq, true),
> >      DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true),
> > +    DEFINE_PROP_INT32("x-hv-max-vps", X86CPU, hv_max_vps, -1),
> >      DEFINE_PROP_END_OF_LIST()
> >  };
> >
> > diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> > index 525d35d..5c726f3 100644
> > --- a/target/i386/cpu.h
> > +++ b/target/i386/cpu.h
> > @@ -1282,6 +1282,8 @@ struct X86CPU {
> >      int32_t socket_id;
> >      int32_t core_id;
> >      int32_t thread_id;
> > +
> > +    int32_t hv_max_vps;
> >  };
> >
> >  static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
> > diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> > index 6db7783..a898bef 100644
> > --- a/target/i386/kvm.c
> > +++ b/target/i386/kvm.c
> > @@ -751,7 +751,20 @@ int kvm_arch_init_vcpu(CPUState *cs)
> >
> >          c = &cpuid_data.entries[cpuid_i++];
> >          c->function = HYPERV_CPUID_IMPLEMENT_LIMITS;
> > -        c->eax = 0x40;
> > +
> > +        /*
> > +         * From "Requirements for Implementing the Microsoft
> > +         * Hypervisor Interface":
> > +         *
> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/referenc
> e/tlfs
> > +         *
> > +         * "Starting with Windows Server 2012 and Windows 8, if
> > +         * CPUID.40000005.EAX contains a value of -1, Windows assumes
> > +         * specific limit to the number of VPs. In this case, Windows
> > +         * Server 2012 guest VMs may use more than 64 VPs, up to the
> > +         * maximum supported number of processors applicable to the
> > +         * specific Windows version being used."
> > +         */
> 
> I would place this comment above the DEFINE_PROP_INT32
> declaration, as its purpose is to explain the -1 default.
> 
Fine, do I need to send v2? Or you adjust it directly?

Thanks,
-Gonglei
> 
> > +        c->eax = cpu->hv_max_vps;
> >          c->ebx = 0x40;
> >
> >          kvm_base = KVM_CPUID_SIGNATURE_NEXT;
> > --
> > 1.8.3.1
> >
> >
> 
> --
> Eduardo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests
  2017-09-12  1:41   ` Gonglei (Arei)
@ 2017-09-12  7:58     ` Paolo Bonzini
  2017-09-12 12:38       ` Gonglei (Arei)
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2017-09-12  7:58 UTC (permalink / raw)
  To: Gonglei (Arei), Eduardo Habkost
  Cc: qemu-devel, mst, rth, mtosatti, vrozenfe, Huangweidong (C)

On 12/09/2017 03:41, Gonglei (Arei) wrote:
> 
>> -----Original Message-----
>> From: Eduardo Habkost [mailto:ehabkost@redhat.com]
>> Sent: Tuesday, September 12, 2017 2:38 AM
>> To: Gonglei (Arei)
>> Cc: qemu-devel@nongnu.org; mst@redhat.com; pbonzini@redhat.com;
>> rth@twiddle.net; mtosatti@redhat.com; vrozenfe@redhat.com;
>> Huangweidong (C)
>> Subject: Re: [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows
>> guests
>>
>> On Mon, Sep 11, 2017 at 11:20:27PM +0800, Gonglei wrote:
>>> Starting with Windows Server 2012 and Windows 8, if
>>> CPUID.40000005.EAX contains a value of -1, Windows assumes specific
>>> limit to the number of VPs. In this case, Windows Server 2012
>>> guest VMs may use more than 64 VPs, up to the maximum supported
>>> number of processors applicable to the specific Windows
>>> version being used.
>>>
>>>
>> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/referenc
>> e/tlfs
>>>
>>> For compatibility, Let's introduce a new property for X86CPU,
>>> named "x-hv-max-vps" as Eduardo's suggestion, and set it
>>> to 0x40 before machine 2.10.
>>>
>>> (The "x-" prefix indicates that the property is not supposed to
>>> be a stable user interface.)
>>>
>>> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
>>> ---
>>>  include/hw/i386/pc.h |  5 +++++
>>>  target/i386/cpu.c    |  1 +
>>>  target/i386/cpu.h    |  2 ++
>>>  target/i386/kvm.c    | 15 ++++++++++++++-
>>>  4 files changed, 22 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
>>> index 8226904..087d184 100644
>>> --- a/include/hw/i386/pc.h
>>> +++ b/include/hw/i386/pc.h
>>> @@ -371,6 +371,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *,
>> uint64_t *);
>>>
>>>  #define PC_COMPAT_2_10 \
>>>      HW_COMPAT_2_10 \
>>> +    {\
>>> +        .driver   = TYPE_X86_CPU,\
>>> +        .property = "x-hv-max-vps",\
>>> +        .value    = "0x40",\
>>> +    },
>>>
>>>  #define PC_COMPAT_2_9 \
>>>      HW_COMPAT_2_9 \
>>> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
>>> index 69676e1..2702485 100644
>>> --- a/target/i386/cpu.c
>>> +++ b/target/i386/cpu.c
>>> @@ -4145,6 +4145,7 @@ static Property x86_cpu_properties[] = {
>>>                       false),
>>>      DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU,
>> vmware_cpuid_freq, true),
>>>      DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true),
>>> +    DEFINE_PROP_INT32("x-hv-max-vps", X86CPU, hv_max_vps, -1),
>>>      DEFINE_PROP_END_OF_LIST()
>>>  };
>>>
>>> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
>>> index 525d35d..5c726f3 100644
>>> --- a/target/i386/cpu.h
>>> +++ b/target/i386/cpu.h
>>> @@ -1282,6 +1282,8 @@ struct X86CPU {
>>>      int32_t socket_id;
>>>      int32_t core_id;
>>>      int32_t thread_id;
>>> +
>>> +    int32_t hv_max_vps;
>>>  };
>>>
>>>  static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
>>> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
>>> index 6db7783..a898bef 100644
>>> --- a/target/i386/kvm.c
>>> +++ b/target/i386/kvm.c
>>> @@ -751,7 +751,20 @@ int kvm_arch_init_vcpu(CPUState *cs)
>>>
>>>          c = &cpuid_data.entries[cpuid_i++];
>>>          c->function = HYPERV_CPUID_IMPLEMENT_LIMITS;
>>> -        c->eax = 0x40;
>>> +
>>> +        /*
>>> +         * From "Requirements for Implementing the Microsoft
>>> +         * Hypervisor Interface":
>>> +         *
>> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/referenc
>> e/tlfs
>>> +         *
>>> +         * "Starting with Windows Server 2012 and Windows 8, if
>>> +         * CPUID.40000005.EAX contains a value of -1, Windows assumes
>>> +         * specific limit to the number of VPs. In this case, Windows
>>> +         * Server 2012 guest VMs may use more than 64 VPs, up to the
>>> +         * maximum supported number of processors applicable to the
>>> +         * specific Windows version being used."
>>> +         */
>>
>> I would place this comment above the DEFINE_PROP_INT32
>> declaration, as its purpose is to explain the -1 default.
>>
> Fine, do I need to send v2? Or you adjust it directly?

Done, also changing the sentence to "Windows assumes that the hypervisor
imposes no specific limit to the number of VPs" as in the Microsoft
document.

Paolo

> 
> Thanks,
> -Gonglei
>>
>>> +        c->eax = cpu->hv_max_vps;
>>>          c->ebx = 0x40;
>>>
>>>          kvm_base = KVM_CPUID_SIGNATURE_NEXT;
>>> --
>>> 1.8.3.1
>>>
>>>
>>
>> --
>> Eduardo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests
  2017-09-12  7:58     ` Paolo Bonzini
@ 2017-09-12 12:38       ` Gonglei (Arei)
  0 siblings, 0 replies; 6+ messages in thread
From: Gonglei (Arei) @ 2017-09-12 12:38 UTC (permalink / raw)
  To: Paolo Bonzini, Eduardo Habkost
  Cc: qemu-devel, mst, rth, mtosatti, vrozenfe, Huangweidong (C)

> 
> On 12/09/2017 03:41, Gonglei (Arei) wrote:
> >
> >> -----Original Message-----
> >> From: Eduardo Habkost [mailto:ehabkost@redhat.com]
> >> Sent: Tuesday, September 12, 2017 2:38 AM
> >> To: Gonglei (Arei)
> >> Cc: qemu-devel@nongnu.org; mst@redhat.com; pbonzini@redhat.com;
> >> rth@twiddle.net; mtosatti@redhat.com; vrozenfe@redhat.com;
> >> Huangweidong (C)
> >> Subject: Re: [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows
> >> guests
> >>
> >> On Mon, Sep 11, 2017 at 11:20:27PM +0800, Gonglei wrote:
> >>> Starting with Windows Server 2012 and Windows 8, if
> >>> CPUID.40000005.EAX contains a value of -1, Windows assumes specific
> >>> limit to the number of VPs. In this case, Windows Server 2012
> >>> guest VMs may use more than 64 VPs, up to the maximum supported
> >>> number of processors applicable to the specific Windows
> >>> version being used.
> >>>
> >>>
> >>
> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/referenc
> >> e/tlfs
> >>>
> >>> For compatibility, Let's introduce a new property for X86CPU,
> >>> named "x-hv-max-vps" as Eduardo's suggestion, and set it
> >>> to 0x40 before machine 2.10.
> >>>
> >>> (The "x-" prefix indicates that the property is not supposed to
> >>> be a stable user interface.)
> >>>
> >>> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> >>> ---
> >>>  include/hw/i386/pc.h |  5 +++++
> >>>  target/i386/cpu.c    |  1 +
> >>>  target/i386/cpu.h    |  2 ++
> >>>  target/i386/kvm.c    | 15 ++++++++++++++-
> >>>  4 files changed, 22 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> >>> index 8226904..087d184 100644
> >>> --- a/include/hw/i386/pc.h
> >>> +++ b/include/hw/i386/pc.h
> >>> @@ -371,6 +371,11 @@ bool e820_get_entry(int, uint32_t, uint64_t *,
> >> uint64_t *);
> >>>
> >>>  #define PC_COMPAT_2_10 \
> >>>      HW_COMPAT_2_10 \
> >>> +    {\
> >>> +        .driver   = TYPE_X86_CPU,\
> >>> +        .property = "x-hv-max-vps",\
> >>> +        .value    = "0x40",\
> >>> +    },
> >>>
> >>>  #define PC_COMPAT_2_9 \
> >>>      HW_COMPAT_2_9 \
> >>> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> >>> index 69676e1..2702485 100644
> >>> --- a/target/i386/cpu.c
> >>> +++ b/target/i386/cpu.c
> >>> @@ -4145,6 +4145,7 @@ static Property x86_cpu_properties[] = {
> >>>                       false),
> >>>      DEFINE_PROP_BOOL("vmware-cpuid-freq", X86CPU,
> >> vmware_cpuid_freq, true),
> >>>      DEFINE_PROP_BOOL("tcg-cpuid", X86CPU, expose_tcg, true),
> >>> +    DEFINE_PROP_INT32("x-hv-max-vps", X86CPU, hv_max_vps, -1),
> >>>      DEFINE_PROP_END_OF_LIST()
> >>>  };
> >>>
> >>> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> >>> index 525d35d..5c726f3 100644
> >>> --- a/target/i386/cpu.h
> >>> +++ b/target/i386/cpu.h
> >>> @@ -1282,6 +1282,8 @@ struct X86CPU {
> >>>      int32_t socket_id;
> >>>      int32_t core_id;
> >>>      int32_t thread_id;
> >>> +
> >>> +    int32_t hv_max_vps;
> >>>  };
> >>>
> >>>  static inline X86CPU *x86_env_get_cpu(CPUX86State *env)
> >>> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> >>> index 6db7783..a898bef 100644
> >>> --- a/target/i386/kvm.c
> >>> +++ b/target/i386/kvm.c
> >>> @@ -751,7 +751,20 @@ int kvm_arch_init_vcpu(CPUState *cs)
> >>>
> >>>          c = &cpuid_data.entries[cpuid_i++];
> >>>          c->function = HYPERV_CPUID_IMPLEMENT_LIMITS;
> >>> -        c->eax = 0x40;
> >>> +
> >>> +        /*
> >>> +         * From "Requirements for Implementing the Microsoft
> >>> +         * Hypervisor Interface":
> >>> +         *
> >>
> https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/referenc
> >> e/tlfs
> >>> +         *
> >>> +         * "Starting with Windows Server 2012 and Windows 8, if
> >>> +         * CPUID.40000005.EAX contains a value of -1, Windows
> assumes
> >>> +         * specific limit to the number of VPs. In this case, Windows
> >>> +         * Server 2012 guest VMs may use more than 64 VPs, up to the
> >>> +         * maximum supported number of processors applicable to the
> >>> +         * specific Windows version being used."
> >>> +         */
> >>
> >> I would place this comment above the DEFINE_PROP_INT32
> >> declaration, as its purpose is to explain the -1 default.
> >>
> > Fine, do I need to send v2? Or you adjust it directly?
> 
> Done, also changing the sentence to "Windows assumes that the hypervisor
> imposes no specific limit to the number of VPs" as in the Microsoft
> document.
> 
> Paolo
> 
Nice, thanks!

Regards,
-Gonglei


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-12 12:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 15:20 [Qemu-devel] [PATCH] i386/cpu/hyperv: support over 64 vcpus for windows guests Gonglei
2017-09-11 15:27 ` no-reply
2017-09-11 18:37 ` Eduardo Habkost
2017-09-12  1:41   ` Gonglei (Arei)
2017-09-12  7:58     ` Paolo Bonzini
2017-09-12 12:38       ` Gonglei (Arei)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.