linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: Dave Hansen <dave.hansen@intel.com>, linux-mm@kvack.org
Cc: "Mark Rutland" <Mark.Rutland@arm.com>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	x86@kernel.org, "Will Deacon" <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Andy Lutomirski" <luto@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"James Morse" <james.morse@arm.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org, "Liang,
	Kan" <kan.liang@linux.intel.com>
Subject: Re: [PATCH v3 27/34] mm: pagewalk: Add 'depth' parameter to pte_hole
Date: Fri, 1 Mar 2019 11:24:25 +0000	[thread overview]
Message-ID: <26df02dd-c54e-ea91-bdd1-0a4aad3a30ac@arm.com> (raw)
In-Reply-To: <5f354bf5-4ac8-d0e2-048c-0857c91a21e6@intel.com>

On 28/02/2019 19:00, Dave Hansen wrote:
> On 2/28/19 3:28 AM, Steven Price wrote:
>> static int get_level(unsigned long addr, unsigned long end)
>> {
>> 	/* Add 1 to account for ~0ULL */
>> 	unsigned long size = (end - addr) + 1;
>> 	if (size < PMD_SIZE)
>> 		return 4;
>> 	else if (size < PUD_SIZE)
>> 		return 3;
>> 	else if (size < P4D_SIZE)
>> 		return 2;
>> 	else if (size < PGD_SIZE)
>> 		return 1;
>> 	return 0;
>> }
>>
>> There are two immediate problems with that:
>>
>>  * The "+1" to deal with ~0ULL is fragile
>>
>>  * PGD_SIZE isn't what you might expect, it's not defined for most
>> architectures and arm64/x86 use it as the size of the PGD table.
>> Although that's easy enough to fix up.
>>
>> Do you think a function like above would be preferable?
> 
> The question still stands of why we *need* the depth/level in the first
> place.  As I said, we obviously need it for printing out the "name" of
> the level.  Is that it?

That is the only use I'm currently aware of.

