]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: async_pf: Cleanup kvm_setup_async_pf()
authorVitaly Kuznetsov <vkuznets@redhat.com>
Wed, 10 Jun 2020 17:55:31 +0000 (19:55 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 11 Jun 2020 16:35:19 +0000 (12:35 -0400)
commitc0a194ab7fcca48f560bcc5ea3400dfa855ed502
treefa4c2c9d3b1d63d7d0ec19e60e02af9dcd7f477d
parent6224f843e74cf4ea30015244627ed9cfabf17b67
KVM: async_pf: Cleanup kvm_setup_async_pf()

schedule_work() returns 'false' only when the work is already on the queue
and this can't happen as kvm_setup_async_pf() always allocates a new one.
Also, to avoid potential race, it makes sense to to schedule_work() at the
very end after we've added it to the queue.

While on it, do some minor cleanup. gfn_to_pfn_async() mentioned in a
comment does not currently exist and, moreover, we can check
kvm_is_error_hva() at the very beginning, before we try to allocate work so
'retry_sync' label can go away completely.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200610175532.779793-1-vkuznets@redhat.com>
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/async_pf.c