1GB hugepages and intel_xc_cpuid_policy by default disables it.
Hey,
It occured to me that when booting Linux HVM guests, the 1GB hugepage cpuid is not exposed. One needs to manually do:
cpuid= ['0x80000001:edx=xxxxx1xxxxxxxxxxxxxxxxxxxxxxxxxx']
or
cpuid="host,page1gb=k"
(see http://lists.xenproject.org/archives/html/xen-users/2013-09/msg00083.html
for some discussion about it).
The machine I am using is supporting it:
(XEN) HVM: HAP page sizes: 4kB, 2MB, 1GB
and this is the only way to get hugepages working (for reference here is what I have in the guest command line:
"default_hugepagesz=1G hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=100" and without this cpuid I get:
hugepagesz: Unsupported page size 1024 M
because the 1GB flag is not exposed.
I was wondering why we don't check the host cpuid and set the 1GB flag (pdpe1gb) for those cases? It seems that all the pieces are in place for this to work?
Thanks!
Quoted 9 lines · Konrad Rzeszutek Wilk
Hey,
It occured to me that when booting Linux HVM guests, the 1GB hugepage cpuid is not exposed. One needs to manually do:
cpuid= ['0x80000001:edx=xxxxx1xxxxxxxxxxxxxxxxxxxxxxxxxx']
or
cpuid="host,page1gb=k"
Quoted 6 lines
(see http://lists.xenproject.org/archives/html/xen-users/2013-09/msg00083.html
for some discussion about it).The machine I am using is supporting it:
(XEN) HVM: HAP page sizes: 4kB, 2MB, 1GB
HAP page sizes is unrelated to the page sizes supported in "first stage" paging, although I suppose it is unlikely for EPT to support it without the primary translation supporting it.
Quoted 11 lines
and this is the only way to get hugepages working (for reference here is what I have in the guest command line:
"default_hugepagesz=1G hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=100" and without this cpuid I get:
hugepagesz: Unsupported page size 1024 Mbecause the 1GB flag is not exposed.
I was wondering why we don't check the host cpuid and set the 1GB flag (pdpe1gb) for those cases? It seems that all the pieces are in place for this to work?
The hypervisor currently contains :
/* Hide 1GB-superpage feature if we can't emulate it. */
if (!hvm_pse1gb_supported(d))
*edx &= ~cpufeat_mask(X86_FEATURE_PAGE1GB);So I think it would be safe to enable this by default in userspace and let the hypervisor clear it if unsafe. But TBH the whole cpuid policy is a mystery to me. Can you cc some likely hypervisor side people on your patch for confirmation please.
Ian.
Quoted 15 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 11 lines · Konrad Rzeszutek Wilk
and this is the only way to get hugepages working (for reference here is what I have in the guest command line:
"default_hugepagesz=1G hugepagesz=1G hugepages=2 hugepagesz=2M hugepages=100" and without this cpuid I get:
hugepagesz: Unsupported page size 1024 Mbecause the 1GB flag is not exposed.
I was wondering why we don't check the host cpuid and set the 1GB flag (pdpe1gb) for those cases? It seems that all the pieces are in place for this to work?
The hypervisor currently contains :
Quoted 8 lines
/* Hide 1GB-superpage feature if we can't emulate it. */ if (!hvm_pse1gb_supported(d)) *edx &= ~cpufeat_mask(X86_FEATURE_PAGE1GB);So I think it would be safe to enable this by default in userspace and let the hypervisor clear it if unsafe. But TBH the whole cpuid policy is a mystery to me. Can you cc some likely hypervisor side people on your patch for confirmation please.
In fact I can't see where this would be forced off: xc_cpuid_x86.c only does so in the PV case, and all hvm_pse1gb_supported() is that the CPU supports it and the domain uses HAP.
Jan
Quoted 3 lines · Jan Beulich
In fact I can't see where this would be forced off:
xc_cpuid_x86.conly does so in the PV case, and allhvm_pse1gb_supported()is that the CPU supports it and the domain uses HAP.
Took me a while to spot it too:
static void intel_xc_cpuid_policy(
[...]
case 0x80000001: {
int is_64bit = hypervisor_is_64bit(xch) && is_pae;
/* Only a few features are advertised in Intel's 0x80000001. */
regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
bitmaskof(X86_FEATURE_ABM);
regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_RDTSCP) : 0));
break;
}Which masks anything which is not explicitly mentioned. (PAGE1GB is in regs[3], I think).
The AMD version is more permissive:
regs[3] &= (0x0183f3ff | /* features shared with 0x00000001:EDX */
(is_pae ? bitmaskof(X86_FEATURE_NX) : 0) |
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) |
bitmaskof(X86_FEATURE_SYSCALL) |
bitmaskof(X86_FEATURE_MP) |
bitmaskof(X86_FEATURE_MMXEXT) |
bitmaskof(X86_FEATURE_FFXSR) |
bitmaskof(X86_FEATURE_3DNOW) |
bitmaskof(X86_FEATURE_3DNOWEXT));(but I didn't check if PAGE1GB is in that magic number...)
Ian.
Quoted 23 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 3 lines · Jan Beulich
In fact I can't see where this would be forced off:
xc_cpuid_x86.conly does so in the PV case, and allhvm_pse1gb_supported()is that the CPU supports it and the domain uses HAP.Took me a while to spot it too:
static void intel_xc_cpuid_policy(
[...]case 0x80000001: { int is_64bit = hypervisor_is_64bit(xch) && is_pae; /* Only a few features are advertised in Intel's 0x80000001. */ regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) | bitmaskof(X86_FEATURE_ABM); regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_RDTSCP) : 0)); break; }
Quoted 2 lines
Which masks anything which is not explicitly mentioned. (PAGE1GB is in regs[3], I think).
Ah, okay. The funs of white listing on HVM vs black listing on PV again.
Quoted 12 lines
The AMD version is more permissive:
regs[3] &= (0x0183f3ff | /* features shared with 0x00000001:EDX */ (is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | bitmaskof(X86_FEATURE_SYSCALL) | bitmaskof(X86_FEATURE_MP) | bitmaskof(X86_FEATURE_MMXEXT) | bitmaskof(X86_FEATURE_FFXSR) | bitmaskof(X86_FEATURE_3DNOW) | bitmaskof(X86_FEATURE_3DNOWEXT));
Quoted 1 line
(but I didn't check if PAGE1GB is in that magic number...)
It's not - it's bit 26.
Jan
Quoted 41 lines · Jan Beulich
Quoted 23 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 3 lines · Jan Beulich
In fact I can't see where this would be forced off:
xc_cpuid_x86.conly does so in the PV case, and allhvm_pse1gb_supported()is that the CPU supports it and the domain uses HAP.Took me a while to spot it too:
static void intel_xc_cpuid_policy(
[...]case 0x80000001: { int is_64bit = hypervisor_is_64bit(xch) && is_pae; /* Only a few features are advertised in Intel's 0x80000001. */ regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) | bitmaskof(X86_FEATURE_ABM); regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_RDTSCP) : 0)); break; }Quoted 2 lines
Which masks anything which is not explicitly mentioned. (PAGE1GB is in regs[3], I think).
Ah, okay. The funs of white listing on HVM vs black listing on PV again.
Quoted 12 lines
The AMD version is more permissive:
regs[3] &= (0x0183f3ff | /* features shared with 0x00000001:EDX */ (is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | bitmaskof(X86_FEATURE_SYSCALL) | bitmaskof(X86_FEATURE_MP) | bitmaskof(X86_FEATURE_MMXEXT) | bitmaskof(X86_FEATURE_FFXSR) | bitmaskof(X86_FEATURE_3DNOW) | bitmaskof(X86_FEATURE_3DNOWEXT));
Quoted 3 lines
Quoted 1 line
(but I didn't check if PAGE1GB is in that magic number...)
It's not - it's bit 26.
So.. it sounds to me like everybody is in the agreement that this is the right thing to do (enable it if the hypervisor has it enabled)?
And the next thing is actually come up with a patch to do some of this plumbing - naturally for Xen 4.5?
Quoted 3 lines
Jan
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
So.. it sounds to me like everybody is in the agreement that this is the right thing to do (enable it if the hypervisor has it enabled)?
And the next thing is actually come up with a patch to do some of this plumbing - naturally for Xen 4.5?
Yes, so would I think.
Jan
Konrad Rzeszutek Wilk wrote on 2014-01-16:
Quoted 48 lines · Jan Beulich
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 3 lines · Jan Beulich
In fact I can't see where this would be forced off:
xc_cpuid_x86.conly does so in the PV case, and allhvm_pse1gb_supported()is that the CPU supports it and the domain uses HAP.Quoted 7 lines
Quoted 7 lines
Took me a while to spot it too:
static void intel_xc_cpuid_policy( [...]case 0x80000001: { int is_64bit = hypervisor_is_64bit(xch) && is_pae; /* Only a few features are advertised in Intel's 0x80000001. */ regs[2] &= (is_64bit ?
bitmaskof(X86_FEATURE_LAHF_LM): 0) |Quoted 1 line
Quoted 1 line
bitmaskof(X86_FEATURE_ABM);Quoted 2 lines
Quoted 2 lines
regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) :0)
|
Quoted 4 lines
Quoted 4 lines
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) | (is_64bit ?
bitmaskof(X86_FEATURE_RDTSCP): 0));Quoted 12 lines
Quoted 5 lines
break; }Which masks anything which is not explicitly mentioned. (PAGE1GB is in regs[3], I think).
Ah, okay. The funs of white listing on HVM vs black listing on PV again.
Quoted 3 lines
The AMD version is more permissive:
regs[3] &= (0x0183f3ff | /* features shared with0x00000001:EDX */
Quoted 10 lines
Quoted 9 lines
(is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | bitmaskof(X86_FEATURE_SYSCALL) | bitmaskof(X86_FEATURE_MP) | bitmaskof(X86_FEATURE_MMXEXT) | bitmaskof(X86_FEATURE_FFXSR) | bitmaskof(X86_FEATURE_3DNOW) | bitmaskof(X86_FEATURE_3DNOWEXT));(but I didn't check if PAGE1GB is in that magic number...)
Quoted 7 lines
Quoted 1 line
It's not - it's bit 26.
So.. it sounds to me like everybody is in the agreement that this is the right thing to do (enable it if the hypervisor has it enabled)?
And the next thing is actually come up with a patch to do some of this plumbing - naturally for Xen 4.5?
Hi, Konrad,
Is there any patch to turn on the 1GB hugepages? If no, we are happy to give a patch to do it.
Quoted 8 lines
Quoted 3 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Best regards,
Yang
Quoted 54 lines · Yang Z
Konrad Rzeszutek Wilk wrote on 2014-01-16:
Quoted 53 lines · Jan Beulich
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line · Ian Campbell
Quoted 3 lines · Jan Beulich
In fact I can't see where this would be forced off:
xc_cpuid_x86.conly does so in the PV case, and allhvm_pse1gb_supported()is that the CPU supports it and the domain uses HAP.Quoted 7 lines
Quoted 7 lines
Took me a while to spot it too:
static void intel_xc_cpuid_policy( [...]case 0x80000001: { int is_64bit = hypervisor_is_64bit(xch) && is_pae; /* Only a few features are advertised in Intel's 0x80000001. */ regs[2] &= (is_64bit ?
bitmaskof(X86_FEATURE_LAHF_LM): 0) |Quoted 1 line
Quoted 1 line
bitmaskof(X86_FEATURE_ABM);Quoted 2 lines
Quoted 2 lines
regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) :0)
|
Quoted 4 lines
Quoted 4 lines
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) | (is_64bit ?
bitmaskof(X86_FEATURE_RDTSCP): 0));Quoted 12 lines
Quoted 5 lines
break; }Which masks anything which is not explicitly mentioned. (PAGE1GB is in regs[3], I think).
Ah, okay. The funs of white listing on HVM vs black listing on PV again.
Quoted 3 lines
The AMD version is more permissive:
regs[3] &= (0x0183f3ff | /* features shared with0x00000001:EDX */
Quoted 11 lines
Quoted 9 lines
(is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | bitmaskof(X86_FEATURE_SYSCALL) | bitmaskof(X86_FEATURE_MP) | bitmaskof(X86_FEATURE_MMXEXT) | bitmaskof(X86_FEATURE_FFXSR) | bitmaskof(X86_FEATURE_3DNOW) | bitmaskof(X86_FEATURE_3DNOWEXT));(but I didn't check if PAGE1GB is in that magic number...)
It's not - it's bit 26.
So.. it sounds to me like everybody is in the agreement that this is the right thing to do (enable it if the hypervisor has it enabled)?
Quoted 6 lines
Quoted 2 lines
And the next thing is actually come up with a patch to do some of this plumbing - naturally for Xen 4.5?
Hi, Konrad,
Is there any patch to turn on the 1GB hugepages? If no, we are happy to give a patch to do it.
I have not see a patch for this, and I would be quite happy to see patch developed for this!
Konrad Rzeszutek Wilk wrote on 2014-11-10:
Quoted 61 lines · Yang Z
Quoted 3 lines
Konrad Rzeszutek Wilk wrote on 2014-01-16:
Quoted 2 lines · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 13.01.14 at 12:38, Ian Campbell <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Jan Beulich
Quoted 4 lines
In fact I can't see where this would be forced off:
xc_cpuid_x86.conly does so in the PV case, and allhvm_pse1gb_supported()is that the CPU supports it and the domainuses HAP.
Quoted 50 lines
Quoted 49 lines
Quoted 9 lines
Quoted 9 lines
Took me a while to spot it too:
static void intel_xc_cpuid_policy( [...]case 0x80000001: { int is_64bit = hypervisor_is_64bit(xch) &&
is_pae;/* Only a few features are advertised in Intel's 0x80000001. */ regs[2] &= (is_64bit ?
bitmaskof(X86_FEATURE_LAHF_LM): 0) |Quoted 1 line
Quoted 1 line
bitmaskof(X86_FEATURE_ABM);Quoted 2 lines
Quoted 2 lines
regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) :0)
|
Quoted 4 lines
Quoted 4 lines
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) | (is_64bit ?
bitmaskof(X86_FEATURE_RDTSCP): 0));Quoted 11 lines
Quoted 4 lines
break; }Which masks anything which is not explicitly mentioned. (PAGE1GB is in regs[3], I think).
Ah, okay. The funs of white listing on HVM vs black listing on PV again.
Quoted 3 lines
The AMD version is more permissive:
regs[3] &= (0x0183f3ff | /* features shared with0x00000001:EDX */
Quoted 11 lines
Quoted 9 lines
(is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | bitmaskof(X86_FEATURE_SYSCALL) | bitmaskof(X86_FEATURE_MP) | bitmaskof(X86_FEATURE_MMXEXT) | bitmaskof(X86_FEATURE_FFXSR) | bitmaskof(X86_FEATURE_3DNOW) | bitmaskof(X86_FEATURE_3DNOWEXT)); (but Ididn't check if PAGE1GB is in that magic number...)
It's not - it's bit 26.
So.. it sounds to me like everybody is in the agreement that this is the right thing to do (enable it if the hypervisor has it enabled)?
And the next thing is actually come up with a patch to do some of this plumbing - naturally for Xen 4.5?
Quoted 8 lines
Quoted 4 lines
Hi, Konrad,
Is there any patch to turn on the 1GB hugepages? If no, we are happy to give
a patch to do it.
I have not see a patch for this, and I would be quite happy to see patch developed for this!
OK. We will provide a patch ASAP.
Best regards,
Yang
Quoted 64 lines · Yang Z
Konrad Rzeszutek Wilk wrote on 2014-11-10:
Quoted 63 lines · Yang Z
Quoted 3 lines
Konrad Rzeszutek Wilk wrote on 2014-01-16:
Quoted 2 lines · Jan Beulich
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 13.01.14 at 12:38, Ian Campbell <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines · Jan Beulich
Quoted 4 lines
In fact I can't see where this would be forced off:
xc_cpuid_x86.conly does so in the PV case, and allhvm_pse1gb_supported()is that the CPU supports it and the domainuses HAP.
Quoted 52 lines
Quoted 42 lines
Quoted 9 lines
Quoted 9 lines
Took me a while to spot it too:
static void intel_xc_cpuid_policy( [...]case 0x80000001: { int is_64bit = hypervisor_is_64bit(xch) &&
is_pae;/* Only a few features are advertised in Intel's 0x80000001. */ regs[2] &= (is_64bit ?
bitmaskof(X86_FEATURE_LAHF_LM): 0) |Quoted 1 line
Quoted 1 line
bitmaskof(X86_FEATURE_ABM);Quoted 2 lines
Quoted 2 lines
regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) :0)
|
Quoted 4 lines
Quoted 4 lines
(is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) | (is_64bit ?
bitmaskof(X86_FEATURE_RDTSCP): 0));Quoted 11 lines
Quoted 4 lines
break; }Which masks anything which is not explicitly mentioned. (PAGE1GB is in regs[3], I think).
Ah, okay. The funs of white listing on HVM vs black listing on PV again.
Quoted 3 lines
The AMD version is more permissive:
regs[3] &= (0x0183f3ff | /* features shared with0x00000001:EDX */
Quoted 10 lines
Quoted 9 lines
(is_pae ? bitmaskof(X86_FEATURE_NX) : 0) | (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) | bitmaskof(X86_FEATURE_SYSCALL) | bitmaskof(X86_FEATURE_MP) | bitmaskof(X86_FEATURE_MMXEXT) | bitmaskof(X86_FEATURE_FFXSR) | bitmaskof(X86_FEATURE_3DNOW) | bitmaskof(X86_FEATURE_3DNOWEXT)); (but Ididn't check if PAGE1GB is in that magic number...)
Quoted 7 lines
Quoted 1 line
It's not - it's bit 26.
So.. it sounds to me like everybody is in the agreement that this is the right thing to do (enable it if the hypervisor has it enabled)?
And the next thing is actually come up with a patch to do some of this plumbing - naturally for Xen 4.5?
Hi, Konrad,
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Is there any patch to turn on the 1GB hugepages? If no, we are happy to give
a patch to do it.
I have not see a patch for this, and I would be quite happy to see patch developed for this!
OK. We will provide a patch ASAP.
Excellent. Looking forward to it!
Quoted 5 lines
Best regards,
Yang