Re: [PATCH 1/1] Update acpi_root_bridge_list in container hotplug path.

From: Yinghai Lu
Date: Wed Oct 17 2012 - 01:18:24 EST


On Tue, Oct 16, 2012 at 8:25 PM, Tang Chen <tangchen@xxxxxxxxxxxxxx> wrote:
> Hi Yinghai,
>
> List acpi_root_bridge_list is only updated when kernel is booting,
> or in _handle_hotplug_event_root() when handling ACPI_NOTIFY_DEVICE_CHECK
> event on a pci root bridge device. But when we hotplug a container, which
> contains one or more pci root bridges, container_notify_cb() will be
> called but not _handle_hotplug_event_root(). As a result,
> acpi_root_bridge_list won't be updated.
>
> This patch makes the following api and struct public in pci_root_hp.h,
> struct acpi_root_bridge;
> add_acpi_root_bridge()
> remove_acpi_root_bridge()
> acpi_root_handle_to_bridge()
> and call add_acpi_root_bridge() in acpi_bus_check_add() and call
> remove_acpi_root_bridge() in acpi_bus_remove().
>
> This patch is based on Lu Yinghai's git tree branch for-pci-split-pci-root-hp-2.
>
> Signed-off-by: Tang Chen <tangchen@xxxxxxxxxxxxxx>
> ---
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 6ca2eaf..c258064 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -12,6 +12,7 @@
> #include <linux/dmi.h>
>
> #include <acpi/acpi_drivers.h>
> +#include <acpi/pci_root_hp.h>
>
> #include "internal.h"
>
> @@ -1265,8 +1266,17 @@ int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
> dev->removal_type = ACPI_BUS_REMOVAL_EJECT;
> device_release_driver(&dev->dev);
>
> - if (rmdevice)
> + if (rmdevice) {
> + if (acpi_is_root_bridge(dev->handle)) {
> + struct acpi_root_bridge *bridge;
> +
> + bridge = acpi_root_handle_to_bridge(dev->handle);
> + if (bridge)
> + remove_acpi_root_bridge(bridge);
> + }
> +
> acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT);
> + }

no, we don't need that.

after closely looking, it seems we can dump acpi_root_bridge.

please check if attached patch could work with container path.

Thanks

Yinghai

Attachment: kill_remove_acpi_root_bridge.patch
Description: Binary data