hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9W022
------------------------------------
We can not determine which physical_node can be offlined. There could be pages pinned by user space. when we try to offline a memblock on which has already pinned pages, we will fall into a loop to migrate these pinned pages.
Fixes: 039ec3f73992 ("soc: hisilicon: hisi_hbmdev: Add power domain control methods") Signed-off-by: Zhang Zekun zhangzekun11@huawei.com --- drivers/soc/hisilicon/hisi_hbmdev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/hisilicon/hisi_hbmdev.c b/drivers/soc/hisilicon/hisi_hbmdev.c index 1d0364c7f4fc..9fa464c94bbc 100644 --- a/drivers/soc/hisilicon/hisi_hbmdev.c +++ b/drivers/soc/hisilicon/hisi_hbmdev.c @@ -301,14 +301,16 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR_WO(state);
-static int hbmdev_find(struct acpi_device *adev, void *arg) +static int hbmdev_setup(struct acpi_device *adev, void *arg) { const char *hid = acpi_device_hid(adev); bool *found = arg;
if (!strcmp(hid, ACPI_MEMORY_DEVICE_HID)) { + acpi_scan_lock_acquire(); + adev->handler->hotplug.demand_offline = true; + acpi_scan_lock_release(); *found = true; - return -1; }
return 0; @@ -323,7 +325,7 @@ static bool has_hbmdev(struct device *dev) if (strcmp(hid, ACPI_GENERIC_CONTAINER_DEVICE_HID)) return found;
- acpi_dev_for_each_child(adev, hbmdev_find, &found); + acpi_dev_for_each_child(adev, hbmdev_setup, &found);
return found; }