cxl/region: Add dev_dbg() detail on failure to allocate HPA space
[email protected]
maintainerPATCH v3 1/1 cxl/region: Add dev_dbg() detail on failure to allocate HPA space
From: Alison Schofield <[email protected]>
When the region driver fails while allocating HPA space for a new region it can be because the parent resource, the CXL Window, has no more available space.
In that case, the debug user sees this message:
cxl_core:alloc_hpa:555: cxl region2: failed to allocate HPA: -34
Expand the message like this:
cxl_core:alloc_hpa:555: cxl region8: HPA allocation error (-34) for size:0x20000000 in CXL Window 0 [mem 0xf010000000-0xf04fffffff flags 0x200]
Now the debug user can examine /proc/iomem and consider actions like removing other allocations in that space or reducing the size of their region request.
---
Changes in v3:
- Add parens around error number (Vishal, Dan)
- Link to v2: https://lore.kernel.org/linux-cxl/[email protected]/
drivers/cxl/core/region.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/cxl/core/region.c +3 -2
@@ -552,8 +552,9 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size) res =alloc_free_mem_region (cxlrd->res, size,SZ_256M ,dev_name (&cxlr->dev));if (IS_ERR (res)) { -dev_dbg (&cxlr->dev,"failed to allocate HPA: %ld\n" , -PTR_ERR (res)); +dev_dbg (&cxlr->dev, +"HPA allocation error (%ld) for size:%#llx in %s %pr\n" , +PTR_ERR (res), size, cxlrd->res->name, cxlrd->res);return PTR_ERR (res); }
base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
Signature · 1 line
2.37.3
Quoted 16 lines · On Fri, Dec 22, 2023 at 04:47:40PM -0800, [email protected] wrote:
From: Alison Schofield <[email protected]>
When the region driver fails while allocating HPA space for a new region it can be because the parent resource, the CXL Window, has no more available space.
In that case, the debug user sees this message:
cxl_core:alloc_hpa:555: cxl region2: failed to allocate HPA: -34Expand the message like this:
cxl_core:alloc_hpa:555: cxl region8: HPA allocation error (-34) for size:0x20000000 in CXL Window 0 [mem 0xf010000000-0xf04fffffff flags0x200]Now the debug user can examine
/proc/iomemand consider actions like removing other allocations in that space or reducing the size of their region request.
Quoted 5 lines
Suggested-by Dan Williams <[email protected]>Signed-off-by Alison Schofield <[email protected]>Reviewed-by Dave Jiang <[email protected]>Reviewed-by Vishal Verma <[email protected]>---
Quoted 30 lines
Changes in v3:
- Add parens around error number (Vishal, Dan)
- Link to v2: https://lore.kernel.org/linux-cxl/[email protected]/drivers/cxl/core/region.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/cxl/core/region.c +3
-2@@ -552,8 +552,9 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size) res =alloc_free_mem_region (cxlrd->res, size,SZ_256M ,dev_name (&cxlr->dev));if (IS_ERR (res)) { -dev_dbg (&cxlr->dev,"failed to allocate HPA: %ld\n" , -PTR_ERR (res)); +dev_dbg (&cxlr->dev, +"HPA allocation error (%ld) for size:%#llx in %s %pr\n" , +PTR_ERR (res), size, cxlrd->res->name, cxlrd->res);return PTR_ERR (res); }base-commit:
b85ea95d086471afb4ad062012a4d73cd328fa86Signature · 1 line
2.37.3
Quoted 11 lines · On Fri, 22 Dec 2023, [email protected] wrote:
From: Alison Schofield <[email protected]>
When the region driver fails while allocating HPA space for a new region it can be because the parent resource, the CXL Window, has no more available space.
In that case, the debug user sees this message:
cxl_core:alloc_hpa:555: cxl region2: failed to allocate HPA: -34Expand the message like this:
cxl_core:alloc_hpa:555: cxl region8: HPA allocation error (-34) for size:0x20000000 in CXL Window 0 [mem 0xf010000000-0xf04fffffff flags0x200]
Nice.
Quoted 5 lines
Now the debug user can examine
/proc/iomemand consider actions like removing other allocations in that space or reducing the size of their region request.
Quoted 35 lines
Suggested-by Dan Williams <[email protected]>Signed-off-by Alison Schofield <[email protected]>Reviewed-by Dave Jiang <[email protected]>Reviewed-by Vishal Verma <[email protected]>---
Changes in v3:
- Add parens around error number (Vishal, Dan)
- Link to v2: https://lore.kernel.org/linux-cxl/[email protected]/
drivers/cxl/core/region.c| 5 +++--1 file changed, 3 insertions(+), 2 deletions(-)drivers/cxl/core/region.c +3
-2@@ -552,8 +552,9 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size) res =alloc_free_mem_region (cxlrd->res, size,SZ_256M ,dev_name (&cxlr->dev));if (IS_ERR (res)) { -dev_dbg (&cxlr->dev,"failed to allocate HPA: %ld\n" , -PTR_ERR (res)); +dev_dbg (&cxlr->dev, +"HPA allocation error (%ld) for size:%#llx in %s %pr\n" , +PTR_ERR (res), size, cxlrd->res->name, cxlrd->res);return PTR_ERR (res); }base-commit:
b85ea95d086471afb4ad062012a4d73cd328fa86Signature · 1 line
2.37.3