On Wed, Feb 22, 2023, Anish Moorthy wrote: > On Wed, Feb 15, 2023 at 9:24 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote: > > > > On Wed, Feb 15, 2023, Anish Moorthy wrote: > > > + if (mem_fault_nowait) { > > > + if (fault->pfn == KVM_PFN_ERR_FAULT) { > > > + vcpu->run->exit_reason = KVM_EXIT_MEMORY_FAULT; > > > + vcpu->run->memory_fault.gpa = fault->gfn << PAGE_SHIFT; > > > + vcpu->run->memory_fault.size = PAGE_SIZE; > > > > This belongs in a separate patch, and the exit stuff should be filled in by > > kvm_handle_error_pfn(). Then this if-statement goes away entirely because the > > "if (!async)" will always evaluate true in the nowait case. > > Hi Sean, what exactly did you want "in a separate patch"? Separate "exit if fast gup() fails", a.k.a. nowait, from "exit with KVM_EXIT_MEMORY_FAULT instead of -EFAULT on errors". I.e. don't tie KVM_EXIT_MEMORY_FAULT to the fast gup() capability (or memslot flag?). That way filing vcpu->run->memory_fault lands in a separate, largely generic patch, and this patch only introduces the fast gup() logic. That probably means adding yet another capability, but capabilities are cheap.