Commit 59308093 authored by Laurent Vivier's avatar Laurent Vivier Committed by David Gibson
Browse files

Revert "spapr: fix memory hot-unplugging"



This reverts commit fe6824d1.

Conflicts hw/ppc/spapr_drc.c, because get_index() has been renamed
spapr_get_index().

This didn't fix the problem. Once the hotplug has been started
some memory is allocated and some structures are allocated.
We don't free it when we ignore the unplug, and we can't because
they can be in use by the kernel.

Signed-off-by: default avatarLaurent Vivier <lvivier@redhat.com>
Tested-by: default avatarDaniel Barboza <danielhb@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent b1fd36c3
Loading
Loading
Loading
Loading
+3 −17
Original line number Original line Diff line number Diff line
@@ -128,17 +128,6 @@ static uint32_t set_allocation_state(sPAPRDRConnector *drc,
        if (!drc->dev) {
        if (!drc->dev) {
            return RTAS_OUT_NO_SUCH_INDICATOR;
            return RTAS_OUT_NO_SUCH_INDICATOR;
        }
        }
        if (drc->awaiting_release && drc->awaiting_allocation) {
            /* kernel is acknowledging a previous hotplug event
             * while we are already removing it.
             * it's safe to ignore awaiting_allocation here since we know the
             * situation is predicated on the guest either already having done
             * so (boot-time hotplug), or never being able to acquire in the
             * first place (hotplug followed by immediate unplug).
             */
            drc->awaiting_allocation_skippable = true;
            return RTAS_OUT_NO_SUCH_INDICATOR;
        }
    }
    }


    if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) {
    if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) {
@@ -391,12 +380,10 @@ void spapr_drc_detach(sPAPRDRConnector *drc, DeviceState *d, Error **errp)
    }
    }


    if (drc->awaiting_allocation) {
    if (drc->awaiting_allocation) {
        if (!drc->awaiting_allocation_skippable) {
        drc->awaiting_release = true;
        drc->awaiting_release = true;
        trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc));
        trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc));
        return;
        return;
    }
    }
    }


    drc->dr_indicator = SPAPR_DR_INDICATOR_INACTIVE;
    drc->dr_indicator = SPAPR_DR_INDICATOR_INACTIVE;


@@ -418,7 +405,6 @@ void spapr_drc_detach(sPAPRDRConnector *drc, DeviceState *d, Error **errp)
    }
    }


    drc->awaiting_release = false;
    drc->awaiting_release = false;
    drc->awaiting_allocation_skippable = false;
    g_free(drc->fdt);
    g_free(drc->fdt);
    drc->fdt = NULL;
    drc->fdt = NULL;
    drc->fdt_start_offset = 0;
    drc->fdt_start_offset = 0;
+0 −1
Original line number Original line Diff line number Diff line
@@ -201,7 +201,6 @@ typedef struct sPAPRDRConnector {
    bool awaiting_release;
    bool awaiting_release;
    bool signalled;
    bool signalled;
    bool awaiting_allocation;
    bool awaiting_allocation;
    bool awaiting_allocation_skippable;


    /* device pointer, via link property */
    /* device pointer, via link property */
    DeviceState *dev;
    DeviceState *dev;