LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Kani, Toshi" <email@example.com>
To: "firstname.lastname@example.org" <email@example.com>
Cc: "firstname.lastname@example.org" <email@example.com>,
"Hocko, Michal" <MHocko@suse.com>
Subject: Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces
Date: Wed, 30 May 2018 15:39:20 +0000 [thread overview]
Message-ID: <firstname.lastname@example.org> (raw)
On Wed, 2018-05-30 at 06:59 +0200, email@example.com wrote:
> On Tue, May 29, 2018 at 04:10:24PM +0000, Kani, Toshi wrote:
> > Can you explain why you think allocating a page here is a major problem?
> Because a larger allocation is more likely to fail. And if you fail the
> allocation, you also fail to free more pages, which _is_ a problem. So
> better avoid any allocations in code paths that are about freeing
It only allocates a single page. If it fails to allocate a single page,
this pud mapping request simply falls to pmd mappings, which is only as
bad as your suggested plain revert always does for both pud and pmd
mappings. Also, this func is called from ioremap() when a driver
initializes its mapping. If the system does not have a single page to
allocate, the driver has a much bigger issue to deal with than its
request falling back to pmd mappings. Please also note that this func
is not called from free-memory path.
> > If we just revert, please apply patch 1/3 first. This patch address the
> > BUG_ON issue on PAE. This is a real issue that needs a fix ASAP.
> It does not address the problem of dirty page-walk caches on x86-64.
This patch 3/3 fixes it. Hope my explanation above clarified.
> > The page-directory cache issue on x64, which is addressed by patch 3/3,
> > is a theoretical issue that I could not hit by putting ioremap() calls
> > into a loop for a whole day. Nobody hit this issue, either.
> How do you know you didn't hit that issue? It might cause silent data
> corruption, which might not be easily detected.
If the test hit that issue, it would have caused a kernel page fault
(freed & cleared pte page still unmapped, or this page reused and
attribute data invalid) or MCE (pte page reused and phys addr invalid)
when it accessed to ioremap'd address.
Causing silent data corruption requires that this freed & cleared pte
page to be reused and re-initialized with a valid pte entry data. While
this case is possible, the chance of my test only hitting this case
without ever hitting much more likely cases of page fault or MCE is
> > The simple revert patch Joerg posted a while ago causes
> > pmd_free_pte_page() to fail on x64. This causes multiple pmd mappings
> > to fall into pte mappings on my test systems. This can be seen as a
> > degradation, and I am afraid that it is more harmful than good.
> The plain revert just removes all the issues with the dirty TLB that the
> original patch introduced and prevents huge mappings from being
> established when there have been smaller mappings before. This is not
> ideal, but at least its is consistent and does not leak pages and leaves
> no dirty TLBs. So this is the easiest and most reliable fix for this
> stage in the release process.
If you think the page directory issue needs a fix ASAP, I believe taking
patch 3/3 is much better option than the plain revert, which will
introduce the fall-back issue I explained.
next prev parent reply other threads:[~2018-05-30 15:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-16 23:32 [PATCH v3 0/3] fix free pmd/pte page handlings on x86 Toshi Kani
2018-05-16 23:32 ` [PATCH v3 1/3] x86/mm: disable ioremap free page handling on x86-PAE Toshi Kani
2018-05-16 23:32 ` [PATCH v3 2/3] ioremap: Update pgtable free interfaces with addr Toshi Kani
2018-05-17 6:47 ` Michal Hocko
2018-05-17 14:32 ` Kani, Toshi
2018-05-16 23:32 ` [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces Toshi Kani
2018-05-29 14:44 ` Joerg Roedel
2018-05-29 16:10 ` Kani, Toshi
2018-05-30 4:59 ` joro
2018-05-30 15:39 ` Kani, Toshi [this message]
2018-06-24 13:19 ` [PATCH v3 0/3] fix free pmd/pte page handlings on x86 Thomas Gleixner
2018-06-25 14:56 ` Kani, Toshi
2018-06-25 17:53 ` Michal Hocko
2018-06-25 21:15 ` Kani, Toshi
2018-06-26 6:35 ` Michal Hocko
2018-06-26 8:45 ` Thomas Gleixner
2018-06-26 8:54 ` Michal Hocko
2018-06-26 15:25 ` Kani, Toshi
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--subject='Re: [PATCH v3 3/3] x86/mm: add TLB purge to free pmd/pte page interfaces' \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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).