>> The other option would of course be to just drop the information from
>> the debugfs file about at which level the holes are. But it can be
>> useful information to see whether there are empty levels in the page
>> table structure. Although this is an area where x86 and arm64 differ
>> currently (x86 explicitly shows the gaps, arm64 doesn't), so if x86
>> doesn't mind losing that functionality that would certainly simplify things!
> 
> I think I'd actually be OK with the holes just not showing up.  I
> actually find it kinda hard to read sometimes with the holes in there.
> I'd be curious what others think though.

If no-one has any objections to dropping the holes in the output, then I
can rebase on something like below and drop this 'depth' patch.

Steve

----8<----
From a9eabadfc212389068ec5cc60265c7a55585bb76 Mon Sep 17 00:00:00 2001
From: Steven Price <steven.price@arm.com>
Date: Fri, 1 Mar 2019 10:06:33 +0000
Subject: [PATCH] x86: mm: Hide page table holes in debugfs

For the /sys/kernel/debug/page_tables/ files, rather than outputing a
mostly empty line when a block of memory isn't present just skip the
line. This keeps the output shorter and will help with a future change
switching to using the generic page walk code as we no longer care about
the 'level' that the page table holes are at.

Signed-off-by: Steven Price <steven.price@arm.com>
---
 arch/x86/mm/dump_pagetables.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index e3cdc85ce5b6..a0f4139631dd 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -304,8 +304,8 @@ static void note_page(struct seq_file *m, struct
pg_state *st,
 		/*
 		 * Now print the actual finished series
 		 */
-		if (!st->marker->max_lines ||
-		    st->lines < st->marker->max_lines) {
+		if ((cur & _PAGE_PRESENT) && (!st->marker->max_lines ||
+		    st->lines < st->marker->max_lines)) {
 			pt_dump_seq_printf(m, st->to_dmesg,
 					   "0x%0*lx-0x%0*lx   ",
 					   width, st->start_address,
@@ -321,7 +321,9 @@ static void note_page(struct seq_file *m, struct
pg_state *st,
 			printk_prot(m, st->current_prot, st->level,
 				    st->to_dmesg);
 		}
-		st->lines++;
+		if (cur & _PAGE_PRESENT) {
+			st->lines++;
+		}

 		/*
 		 * We print markers for special areas of address space,
-- 
2.20.1


  reply	other threads:[~2019-03-01 11:24 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 17:05 [PATCH v3 00/34] Convert x86 & arm64 to use generic page walk Steven Price
2019-02-27 17:05 ` [PATCH v3 01/34] alpha: mm: Add p?d_large() definitions Steven Price
2019-02-27 17:05 ` [PATCH v3 02/34] arc: " Steven Price
2019-02-27 18:18   ` Vineet Gupta
2019-02-27 17:05 ` [PATCH v3 03/34] arm: " Steven Price
2019-03-01 21:47   ` Kirill A. Shutemov
2019-03-04 11:56     ` Steven Price
2019-03-04 13:10       ` Kirill A. Shutemov
2019-02-27 17:05 ` [PATCH v3 04/34] arm64: " Steven Price
2019-02-27 17:05 ` [PATCH v3 05/34] c6x: " Steven Price
2019-03-01 21:48   ` Kirill A. Shutemov
2019-03-04 12:01     ` Steven Price
2019-03-04 13:11       ` Kirill A. Shutemov
2019-02-27 17:05 ` [PATCH v3 06/34] csky: " Steven Price
2019-03-01 21:51   ` Kirill A. Shutemov
2019-02-27 17:05 ` [PATCH v3 07/34] hexagon: " Steven Price
2019-02-27 17:05 ` [PATCH v3 08/34] ia64: " Steven Price
2019-03-01 21:57   ` Kirill A. Shutemov
2019-03-04 13:16     ` Steven Price
2019-03-04 19:06       ` Luck, Tony
2019-03-06 13:45         ` Steven Price
2019-02-27 17:05 ` [PATCH v3 09/34] m68k: " Steven Price
2019-02-27 19:27   ` Geert Uytterhoeven
2019-02-28 11:36     ` Mike Rapoport
2019-02-28 11:53       ` Geert Uytterhoeven
2019-02-28 12:04         ` Steven Price
2019-03-01 11:45           ` Mike Rapoport
2019-02-27 17:05 ` [PATCH v3 10/34] microblaze: " Steven Price
2019-02-27 17:05 ` [PATCH v3 11/34] mips: " Steven Price
2019-02-28  2:15   ` Paul Burton
2019-02-28 12:11     ` Steven Price
2019-02-28 18:55       ` Paul Burton
2019-03-01 11:02         ` Steven Price
2019-02-27 17:05 ` [PATCH v3 12/34] nds32: " Steven Price
2019-02-27 17:05 ` [PATCH v3 13/34] nios2: " Steven Price
2019-02-27 17:05 ` [PATCH v3 14/34] openrisc: " Steven Price
2019-02-27 17:05 ` [PATCH v3 15/34] parisc: " Steven Price
2019-02-27 18:54   ` Helge Deller
2019-03-01 22:12     ` Kirill A. Shutemov
2019-03-05 21:45       ` Helge Deller
2019-02-27 17:05 ` [PATCH v3 16/34] powerpc: " Steven Price
2019-02-27 17:05 ` [PATCH v3 17/34] riscv: " Steven Price
2019-02-27 17:05 ` [PATCH v3 18/34] s390: " Steven Price
2019-02-27 17:40   ` Martin Schwidefsky
2019-02-28 11:43     ` Steven Price
2019-02-27 17:05 ` [PATCH v3 19/34] sh: " Steven Price
2019-02-27 17:05 ` [PATCH v3 20/34] sparc: " Steven Price
2019-02-27 18:38   ` David Miller
2019-02-28 11:49     ` Steven Price
2019-02-27 17:05 ` [PATCH v3 21/34] um: " Steven Price
2019-02-27 17:05 ` [PATCH v3 22/34] unicore32: " Steven Price
2019-02-27 17:05 ` [PATCH v3 23/34] xtensa: " Steven Price
2019-02-27 17:29   ` Max Filippov
2019-02-27 17:05 ` [PATCH v3 24/34] mm: Add generic p?d_large() macros Steven Price
2019-02-27 17:05 ` [PATCH v3 25/34] mm: pagewalk: Add p4d_entry() and pgd_entry() Steven Price
2019-02-27 17:06 ` [PATCH v3 26/34] mm: pagewalk: Allow walking without vma Steven Price
2019-02-27 17:06 ` [PATCH v3 27/34] mm: pagewalk: Add 'depth' parameter to pte_hole Steven Price
2019-02-27 17:38   ` Dave Hansen
2019-02-28 11:28     ` Steven Price
2019-02-28 19:00       ` Dave Hansen
2019-03-01 11:24         ` Steven Price [this message]
2019-02-27 17:06 ` [PATCH v3 28/34] mm: pagewalk: Add test_p?d callbacks Steven Price
2019-02-27 17:06 ` [PATCH v3 29/34] arm64: mm: Convert mm/dump.c to use walk_page_range() Steven Price
2019-02-27 17:06 ` [PATCH v3 30/34] x86/mm: Point to struct seq_file from struct pg_state Steven Price
2019-02-27 17:06 ` [PATCH v3 31/34] x86/mm+efi: Convert ptdump_walk_pgd_level() to take a mm_struct Steven Price
2019-02-27 17:06 ` [PATCH v3 32/34] x86/mm: Convert ptdump_walk_pgd_level_debugfs() to take an mm_struct Steven Price
2019-02-27 17:06 ` [PATCH v3 33/34] x86/mm: Convert ptdump_walk_pgd_level_core() " Steven Price
2019-02-27 17:06 ` [PATCH v3 34/34] x86: mm: Convert dump_pagetables to use walk_page_range Steven Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26df02dd-c54e-ea91-bdd1-0a4aad3a30ac@arm.com \
    --to=steven.price@arm.com \
    --cc=Mark.Rutland@arm.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=jglisse@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).