Skip to content

Commit b926b7f

Browse files
hansendcdjbw
authored andcommitted
mm/resource: Move HMM pr_debug() deeper into resource code
HMM consumes physical address space for its own use, even though nothing is mapped or accessible there. It uses a special resource description (IORES_DESC_DEVICE_PRIVATE_MEMORY) to uniquely identify these areas. When HMM consumes address space, it makes a best guess about what to consume. However, it is possible that a future memory or device hotplug can collide with the reserved area. In the case of these conflicts, there is an error message in register_memory_resource(). Later patches in this series move register_memory_resource() from using request_resource_conflict() to __request_region(). Unfortunately, __request_region() does not return the conflict like the previous function did, which makes it impossible to check for IORES_DESC_DEVICE_PRIVATE_MEMORY in a conflicting resource. Instead of warning in register_memory_resource(), move the check into the core resource code itself (__request_region()) where the conflicting resource _is_ available. This has the added bonus of producing a warning in case of HMM conflicts with devices *or* RAM address space, as opposed to the RAM- only warnings that were there previously. Signed-off-by: Dave Hansen <[email protected]> Reviewed-by: Jerome Glisse <[email protected]> Cc: Dan Williams <[email protected]> Cc: Dave Jiang <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: Vishal Verma <[email protected]> Cc: Tom Lendacky <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Michal Hocko <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Huang Ying <[email protected]> Cc: Fengguang Wu <[email protected]> Cc: Keith Busch <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent 5cd401a commit b926b7f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

kernel/resource.c

+9
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,15 @@ struct resource * __request_region(struct resource *parent,
11321132
conflict = __request_resource(parent, res);
11331133
if (!conflict)
11341134
break;
1135+
/*
1136+
* mm/hmm.c reserves physical addresses which then
1137+
* become unavailable to other users. Conflicts are
1138+
* not expected. Warn to aid debugging if encountered.
1139+
*/
1140+
if (conflict->desc == IORES_DESC_DEVICE_PRIVATE_MEMORY) {
1141+
pr_warn("Unaddressable device %s %pR conflicts with %pR",
1142+
conflict->name, conflict, res);
1143+
}
11351144
if (conflict != parent) {
11361145
if (!(conflict->flags & IORESOURCE_BUSY)) {
11371146
parent = conflict;

mm/memory_hotplug.c

-5
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ static struct resource *register_memory_resource(u64 start, u64 size)
110110
res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
111111
conflict = request_resource_conflict(&iomem_resource, res);
112112
if (conflict) {
113-
if (conflict->desc == IORES_DESC_DEVICE_PRIVATE_MEMORY) {
114-
pr_debug("Device unaddressable memory block "
115-
"memory hotplug at %#010llx !\n",
116-
(unsigned long long)start);
117-
}
118113
pr_debug("System RAM resource %pR cannot be added\n", res);
119114
kfree(res);
120115
return ERR_PTR(-EEXIST);

0 commit comments

Comments
 (0)