diff options
author | Greg Kurz <groug@kaod.org> | 2021-01-08 18:31:27 +0100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2021-01-19 10:20:29 +1100 |
commit | 73598c75df0585e039825e642adede21912dabc7 (patch) | |
tree | a93fe89b0b8877e353c7ec73711ca24ae71633a1 /hw/ppc/spapr_ovec.c | |
parent | f17969db719ef563d2f7a1b62ea5dd5087ad774a (diff) |
spapr: Improve handling of memory unplug with old guests
Since commit 1e8b5b1aa16b ("spapr: Allow memory unplug to always succeed")
trying to unplug memory from a guest that doesn't support it (eg. rhel6)
no longer generates an error like it used to. Instead, it leaves the
memory around : only a subsequent reboot or manual use of drmgr within
the guest can complete the hot-unplug sequence. A flag was added to
SpaprMachineClass so that this new behavior only applies to the default
machine type.
We can do better. CAS processes all pending hot-unplug requests. This
means that we don't really care about what the guest supports if
the hot-unplug request happens before CAS.
All guests that we care for, even old ones, set enough bits in OV5
that lead to a non-empty bitmap in spapr->ov5_cas. Use that as a
heuristic to decide if CAS has already occured or not.
Always accept unplug requests that happen before CAS since CAS will
process them. Restore the previous behavior of rejecting them after
CAS when we know that the guest doesn't support memory hot-unplug.
This behavior is suitable for all machine types : this allows to
drop the pre_6_0_memory_unplug flag.
Fixes: 1e8b5b1aa16b ("spapr: Allow memory unplug to always succeed")
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <161012708715.801107.11418801796987916516.stgit@bahia.lan>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr_ovec.c')
-rw-r--r-- | hw/ppc/spapr_ovec.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/ppc/spapr_ovec.c b/hw/ppc/spapr_ovec.c index dd003f1763..b2567caa5c 100644 --- a/hw/ppc/spapr_ovec.c +++ b/hw/ppc/spapr_ovec.c @@ -125,6 +125,13 @@ bool spapr_ovec_test(SpaprOptionVector *ov, long bitnr) return test_bit(bitnr, ov->bitmap) ? true : false; } +bool spapr_ovec_empty(SpaprOptionVector *ov) +{ + g_assert(ov); + + return bitmap_empty(ov->bitmap, OV_MAXBITS); +} + static void guest_byte_to_bitmap(uint8_t entry, unsigned long *bitmap, long bitmap_offset) { |