Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> writes: >linmiaohe <linmiaohe@xxxxxxxxxx> writes: > >> From: Miaohe Lin <linmiaohe@xxxxxxxxxx> >> > >Thank you for the cleanup, I looked at nested_svm_intercept() and I see room for improvement, e.g. (completely untested!) > >diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 76c24b3491f6..fcb26d64d3c7 100644 >--- a/arch/x86/kvm/svm.c >+++ b/arch/x86/kvm/svm.c >@@ -3280,42 +3280,36 @@ static int nested_svm_intercept(struct vcpu_svm *svm) > case SVM_EXIT_IOIO: > vmexit = nested_svm_intercept_ioio(svm); > break; >- case SVM_EXIT_READ_CR0 ... SVM_EXIT_WRITE_CR8: { >- u32 bit = 1U << (exit_code - SVM_EXIT_READ_CR0); >- if (svm->nested.intercept_cr & bit) >+ case SVM_EXIT_READ_CR0 ... SVM_EXIT_WRITE_CR8: >+ if (svm->nested.intercept_cr & >+ BIT(exit_code - SVM_EXIT_READ_CR0)) >- default: { >- u64 exit_bits = 1ULL << (exit_code - SVM_EXIT_INTR); >- if (svm->nested.intercept & exit_bits) >+ default: >+ if (svm->nested.intercept & BIT_ULL(exit_code - >+ SVM_EXIT_INTR)) > vmexit = NESTED_EXIT_DONE; > } >- } > > return vmexit; > } > >Feel free to pick stuff you like and split your changes to this function in a separate patch. Sounds good, many thanks for your improvement suggestion. Will do in a separate patch. >> u32 exit_code = svm->vmcb->control.exit_code; diff --git >> throws >> - * #UD or #GP. >> + * #UD, #GP or #SS. > >Oxford comma, anyone? :-))) I have no strong preference. ^_^ >> */ >> int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification, > >All your changes look correct, so > >Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx> > Many thanks for your review, and nice suggestion again!