public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Mike Rapoport <rppt@linux.ibm.com>
Cc: Dave Hansen <dave.hansen@intel.com>,
	Joerg Roedel <joro@8bytes.org>,
	x86@kernel.org, Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	hpa@zytor.com, Joerg Roedel <jroedel@suse.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jason@zx2c4.com, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, "Shutemov,
	Kirill" <kirill.shutemov@intel.com>
Subject: Re: [PATCH] x86/mm/64: Do not dereference non-present PGD entries
Date: Thu, 13 Aug 2020 21:21:13 +0200	[thread overview]
Message-ID: <20200813192113.GA2338781@gmail.com> (raw)
In-Reply-To: <20200810155359.GV163101@linux.ibm.com>


* Mike Rapoport <rppt@linux.ibm.com> wrote:

> On Mon, Aug 10, 2020 at 07:27:33AM -0700, Dave Hansen wrote:
> > ... adding Kirill
> > 
> > On 8/7/20 1:40 AM, Joerg Roedel wrote:
> > > +		lvl = "p4d";
> > > +		p4d = p4d_alloc(&init_mm, pgd, addr);
> > > +		if (!p4d)
> > > +			goto failed;
> > >  
> > > +		/*
> > > +		 * With 5-level paging the P4D level is not folded. So the PGDs
> > > +		 * are now populated and there is no need to walk down to the
> > > +		 * PUD level.
> > > +		 */
> > >  		if (pgtable_l5_enabled())
> > >  			continue;
> > 
> > It's early and I'm a coffee or two short of awake, but I had to stare at
> > the comment for a but to make sense of it.
> > 
> > It feels wrong, I think, because the 5-level code usually ends up doing
> > *more* allocations and in this case, it is _appearing_ to do fewer.
> > Would something like this make sense?
> 
> Unless I miss something, with 5 levels vmalloc mappings are shared at
> p4d level, so allocating a p4d page would be enough. With 4 levels,
> p4d_alloc() is a nop and pud is the first actually populated level below
> pgd.
> 
> > 		/*
> > 		 * The goal here is to allocate all possibly required
> > 		 * hardware page tables pointed to by the top hardware
> > 		 * level.
> > 		 *
> > 		 * On 4-level systems, the p4d layer is folded away and
> > 		 * the above code does no preallocation.  Below, go down
> > 		 * to the pud _software_ level to ensure the second
> > 		 * hardware level is allocated.
> > 		 */

Would be nice to integrate all these explanations into the comment itself?

Thanks,

	Ingo

      reply	other threads:[~2020-08-13 19:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07  8:40 [PATCH] x86/mm/64: Do not dereference non-present PGD entries Joerg Roedel
2020-08-07  9:52 ` Jason A. Donenfeld
2020-08-07 10:07 ` Mike Rapoport
2020-08-10 14:27 ` Dave Hansen
2020-08-10 15:53   ` Mike Rapoport
2020-08-13 19:21     ` Ingo Molnar [this message]

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=20200813192113.GA2338781@gmail.com \
    --to=mingo@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=kirill.shutemov@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rppt@linux.ibm.com \
    --cc=torvalds@linux-foundation.org \
    --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