KVM: PPC: Book3S HV: Drop prepare_done from struct kvm_resize_hpt
authorSerhii Popovych <spopovyc@redhat.com>
Mon, 4 Dec 2017 14:36:41 +0000 (09:36 -0500)
committerPaul Mackerras <paulus@ozlabs.org>
Wed, 6 Dec 2017 02:35:21 +0000 (13:35 +1100)
commit3073774e638ef18d222465fe92bfc8fccb90d288
tree9743ab541a7aac8b4a59b1d8dfe39cd36b1f4405
parenta63dd7480d8f3c2b52e1e2bcab83e3e64c7c61a1
KVM: PPC: Book3S HV: Drop prepare_done from struct kvm_resize_hpt

Currently the kvm_resize_hpt structure has two fields relevant to the
state of an ongoing resize: 'prepare_done', which indicates whether
the worker thread has completed or not, and 'error' which indicates
whether it was successful or not.

Since the success/failure isn't known until completion, this is
confusingly redundant.  This patch consolidates the information into
just the 'error' value: -EBUSY indicates the worked is still in
progress, other negative values indicate (completed) failure, 0
indicates successful completion.

As a bonus this reduces size of struct kvm_resize_hpt by
__alignof__(struct kvm_hpt_info) and saves few bytes of code.

While there correct comment in struct kvm_resize_hpt which references
a non-existent semaphore (leftover from an early draft).

Assert with WARN_ON() in case of HPT allocation thread work runs more
than once for resize request or resize_hpt_allocate() returns -EBUSY
that is treated specially.

Change comparison against zero to make checkpatch.pl happy.

Cc: stable@vger.kernel.org # v4.10+
Signed-off-by: Serhii Popovych <spopovyc@redhat.com>
[dwg: Changed BUG_ON()s to WARN_ON()s and altered commit message for
 clarity]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_64_mmu_hv.c