x86/vcpu: Remove struct vcpu allocation restriction for !CONFIG_SHADOW_PAGING
PATCH 1/1 x86/vcpu: Remove struct vcpu allocation restriction for !CONFIG_SHADOW_PAGING
There is no need for struct vcpu to live below the 4G boundary if shadow paging is compiled out.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: George Dunlap <[email protected]>
CC: Tim Deegan <[email protected]>
--- xen/arch/x86/domain.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
xen/arch/x86/domain.c +4 -1
@@ -311,8 +311,11 @@ struct vcpu *alloc_vcpu_struct(void)* may require that the shadow CR3 points below 4GB, and hence the whole * structure must satisfy this restriction. Thus we specify MEMF_bits(32). */ +unsigned int memflags = +IS_ENABLED (CONFIG_SHADOW_PAGING ) ?MEMF_bits (32 ) :0 ; +BUILD_BUG_ON (sizeof (*v) >PAGE_SIZE ); - v =alloc_xenheap_pages (0 ,MEMF_bits (32 )); + v =alloc_xenheap_pages (0 , memflags);if ( v !=NULL )clear_page (v);return v;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 4 lines · Andrew Cooper
There is no need for struct vcpu to live below the 4G boundary if shadow paging is compiled out.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
xen/arch/x86/domain.c struct vcpu *alloc_vcpu_struct(void) · line 315
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 02.11.18 at 18:54, <[email protected]> wrote:
xen/arch/x86/domain.c +2
-0@@ -311,8 +311,11 @@ struct vcpu *alloc_vcpu_struct(void)* may require that the shadow CR3 points below 4GB, and hence the whole * structure must satisfy this restriction. Thus we specify MEMF_bits(32). */ +unsigned int memflags = +IS_ENABLED (CONFIG_SHADOW_PAGING ) ?MEMF_bits (32 ) :0 ;
According to the comment, CONFIG_HVM (or perhaps even is_hvm_domain(), if only the corresponding struct domain was available here) could be taken into consideration at the same time.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
George Dunlap
Reviewed-byQuoted 14 lines · Jan Beulich
xen/arch/x86/domain.c struct vcpu *alloc_vcpu_struct(void) · line 315
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 02.11.18 at 18:54, <[email protected]> wrote:
xen/arch/x86/domain.c +2
-0@@ -311,8 +311,11 @@ struct vcpu *alloc_vcpu_struct(void)* may require that the shadow CR3 points below 4GB, and hence the whole * structure must satisfy this restriction. Thus we specify MEMF_bits(32). */ +unsigned int memflags = +IS_ENABLED (CONFIG_SHADOW_PAGING ) ?MEMF_bits (32 ) :0 ;According to the comment,
CONFIG_HVM(or perhaps evenis_hvm_domain(), if only the corresponding struct domain was available here) could be taken into consideration at the same time.
is_hvm_domain() would be nice actually. It does look like that should
work: For PV guests, v->arch.paging.mode looks like it's set to &SHADOW_INTERNAL_NAME(sh_paging_mode, 4) and never changed [1].
It would be nice if we could test this though.
I'd also be happy to toss this in as-is while we ponder that potential improvement:
-George
[1] /build/hg/xen.git/xen/arch/x86/mm/shadow/common.c:shadow_vcpu_init()
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel