diff options
-rw-r--r-- | arch/s390/Kconfig.debug | 8 | ||||
-rw-r--r-- | arch/s390/kernel/traps.c | 5 | ||||
-rw-r--r-- | arch/s390/mm/init.c | 27 | ||||
-rw-r--r-- | include/asm-s390/cacheflush.h | 4 |
4 files changed, 43 insertions, 1 deletions
diff --git a/arch/s390/Kconfig.debug b/arch/s390/Kconfig.debug index 2283933a9a93..4599fa06bd82 100644 --- a/arch/s390/Kconfig.debug +++ b/arch/s390/Kconfig.debug | |||
@@ -6,4 +6,12 @@ config TRACE_IRQFLAGS_SUPPORT | |||
6 | 6 | ||
7 | source "lib/Kconfig.debug" | 7 | source "lib/Kconfig.debug" |
8 | 8 | ||
9 | config DEBUG_PAGEALLOC | ||
10 | bool "Debug page memory allocations" | ||
11 | depends on DEBUG_KERNEL | ||
12 | help | ||
13 | Unmap pages from the kernel linear mapping after free_pages(). | ||
14 | This results in a slowdown, but helps to find certain types of | ||
15 | memory corruptions. | ||
16 | |||
9 | endmenu | 17 | endmenu |
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index 52b8342c6bf2..1a2fdb6991df 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -271,7 +271,10 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
271 | printk("PREEMPT "); | 271 | printk("PREEMPT "); |
272 | #endif | 272 | #endif |
273 | #ifdef CONFIG_SMP | 273 | #ifdef CONFIG_SMP |
274 | printk("SMP"); | 274 | printk("SMP "); |
275 | #endif | ||
276 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
277 | printk("DEBUG_PAGEALLOC"); | ||
275 | #endif | 278 | #endif |
276 | printk("\n"); | 279 | printk("\n"); |
277 | notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); | 280 | notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); |
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index b234bb4a6da7..983ec6ec0e7c 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c | |||
@@ -167,6 +167,33 @@ void __init mem_init(void) | |||
167 | PFN_ALIGN((unsigned long)&_eshared) - 1); | 167 | PFN_ALIGN((unsigned long)&_eshared) - 1); |
168 | } | 168 | } |
169 | 169 | ||
170 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
171 | void kernel_map_pages(struct page *page, int numpages, int enable) | ||
172 | { | ||
173 | pgd_t *pgd; | ||
174 | pud_t *pud; | ||
175 | pmd_t *pmd; | ||
176 | pte_t *pte; | ||
177 | unsigned long address; | ||
178 | int i; | ||
179 | |||
180 | for (i = 0; i < numpages; i++) { | ||
181 | address = page_to_phys(page + i); | ||
182 | pgd = pgd_offset_k(address); | ||
183 | pud = pud_offset(pgd, address); | ||
184 | pmd = pmd_offset(pud, address); | ||
185 | pte = pte_offset_kernel(pmd, address); | ||
186 | if (!enable) { | ||
187 | ptep_invalidate(address, pte); | ||
188 | continue; | ||
189 | } | ||
190 | *pte = mk_pte_phys(address, __pgprot(_PAGE_TYPE_RW)); | ||
191 | /* Flush cpu write queue. */ | ||
192 | mb(); | ||
193 | } | ||
194 | } | ||
195 | #endif | ||
196 | |||
170 | void free_initmem(void) | 197 | void free_initmem(void) |
171 | { | 198 | { |
172 | unsigned long addr; | 199 | unsigned long addr; |
diff --git a/include/asm-s390/cacheflush.h b/include/asm-s390/cacheflush.h index f7cade8083f3..49d5af916d01 100644 --- a/include/asm-s390/cacheflush.h +++ b/include/asm-s390/cacheflush.h | |||
@@ -24,4 +24,8 @@ | |||
24 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | 24 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ |
25 | memcpy(dst, src, len) | 25 | memcpy(dst, src, len) |
26 | 26 | ||
27 | #ifdef CONFIG_DEBUG_PAGEALLOC | ||
28 | void kernel_map_pages(struct page *page, int numpages, int enable); | ||
29 | #endif | ||
30 | |||
27 | #endif /* _S390_CACHEFLUSH_H */ | 31 | #endif /* _S390_CACHEFLUSH_H */ |