resource: Remove dependency on SPARSEMEM from GET_FREE_REGION
Subsystems (2)
PATCH 1/1 resource: Remove dependency on SPARSEMEM from GET_FREE_REGION
We want to use the functions configured via GET_FREE_REGION in resource kunit tests. However, GET_FREE_REGION depends on SPARSEMEM. This makes resource kunit tests cannot be built on some architectures lacking SPARSEMEM. In fact, these functions doesn't depend on SPARSEMEM now. So, remove dependency on SPARSEMEM from GET_FREE_REGION.
--- mm/Kconfig | 1 - 1 file changed, 1 deletion(-)
mm/Kconfig +0 -1
@@ -1085,7 +1085,6 @@ config HMM_MIRROR depends on MMU config GET_FREE_REGION - depends on SPARSEMEM bool config DEVICE_PRIVATE
Signature · 1 line
2.39.2
Quoted 24 lines · Huang Ying
We want to use the functions configured via
GET_FREE_REGIONin resource kunit tests. However,GET_FREE_REGIONdepends on SPARSEMEM. This makes resource kunit tests cannot be built on some architectures lacking SPARSEMEM. In fact, these functions doesn't depend on SPARSEMEM now. So, remove dependency on SPARSEMEM fromGET_FREE_REGION.Signed-off-by "Huang, Ying" <[email protected]>Tested-by Guenter Roeck <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Dan Williams <[email protected]>Cc David Hildenbrand <[email protected]>Cc Jonathan Cameron <[email protected]>--- mm/Kconfig | 1 - 1 file changed, 1 deletion(-)mm/Kconfig +0
-0
mm/Kconfig config HMM_MIRROR · line 1090
Quoted 7 lines
mm/Kconfig +0
-1@@ -1085,7 +1085,6 @@ config HMM_MIRROR depends on MMU config GET_FREE_REGION - depends on SPARSEMEM bool config DEVICE_PRIVATE
Added by
commit 14b80582c43e4f550acfd93c2b2cadbe36ea0874
Author: Dan Williams <[email protected]> Date: Fri May 20 13:41:24 2022 -0700
resource: Introduce alloc_free_mem_region()
@Dan, any insight why that dependency was added?
Signature · 3 lines
Cheers, David / dhildenb
Hi, David,
Quoted 32 lines · David Hildenbrand
Quoted 23 lines · Huang Ying
We want to use the functions configured via
GET_FREE_REGIONin resource kunit tests. However,GET_FREE_REGIONdepends on SPARSEMEM. This makes resource kunit tests cannot be built on some architectures lacking SPARSEMEM. In fact, these functions doesn't depend on SPARSEMEM now. So, remove dependency on SPARSEMEM fromGET_FREE_REGION.
Link:
https://lore.kernel.org/lkml/[email protected]/Signed-off-by "Huang, Ying" <[email protected]>Tested-by Guenter Roeck <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Dan Williams <[email protected]>Cc David Hildenbrand <[email protected]>Cc Jonathan Cameron <[email protected]>--- mm/Kconfig | 1 - 1 file changed, 1 deletion(-)mm/Kconfig +0
-0mm/Kconfig config HMM_MIRROR · line 1088
Quoted 5 lines
mm/Kconfig +0
-1@@ -1085,7 +1085,6 @@ config HMM_MIRROR depends on MMU config GET_FREE_REGION - depends on SPARSEMEM bool config DEVICE_PRIVATEAdded by
Quoted 7 lines
commit
14b80582c43e4f550acfd93c2b2cadbe36ea0874Author: Dan Williams <[email protected]> Date: Fri May 20 13:41:24 2022 -0700resource: Introduce
alloc_free_mem_region()@Dan, any insight why that dependency was added?
Dan has explain it some what in the following email,
https://lore.kernel.org/lkml/[email protected]/
This is reachable from the "Link:" tag in the patch.
--
Best Regards,
Huang, Ying
Quoted 42 lines · Ying
Hi, David,
Quoted 38 lines · David Hildenbrand
Quoted 23 lines · Huang Ying
We want to use the functions configured via
GET_FREE_REGIONin resource kunit tests. However,GET_FREE_REGIONdepends on SPARSEMEM. This makes resource kunit tests cannot be built on some architectures lacking SPARSEMEM. In fact, these functions doesn't depend on SPARSEMEM now. So, remove dependency on SPARSEMEM fromGET_FREE_REGION.
Link:
https://lore.kernel.org/lkml/[email protected]/Signed-off-by "Huang, Ying" <[email protected]>Tested-by Guenter Roeck <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Dan Williams <[email protected]>Cc David Hildenbrand <[email protected]>Cc Jonathan Cameron <[email protected]>--- mm/Kconfig | 1 - 1 file changed, 1 deletion(-)mm/Kconfig +0
-0mm/Kconfig config HMM_MIRROR · line 1088
Quoted 5 lines
mm/Kconfig +0
-1@@ -1085,7 +1085,6 @@ config HMM_MIRROR depends on MMU config GET_FREE_REGION - depends on SPARSEMEM bool config DEVICE_PRIVATEAdded by
commit
14b80582c43e4f550acfd93c2b2cadbe36ea0874Author: Dan Williams <[email protected]> Date: Fri May 20 13:41:24 2022 -0700resource: Introduce
alloc_free_mem_region()
Quoted 7 lines
Quoted 1 line
@Dan, any insight why that dependency was added?
Dan has explain it some what in the following email,
https://lore.kernel.org/lkml/[email protected]/
This is reachable from the "Link:" tag in the patch.
That should be part of the patch description then :)
Signature · 3 lines
Cheers, David / dhildenb
Quoted 45 lines · David Hildenbrand
Quoted 44 lines · Ying
Hi, David,
Quoted 39 lines · David Hildenbrand
Quoted 23 lines · Huang Ying
We want to use the functions configured via
GET_FREE_REGIONin resource kunit tests. However,GET_FREE_REGIONdepends on SPARSEMEM. This makes resource kunit tests cannot be built on some architectures lacking SPARSEMEM. In fact, these functions doesn't depend on SPARSEMEM now. So, remove dependency on SPARSEMEM fromGET_FREE_REGION.
Link:
https://lore.kernel.org/lkml/[email protected]/Signed-off-by "Huang, Ying" <[email protected]>Tested-by Guenter Roeck <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Dan Williams <[email protected]>Cc David Hildenbrand <[email protected]>Cc Jonathan Cameron <[email protected]>--- mm/Kconfig | 1 - 1 file changed, 1 deletion(-)mm/Kconfig +0
-0mm/Kconfig config HMM_MIRROR · line 1088
Quoted 5 lines
mm/Kconfig +0
-1@@ -1085,7 +1085,6 @@ config HMM_MIRROR depends on MMU config GET_FREE_REGION - depends on SPARSEMEM bool config DEVICE_PRIVATEAdded by
commit
14b80582c43e4f550acfd93c2b2cadbe36ea0874Author: Dan Williams <[email protected]> Date: Fri May 20 13:41:24 2022 -0700resource: Introduce
alloc_free_mem_region()@Dan, any insight why that dependency was added?
Quoted 7 lines
Quoted 5 lines
Dan has explain it some what in the following email,
https://lore.kernel.org/lkml/[email protected]/
This is reachable from the "Link:" tag in the patch.
That should be part of the patch description then :)
That Link: does not really describe the history though...
The description I would add is:
---
When get_free_mem_region() was introduced the only consumers were those looking to pass the address range to memremap_pages(). That address range needed to be mindful of the maximum addressable platform physical address which at the time only SPARSMEM defined via MAX_PHYSMEM_BITS.
Given that memremap_pages() also depended on SPARSEMEM via ZONE_DEVICE, it was easier to just depend on that definition than invent a general MAX_PHYSMEM_BITS concept outside of SPARSEMEM.
Turns out that decision was buggy and did not account for KASAN consumption of physical address space. That problem was resolved recently with commit ea72ce5da228 ("x86/kaslr: Expose and use the end of the physical memory address space"), and GET_FREE_REGION dropped its MAX_PHYSMEM_BITS dependency.
Then commit 99185c10d5d9 ("resource, kunit: add test case for region_intersects()"), went ahead and fixed up the only remaining dependency on SPARSEMEM which was usage of the PA_SECTION_SHIFT macro for setting the default alignment. A PAGE_SIZE fallback is fine in the SPARSEMEM=n case.
With those build dependencies gone GET_FREE_REGION no longer depends on SPARSEMEM.
Hi, Dan,
Quoted 48 lines · Dan Williams
Quoted 47 lines · David Hildenbrand
Quoted 46 lines · Ying
Hi, David,
Quoted 32 lines · David Hildenbrand
Quoted 23 lines · Huang Ying
We want to use the functions configured via
GET_FREE_REGIONin resource kunit tests. However,GET_FREE_REGIONdepends on SPARSEMEM. This makes resource kunit tests cannot be built on some architectures lacking SPARSEMEM. In fact, these functions doesn't depend on SPARSEMEM now. So, remove dependency on SPARSEMEM fromGET_FREE_REGION.
Link:
https://lore.kernel.org/lkml/[email protected]/Signed-off-by "Huang, Ying" <[email protected]>Tested-by Guenter Roeck <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Dan Williams <[email protected]>Cc David Hildenbrand <[email protected]>Cc Jonathan Cameron <[email protected]>--- mm/Kconfig | 1 - 1 file changed, 1 deletion(-)mm/Kconfig +0
-0mm/Kconfig config HMM_MIRROR · line 1088
Quoted 5 lines
mm/Kconfig +0
-1@@ -1085,7 +1085,6 @@ config HMM_MIRROR depends on MMU config GET_FREE_REGION - depends on SPARSEMEM bool config DEVICE_PRIVATEAdded by
Quoted 7 lines
commit
14b80582c43e4f550acfd93c2b2cadbe36ea0874Author: Dan Williams <[email protected]> Date: Fri May 20 13:41:24 2022 -0700resource: Introduce
alloc_free_mem_region()@Dan, any insight why that dependency was added?
Dan has explain it some what in the following email,
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
https://lore.kernel.org/lkml/[email protected]/
This is reachable from the "Link:" tag in the patch.
That should be part of the patch description then :)
That Link: does not really describe the history though...
Sorry. I made a mistake here.
Quoted 19 lines
The description I would add is:
---
When
get_free_mem_region()was introduced the only consumers were those looking to pass the address range tomemremap_pages(). That address range needed to be mindful of the maximum addressable platform physical address which at the time only SPARSMEM defined viaMAX_PHYSMEM_BITS.Given that
memremap_pages()also depended on SPARSEMEM viaZONE_DEVICE, it was easier to just depend on that definition than invent a generalMAX_PHYSMEM_BITSconcept outside of SPARSEMEM.Turns out that decision was buggy and did not account for KASAN consumption of physical address space. That problem was resolved recently with commit
ea72ce5da228("x86/kaslr: Expose and use the end of the physical memory address space"), andGET_FREE_REGIONdropped itsMAX_PHYSMEM_BITSdependency.
Quoted 8 lines
Then commit
99185c10d5d9("resource, kunit: add test case forregion_intersects()"), went ahead and fixed up the only remaining dependency on SPARSEMEM which was usage of thePA_SECTION_SHIFTmacro for setting the default alignment. APAGE_SIZEfallback is fine in the SPARSEMEM=n case.With those build dependencies gone
GET_FREE_REGIONno longer depends on SPARSEMEM.
This looks great! Will use this in the patch description in the next version.
--
Best Regards,
Huang, Ying