提交 33f61d72 编写于 作者: R Rafael J. Wysocki

ACPI: OSL: Prevent acpi_release_memory() from returning too early

After commit 1757659d ("ACPI: OSL: Implement deferred unmapping
of ACPI memory") in some cases acpi_release_memory() may return
before the target memory mappings actually go away, because they
are released asynchronously now.

Prevent it from returning prematurely by making it wait for the next
RCU grace period to elapse, for all of the RCU callbacks to complete
and for all of the scheduled work items to be flushed before
returning.

Fixes: 1757659d ("ACPI: OSL: Implement deferred unmapping of ACPI memory")
Reported-by: NKenneth R. Crudup <kenny@panix.com>
Tested-by: NKenneth R. Crudup <kenny@panix.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
上级 17189d91
......@@ -1575,11 +1575,26 @@ static acpi_status acpi_deactivate_mem_region(acpi_handle handle, u32 level,
acpi_status acpi_release_memory(acpi_handle handle, struct resource *res,
u32 level)
{
acpi_status status;
if (!(res->flags & IORESOURCE_MEM))
return AE_TYPE;
return acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
acpi_deactivate_mem_region, NULL, res, NULL);
status = acpi_walk_namespace(ACPI_TYPE_REGION, handle, level,
acpi_deactivate_mem_region, NULL,
res, NULL);
if (ACPI_FAILURE(status))
return status;
/*
* Wait for all of the mappings queued up for removal by
* acpi_deactivate_mem_region() to actually go away.
*/
synchronize_rcu();
rcu_barrier();
flush_scheduled_work();
return AE_OK;
}
EXPORT_SYMBOL_GPL(acpi_release_memory);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册