linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kani, Toshi" <toshi.kani@hpe.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"will.deacon@arm.com" <will.deacon@arm.com>
Cc: "tglx@linutronix.de" <tglx@linutronix.de>,
	"cpandya@codeaurora.org" <cpandya@codeaurora.org>,
	"Hocko, Michal" <MHocko@suse.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/5] ioremap: Rework pXd_free_pYd_page() API
Date: Fri, 14 Sep 2018 21:10:49 +0000	[thread overview]
Message-ID: <db3f513bf3bfafb85b99f57f741f5bb07952af70.camel@hpe.com> (raw)
In-Reply-To: <71baefb8e0838fba89ee06262bbb2456e9091c7a.camel@hpe.com>

On Fri, 2018-09-14 at 14:36 -0600, Toshi Kani wrote:
> On Wed, 2018-09-12 at 11:26 +0100, Will Deacon wrote:
> > The recently merged API for ensuring break-before-make on page-table
> > entries when installing huge mappings in the vmalloc/ioremap region is
> > fairly counter-intuitive, resulting in the arch freeing functions
> > (e.g. pmd_free_pte_page()) being called even on entries that aren't
> > present. This resulted in a minor bug in the arm64 implementation, giving
> > rise to spurious VM_WARN messages.
> > 
> > This patch moves the pXd_present() checks out into the core code,
> > refactoring the callsites at the same time so that we avoid the complex
> > conjunctions when determining whether or not we can put down a huge
> > mapping.
> > 
> > Cc: Chintan Pandya <cpandya@codeaurora.org>
> > Cc: Toshi Kani <toshi.kani@hpe.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Michal Hocko <mhocko@suse.com>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> 
> Yes, this looks nicer.
> 
> Reviewed-by: Toshi Kani <toshi.kani@hpe.com>

Sorry, I take it back since I got a question...

+static int ioremap_try_huge_pmd(pmd_t *pmd, unsigned long addr,
> +				unsigned long end, phys_addr_t
phys_addr,
> +				pgprot_t prot)
> +{
> +	if (!ioremap_pmd_enabled())
> +		return 0;
> +
> +	if ((end - addr) != PMD_SIZE)
> +		return 0;
> +
> +	if (!IS_ALIGNED(phys_addr, PMD_SIZE))
> +		return 0;
> +
> +	if (pmd_present(*pmd) && !pmd_free_pte_page(pmd, addr))
> +		return 0;

Is pm_present() a proper check here?  We probably do not have this case
for iomap, but I wonder if one can drop p-bit while it has a pte page
underneath.

Thanks,
-Toshi


> +
> +	return pmd_set_huge(pmd, phys_addr, prot);
> +}
> +



  reply	other threads:[~2018-09-14 21:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12 10:26 [PATCH 0/5] Clean up huge vmap and ioremap code Will Deacon
2018-09-12 10:26 ` [PATCH 1/5] ioremap: Rework pXd_free_pYd_page() API Will Deacon
2018-09-14 20:36   ` Kani, Toshi
2018-09-14 21:10     ` Kani, Toshi [this message]
2018-09-17 11:33       ` Will Deacon
2018-09-17 18:38         ` Kani, Toshi
2018-09-12 10:26 ` [PATCH 2/5] arm64: mmu: Drop pXd_present() checks from pXd_free_pYd_table() Will Deacon
2018-09-12 10:26 ` [PATCH 3/5] x86: pgtable: Drop pXd_none() " Will Deacon
2018-09-14 20:37   ` Kani, Toshi
2018-09-17 11:33     ` Will Deacon
2018-09-17 18:43       ` Kani, Toshi
2018-09-12 10:26 ` [PATCH 4/5] lib/ioremap: Ensure phys_addr actually corresponds to a physical address Will Deacon
2018-09-12 15:09   ` Sean Christopherson
2018-09-12 16:39     ` Will Deacon
2018-09-12 17:14       ` Sean Christopherson
2018-09-12 10:26 ` [PATCH 5/5] lib/ioremap: Ensure break-before-make is used for huge p4d mappings Will Deacon
2018-09-17 18:55   ` Kani, Toshi

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=db3f513bf3bfafb85b99f57f741f5bb07952af70.camel@hpe.com \
    --to=toshi.kani@hpe.com \
    --cc=MHocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=cpandya@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /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).