Since commit d08d4e7cd6bf ("s390/mm: use full 4KB page for 2KB PTE"), there is no longer any reason to avoid splitting the kfence pool into 4k mappings in arch_kfence_init_pool(). Remove the architecture-specific kfence_split_mapping().
Unified · Split
| @@ -11,28 +11,17 @@ · 10 unmodified lines | |||
| 11 | void __kernel_map_pages(struct page *page, int numpages, int enable); | 11 | void __kernel_map_pages(struct page *page, int numpages, int enable); |
| 12 | 12 | ||
| 13 | static __always_inline bool arch_kfence_init_pool(void) | 13 | static __always_inline bool arch_kfence_init_pool(void) |
| 14 | { | ||
| 15 | return true; | ||
| 16 | } | ||
| 17 | |||
| 18 | #define arch_kfence_test_address(addr) ((addr) & PAGE_MASK) | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Do not split kfence pool to 4k mapping with arch_kfence_init_pool(), | ||
| 22 | * but earlier where page table allocations still happen with memblock. | ||
| 23 | * Reason is that arch_kfence_init_pool() gets called when the system | ||
| 24 | * is still in a limbo state - disabling and enabling bottom halves is | ||
| 25 | * not yet allowed, but that is what our page_table_alloc() would do. | ||
| 26 | */ | ||
| 27 | static __always_inline void kfence_split_mapping(void) | ||
| 28 | { | 14 | { |
| 29 | #ifdef CONFIG_KFENCE | 15 | #ifdef CONFIG_KFENCE |
| 30 | unsigned long pool_pages = KFENCE_POOL_SIZE >> PAGE_SHIFT; | 16 | unsigned long pool_pages = KFENCE_POOL_SIZE >> PAGE_SHIFT; |
| 31 | 17 | ||
| 32 | set_memory_4k((unsigned long)__kfence_pool, pool_pages); | 18 | set_memory_4k((unsigned long)__kfence_pool, pool_pages); |
| 33 | #endif | 19 | #endif |
| 20 | return true; | ||
| 34 | } | 21 | } |
| 35 | 22 | ||
| 23 | #define arch_kfence_test_address(addr) ((addr) & PAGE_MASK) | ||
| 24 | |||
| 36 | static inline bool kfence_protect_page(unsigned long addr, bool protect) | 25 | static inline bool kfence_protect_page(unsigned long addr, bool protect) |
| 37 | { | 26 | { |
| 38 | __kernel_map_pages(virt_to_page((void *)addr), 1, !protect); | 27 | __kernel_map_pages(virt_to_page((void *)addr), 1, !protect); |
| @@ -175,7 +175,6 @@ void __init mem_init(void) · 174 unmodified lines | |||
| 175 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); | 175 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); |
| 176 | 176 | ||
| 177 | pv_init(); | 177 | pv_init(); |
| 178 | kfence_split_mapping(); | ||
| 179 | 178 | ||
| 180 | /* this will put all low memory onto the freelists */ | 179 | /* this will put all low memory onto the freelists */ |
| 181 | memblock_free_all(); | 180 | memblock_free_all(); |