resource: fix false warning in __request_region()
PATCH 1/1 resource: fix false warning in __request_region()
A warning is raised when __request_region() detects a conflict with a resource whose resource.desc is IORES_DESC_DEVICE_PRIVATE_MEMORY.
But this warning is only valid for iomem_resources.
The hmem device resource uses resource.desc as the numa node id, which can cause spurious warnings.
This change fixes this by restricting the warning to only iomem_resource. This also adds a missing new line to the warning message.
--- kernel/resource.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/resource.c +3 -2
@@ -1279,8 +1279,9 @@ static int __request_region_locked(struct resource *res, struct resource *parent* become unavailable to other users. Conflicts are * not expected. Warn to aid debugging if encountered. */ -if (conflict->desc ==IORES_DESC_DEVICE_PRIVATE_MEMORY ) { -pr_warn ("Unaddressable device %s %pR conflicts with %pR" , +if (parent == &iomem_resource && + conflict->desc ==IORES_DESC_DEVICE_PRIVATE_MEMORY ) { +pr_warn ("Unaddressable device %s %pR conflicts with %pR\n" , conflict->name, conflict, res); }if (conflict != parent) {
Signature · 1 line
2.34.1
Quoted 9 lines · On Sat, 19 Jul 2025 20:26:04 +0900 Akinobu Mita <[email protected]> wrote:
A warning is raised when
__request_region()detects a conflict with a resource whose resource.desc isIORES_DESC_DEVICE_PRIVATE_MEMORY.But this warning is only valid for
iomem_resources.
The hmem device resource uses resource.desc as the numa node id, which can cause spurious warnings.This change fixes this by restricting the warning to only
iomem_resource. This also adds a missing new line to the warning message.
What are the circumstance which cause this warning? Are real world users hitting this? If so, should we backport this fix into earlier kernels?
2025年7月20日(日) 8:31 Andrew Morton <[email protected]>:
Quoted 10 lines · On Sat, 19 Jul 2025 20:26:04 +0900 Akinobu Mita <[email protected]> wrote:
Quoted 8 lines
A warning is raised when
__request_region()detects a conflict with a resource whose resource.desc isIORES_DESC_DEVICE_PRIVATE_MEMORY.But this warning is only valid for
iomem_resources.
The hmem device resource uses resource.desc as the numa node id, which can cause spurious warnings.
Quoted 6 lines
Quoted 2 lines
This change fixes this by restricting the warning to only
iomem_resource. This also adds a missing new line to the warning message.What are the circumstance which cause this warning? Are real world users hitting this? If so, should we backport this fix into earlier kernels?
This warning actually appeared on a machine with multiple cxl memory expanders. One of the NUMA node id is 6, which is the same as the value of IORES_DESC_DEVICE_PRIVATE_MEMORY.
In this environment it was just a spurious warning, but when I saw the warning I suspected a real problem so it's better to fix it.
resource code")
[email protected]
Reviewed-byQuoted 22 lines · Akinobu Mita
2025年7月20日(日) 8:31 Andrew Morton <[email protected]>:
Quoted 10 lines · On Sat, 19 Jul 2025 20:26:04 +0900 Akinobu Mita <[email protected]> wrote:
Quoted 8 lines
A warning is raised when
__request_region()detects a conflict with a resource whose resource.desc isIORES_DESC_DEVICE_PRIVATE_MEMORY.But this warning is only valid for
iomem_resources.
The hmem device resource uses resource.desc as the numa node id, which can cause spurious warnings.Quoted 6 lines
Quoted 2 lines
This change fixes this by restricting the warning to only
iomem_resource. This also adds a missing new line to the warning message.What are the circumstance which cause this warning? Are real world users hitting this? If so, should we backport this fix into earlier kernels?
This warning actually appeared on a machine with multiple cxl memory expanders. One of the NUMA node id is 6, which is the same as the value of
IORES_DESC_DEVICE_PRIVATE_MEMORY.
Quoted 5 lines
In this environment it was just a spurious warning, but when I saw the warning I suspected a real problem so it's better to fix it.
Fixes b926b7f3baec ("mm/resource: Move HMM pr_debug() deeper intoresource code")
This should be:
...as that is the change that violates the assumptions of __request_region().
You can add: