Re: [PATCH 1/6] dax/hmem, e820, resource: Defer Soft Reserved registration until hmem is ready

From: Koralahalli Channabasappa, Smita

Date: Tue Sep 30 2025 - 00:56:21 EST


Hi Boris,

On 9/9/2025 9:12 AM, Borislav Petkov wrote:
On Fri, Aug 22, 2025 at 03:41:57AM +0000, Smita Koralahalli wrote:
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index c3acbd26408b..aef1ff2cabda 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1153,7 +1153,7 @@ void __init e820__reserve_resources_late(void)
res = e820_res;
for (i = 0; i < e820_table->nr_entries; i++) {
if (!res->parent && res->end)
- insert_resource_expand_to_fit(&iomem_resource, res);
+ insert_resource_late(res);
res++;
}


Btw, this doesn't even build and cover letter doesn't say what it applies
ontop so I applied it on my pile of tip/master.

kernel/resource.c: In function ‘region_intersects_soft_reserve’:
kernel/resource.c:694:36: error: ‘soft_reserve_resource’ undeclared (first use in this function); did you mean ‘devm_release_resource’?
694 | ret = __region_intersects(&soft_reserve_resource, start, size, flags,
| ^~~~~~~~~~~~~~~~~~~~~
| devm_release_resource
kernel/resource.c:694:36: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [scripts/Makefile.build:287: kernel/resource.o] Error 1
make[2]: *** [scripts/Makefile.build:556: kernel] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/mnt/kernel/kernel/2nd/linux/Makefile:2011: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2

Apologies for the delay.

This was based on mainline. I have rebased the series onto the latest mainline and sent out a new revision and noted it in the cover letter.

https://lore.kernel.org/all/20250930044757.214798-2-Smita.KoralahalliChannabasappa@xxxxxxx/


Also, I'd do this resource insertion a bit differently:

insert_resource_expand_to_fit(struct resource *new)
{
struct resource *root = &iomem_resource;

if (new->desc == IORES_DESC_SOFT_RESERVED)
root = &soft_reserve_resource;

return __insert_resource_expand_to_fit(root, new);
}

and rename the current insert_resource_expand_to_fit() to the __ variant.

I have made these changes as well.

Thanks
Smita


It looks like you want to intercept all callers of
insert_resource_expand_to_fit() instead of defining a separate set which works
on the soft-reserve thing.

Oh well, the resource code is yucky already.