2023-07-25 11:50:01

by Igor Mammedov

[permalink] [raw]
Subject: [RFC 1/3] acpiphp: extra debug hack

Signed-off-by: Igor Mammedov <[email protected]>
---
drivers/pci/hotplug/acpiphp_glue.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 5b1f271c6034..af1c73f2bee6 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -485,6 +485,7 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge)
struct pci_bus *bus = slot->bus;
struct acpiphp_func *func;

+pci_info(bus, "enable_slot bus: bridge: %d, bus->self: %p\n", bridge, bus->self);
if (bridge && bus->self && hotplug_is_native(bus->self)) {
/*
* If native hotplug is used, it will take care of hotplug
@@ -544,6 +545,7 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge)
}
pci_dev_put(dev);
}
+pr_err("enable_slot: end\n");
}

/**
@@ -702,16 +704,20 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge)
if (bridge->is_going_away)
return;

- if (bridge->pci_dev)
+ if (bridge->pci_dev) {
pm_runtime_get_sync(&bridge->pci_dev->dev);
+pci_info(bridge->pci_dev, "acpiphp_check_bridge\n");
+ }

list_for_each_entry(slot, &bridge->slots, node) {
struct pci_bus *bus = slot->bus;
struct pci_dev *dev, *tmp;

if (slot_no_hotplug(slot)) {
+pr_err("acpiphp_check_bridge: slot_no_hotplug\n");
; /* do nothing */
} else if (device_status_valid(get_slot_status(slot))) {
+pr_err("acpiphp_check_bridge: device_status_valid\n");
/* remove stale devices if any */
list_for_each_entry_safe_reverse(dev, tmp,
&bus->devices, bus_list)
@@ -792,6 +798,7 @@ static void hotplug_event(u32 type, struct acpiphp_context *context)
if (bridge)
get_bridge(bridge);

+ acpi_handle_debug(handle, "hotplug_event: Slot: %s\n", slot_name(slot->slot));
acpi_unlock_hp_context();

pci_lock_rescan_remove();
@@ -799,7 +806,7 @@ static void hotplug_event(u32 type, struct acpiphp_context *context)
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
/* bus re-enumerate */
- acpi_handle_debug(handle, "Bus check in %s()\n", __func__);
+ acpi_handle_debug(handle, "Bus check in %s(): bridge: %p\n", __func__, bridge);
if (bridge)
acpiphp_check_bridge(bridge);
else if (!(slot->flags & SLOT_IS_GOING_AWAY))
--
2.39.3



2023-07-25 15:37:56

by Igor Mammedov

[permalink] [raw]
Subject: [RFC v2 1/3] acpiphp: extra debug hack

v3:
drop recent debug line that probably causing crash

Signed-off-by: Igor Mammedov <[email protected]>
---
drivers/pci/hotplug/acpiphp_glue.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 5b1f271c6034..ea8ed608f2a7 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -485,6 +485,7 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge)
struct pci_bus *bus = slot->bus;
struct acpiphp_func *func;

+pci_info(bus, "enable_slot bus: bridge: %d, bus->self: %p\n", bridge, bus->self);
if (bridge && bus->self && hotplug_is_native(bus->self)) {
/*
* If native hotplug is used, it will take care of hotplug
@@ -544,6 +545,7 @@ static void enable_slot(struct acpiphp_slot *slot, bool bridge)
}
pci_dev_put(dev);
}
+pr_err("enable_slot: end\n");
}

/**
@@ -702,16 +704,20 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge)
if (bridge->is_going_away)
return;

- if (bridge->pci_dev)
+ if (bridge->pci_dev) {
pm_runtime_get_sync(&bridge->pci_dev->dev);
+pci_info(bridge->pci_dev, "acpiphp_check_bridge\n");
+ }

list_for_each_entry(slot, &bridge->slots, node) {
struct pci_bus *bus = slot->bus;
struct pci_dev *dev, *tmp;

if (slot_no_hotplug(slot)) {
+pr_err("acpiphp_check_bridge: slot_no_hotplug\n");
; /* do nothing */
} else if (device_status_valid(get_slot_status(slot))) {
+pr_err("acpiphp_check_bridge: device_status_valid\n");
/* remove stale devices if any */
list_for_each_entry_safe_reverse(dev, tmp,
&bus->devices, bus_list)
@@ -799,7 +805,7 @@ static void hotplug_event(u32 type, struct acpiphp_context *context)
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
/* bus re-enumerate */
- acpi_handle_debug(handle, "Bus check in %s()\n", __func__);
+ acpi_handle_debug(handle, "Bus check in %s(): bridge: %p\n", __func__, bridge);
if (bridge)
acpiphp_check_bridge(bridge);
else if (!(slot->flags & SLOT_IS_GOING_AWAY))
--
2.39.3