KVM: Don't WARN on -EIO return from kvm_arch_vcpu_pre_fault_memory()
Sean Christopherson
reviewerPATCH 1/1 KVM: Don't WARN on -EIO return from kvm_arch_vcpu_pre_fault_memory()
Drop the WARN on arch code returning -EIO when pre-faulting memory, as the WARN is user-triggerable and completely unwarranted. In all likelihood, the WARN was added due to a misinterpretation of review feedback, and was overlooked in subsequent review rounds.
The WARN showed up in v5 of the original pre-faulting series without any real explanation. v5 did add -EIO as a documented error code[1]:
v4->v5:
- add EIO as possible error
in response to Xiaoyao's review[2]:
Review
Quoted 5 lines
(quoted diff) +5
-0+ case RET_PF_CONTINUE: + case RET_PF_INVALID: + default: + WARN_ON_ONCE(r); + return -EIO;
Need to update patch 1 for -EIO
Quoted 1 line
+ }
but that review was just talking about the documentation. And at the time, KVM x86 already WARN()'d when returning -EIO, so having common KVM also WARN() added no value, i.e. wasn't at all justified.
--- virt/kvm/kvm_main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
virt/kvm/kvm_main.c +1 -4
@@ -4461,10 +4461,7 @@ static int kvm_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, } r =kvm_arch_vcpu_pre_fault_memory (vcpu, range); -if (WARN_ON_ONCE (r ==0 || r == -EIO )) -break ; - -if (r <0 ) +if (WARN_ON_ONCE (!r) || r <0 )break ; range->size -= r;
base-commit: 814607cd40df80d5727957adaa857e0feca43497
Signature · 1 line
2.56.0.218.g1ec904b173-goog
Quoted 9 lines · Sean Christopherson
Drop the WARN on arch code returning
-EIOwhen pre-faulting memory, as the WARN is user-triggerable and completely unwarranted. In all likelihood, the WARN was added due to a misinterpretation of review feedback, and was overlooked in subsequent review rounds.The WARN showed up in v5 of the original pre-faulting series without any real explanation. v5 did add
-EIOas a documented error code[1]:[...]
Applied to kvm-x86 generic, thanks!
[1/1] KVM: Don't WARN on -EIO return from kvm_arch_vcpu_pre_fault_memory()
https://github.com/kvm-x86/linux/commit/ed4d60b4ca23