ptdump.c (16ba7e312045cd5d32fba0156312b4303f200787) ptdump.c (2fb4706057bcf8261b3b0521ec7a62b54b82ce48)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright 2016, Rashmica Gupta, IBM Corp.
4 *
5 * This traverses the kernel pagetables and dumps the
6 * information about the used sections of memory to
7 * /sys/kernel/debug/kernel_pagetables.
8 *

--- 263 unchanged lines hidden (view full) ---

272 if (!pmd_none(*pmd) && !pmd_is_leaf(*pmd))
273 /* pmd exists */
274 walk_pte(st, pmd, addr);
275 else
276 note_page(st, addr, 3, pmd_val(*pmd));
277 }
278}
279
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright 2016, Rashmica Gupta, IBM Corp.
4 *
5 * This traverses the kernel pagetables and dumps the
6 * information about the used sections of memory to
7 * /sys/kernel/debug/kernel_pagetables.
8 *

--- 263 unchanged lines hidden (view full) ---

272 if (!pmd_none(*pmd) && !pmd_is_leaf(*pmd))
273 /* pmd exists */
274 walk_pte(st, pmd, addr);
275 else
276 note_page(st, addr, 3, pmd_val(*pmd));
277 }
278}
279
280static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start)
280static void walk_pud(struct pg_state *st, p4d_t *p4d, unsigned long start)
281{
281{
282 pud_t *pud = pud_offset(pgd, 0);
282 pud_t *pud = pud_offset(p4d, 0);
283 unsigned long addr;
284 unsigned int i;
285
286 for (i = 0; i < PTRS_PER_PUD; i++, pud++) {
287 addr = start + i * PUD_SIZE;
288 if (!pud_none(*pud) && !pud_is_leaf(*pud))
289 /* pud exists */
290 walk_pmd(st, pud, addr);

--- 8 unchanged lines hidden (view full) ---

299 unsigned long addr = st->start_address & PGDIR_MASK;
300 pgd_t *pgd = pgd_offset_k(addr);
301
302 /*
303 * Traverse the linux pagetable structure and dump pages that are in
304 * the hash pagetable.
305 */
306 for (i = pgd_index(addr); i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) {
283 unsigned long addr;
284 unsigned int i;
285
286 for (i = 0; i < PTRS_PER_PUD; i++, pud++) {
287 addr = start + i * PUD_SIZE;
288 if (!pud_none(*pud) && !pud_is_leaf(*pud))
289 /* pud exists */
290 walk_pmd(st, pud, addr);

--- 8 unchanged lines hidden (view full) ---

299 unsigned long addr = st->start_address & PGDIR_MASK;
300 pgd_t *pgd = pgd_offset_k(addr);
301
302 /*
303 * Traverse the linux pagetable structure and dump pages that are in
304 * the hash pagetable.
305 */
306 for (i = pgd_index(addr); i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) {
307 if (!pgd_none(*pgd) && !pgd_is_leaf(*pgd))
307 p4d_t *p4d = p4d_offset(pgd, 0);
308
309 if (!p4d_none(*p4d) && !p4d_is_leaf(*p4d))
308 /* pgd exists */
310 /* pgd exists */
309 walk_pud(st, pgd, addr);
311 walk_pud(st, p4d, addr);
310 else
312 else
311 note_page(st, addr, 1, pgd_val(*pgd));
313 note_page(st, addr, 1, p4d_val(*p4d));
312 }
313}
314
315static void populate_markers(void)
316{
317 int i = 0;
318
319 address_markers[i++].start_address = PAGE_OFFSET;

--- 107 unchanged lines hidden ---
314 }
315}
316
317static void populate_markers(void)
318{
319 int i = 0;
320
321 address_markers[i++].start_address = PAGE_OFFSET;

--- 107 unchanged lines hidden ---