Skip to contentSkip to conversation

KVM/x86: fix comment that should be user fault

PATCH In review Quanfa Fu 2 participants 2 messages Feb 23, 2023

Subsystems (3)
lore
Share & tools
lore

Quanfa Fu

author
#0 lore raw

PATCH 1/1 KVM/x86: fix comment that should be user fault

The content of comment should be user fault not read. In order to avoid confusion, fix the comment.

---
 arch/x86/kvm/vmx/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/vmx.c +1 -1
index 7eec0226d56a..3c1012039517 100644
@@ -5668,7 +5668,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
 	gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
 	trace_kvm_page_fault(vcpu, gpa, exit_qualification);
 
-	/* Is it a read fault? */
+	/* Is it a user fault? */
 	error_code = (exit_qualification & EPT_VIOLATION_ACC_READ)
 		     ? PFERR_USER_MASK : 0;
 	/* Is it a write fault? */
Signature · 1 line
2.31.1
#1 lore raw
Quoted 2 lines · Quanfa Fu

The content of comment should be user fault not read. In order to avoid confusion, fix the comment.

No, the existing comment is correct. Ignoring optional extensions, EPT doesn't differntiate between Supervisor and User, but does support !READABLE mappings. And so KVM piggybacks PFERR_USER_MASK to track whether or not an EPT fault occurred on a read access.

Quoted 23 lines
---
 arch/x86/kvm/vmx/vmx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/vmx.c +1 -1
index 7eec0226d56a..3c1012039517 100644
@@ -5668,7 +5668,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
 	gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
 	trace_kvm_page_fault(vcpu, gpa, exit_qualification);
 
-	/* Is it a read fault? */
+	/* Is it a user fault? */
 	error_code = (exit_qualification & EPT_VIOLATION_ACC_READ)
 		     ? PFERR_USER_MASK : 0;
 	/* Is it a write fault? */
Signature · 1 line
2.31.1