Skip to contentSkip to conversation

KVM: VMX: Remove vmcs_config.order

PATCH Applied Jim Mattson 2 participants 2 messages Jan 25, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: VMX: Remove vmcs_config.order

The maximum size of a VMCS (or VMXON region) is 4096. By definition, these are order 0 allocations.

---
 arch/x86/kvm/vmx/capabilities.h | 1 -
 arch/x86/kvm/vmx/vmx.c          | 5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx/capabilities.h +0 -1
index 959b59d13b5a..3f430e218375 100644
@@ -54,7 +54,6 @@ struct nested_vmx_msrs {
 
 struct vmcs_config {
 	int size;
-	int order;
 	u32 basic_cap;
 	u32 revision_id;
 	u32 pin_based_exec_ctrl;
arch/x86/kvm/vmx/vmx.c +2 -3
index 4ac676066d60..185d903a8fe5 100644
@@ -2603,7 +2603,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
 		return -EIO;
 
 	vmcs_conf->size = vmx_msr_high & 0x1fff;
-	vmcs_conf->order = get_order(vmcs_conf->size);
 	vmcs_conf->basic_cap = vmx_msr_high & ~0x1fff;
 
 	vmcs_conf->revision_id = vmx_msr_low;
@@ -2628,7 +2627,7 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags)
 	struct page *pages;
 	struct vmcs *vmcs;
 
-	pages = __alloc_pages_node(node, flags, vmcs_config.order);
+	pages = __alloc_pages_node(node, flags, 0);
 	if (!pages)
 		return NULL;
 	vmcs = page_address(pages);
@@ -2647,7 +2646,7 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags)
 
 void free_vmcs(struct vmcs *vmcs)
 {
-	free_pages((unsigned long)vmcs, vmcs_config.order);
+	free_page((unsigned long)vmcs);
 }
 
 /*
Signature · 1 line
2.35.0.rc0.227.g00780c9af4-goog
maintainer Applied
#1 lore raw
Quoted 43 lines · Jim Mattson

The maximum size of a VMCS (or VMXON region) is 4096. By definition, these are order 0 allocations.

---
  arch/x86/kvm/vmx/capabilities.h | 1 -
  arch/x86/kvm/vmx/vmx.c          | 5 ++---
  2 files changed, 2 insertions(+), 4 deletions(-)
arch/x86/kvm/vmx/capabilities.h +0 -1
index 959b59d13b5a..3f430e218375 100644
@@ -54,7 +54,6 @@ struct nested_vmx_msrs {
 
  struct vmcs_config {
  	int size;
-	int order;
  	u32 basic_cap;
  	u32 revision_id;
  	u32 pin_based_exec_ctrl;
arch/x86/kvm/vmx/vmx.c +1 -2
index 4ac676066d60..185d903a8fe5 100644
@@ -2603,7 +2603,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf,
  		return -EIO;
 
  	vmcs_conf->size = vmx_msr_high & 0x1fff;
-	vmcs_conf->order = get_order(vmcs_conf->size);
  	vmcs_conf->basic_cap = vmx_msr_high & ~0x1fff;
 
  	vmcs_conf->revision_id = vmx_msr_low;
@@ -2628,7 +2627,7 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags)
  	struct page *pages;
  	struct vmcs *vmcs;
 
-	pages = __alloc_pages_node(node, flags, vmcs_config.order);
+	pages = __alloc_pages_node(node, flags, 0);
  	if (!pages)
  		return NULL;
  	vmcs = page_address(pages);

arch/x86/kvm/vmx/vmx.c struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags) · line 2652

Quoted 8 lines
arch/x86/kvm/vmx/vmx.c +1 -1
@@ -2647,7 +2646,7 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags)
 
  void free_vmcs(struct vmcs *vmcs)
  {
-	free_pages((unsigned long)vmcs, vmcs_config.order);
+	free_page((unsigned long)vmcs);
  }
 
  /*

Queued, thanks.

Paolo