linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Wangxuefeng (E)" <wxf.wang@hisilicon.com>
To: "toshi.kani" <toshi.kani@hpe.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	cpandya <cpandya@codeaurora.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Guohanjun (Hanjun Guo)" <guohanjun@huawei.com>
Cc: Linuxarm <linuxarm@huawei.com>, linux-mm <linux-mm@kvack.org>,
	akpm <akpm@linux-foundation.org>,
	"mark.rutland" <mark.rutland@arm.com>,
	"will.deacon" <will.deacon@arm.com>,
	"catalin.marinas" <catalin.marinas@arm.com>,
	mhocko <mhocko@suse.com>, "hanjun.guo" <hanjun.guo@linaro.org>
Subject: 答复: [RFC patch] ioremap: don't set up huge I/O mappings when p4d/pud/pmd is zero
Date: Wed, 21 Feb 2018 07:36:34 +0000	[thread overview]
Message-ID: <etPan.5a8d2180.1dbfd272.49b8@localhost> (raw)
In-Reply-To: <1519175992.16384.121.camel@hpe.com>

[-- Attachment #1: Type: text/plain, Size: 2415 bytes --]

hi,Toshi
     The old flow of reuse the 4k page as 2M page does not follow the BBM flow for page table reconstruction,not only the memory leak problems.  If BBM flow is not followed,the speculative prefetch of tlb will made false tlb entries cached in MMU, the false address will be got, panic will happen.

THANKS
        wang  xuefeng

Sent from HUAWEI AnyOffice
发件人:Kani, Toshi
收件人:linux-arm-kernel@lists.infradead.org,cpandya@codeaurora.org,linux-kernel@vger.kernel.org,郭寒军
抄送:Linuxarm,linux-mm@kvack.org,王雪峰,akpm@linux-foundation.org,mark.rutland@arm.com,will.deacon@arm.com,catalin.marinas@arm.com,Hocko, Michal,hanjun.guo@linaro.org
时间:2018-02-21 08:34:49
主题:Re: [RFC patch] ioremap: don't set up huge I/O mappings when p4d/pud/pmd is zero

On Tue, 2018-02-20 at 14:54 +0530, Chintan Pandya wrote:
>
> On 12/28/2017 4:54 PM, Hanjun Guo wrote:
> > From: Hanjun Guo <hanjun.guo@linaro.org>
> >
> > When we using iounmap() to free the 4K mapping, it just clear the PTEs
> > but leave P4D/PUD/PMD unchanged, also will not free the memory of page
> > tables.
> >
> > This will cause issues on ARM64 platform (not sure if other archs have
> > the same issue) for this case:
> >
> > 1. ioremap a 4K size, valid page table will build,
> > 2. iounmap it, pte0 will set to 0;
> > 3. ioremap the same address with 2M size, pgd/pmd is unchanged,
> >     then set the a new value for pmd;
> > 4. pte0 is leaked;
> > 5. CPU may meet exception because the old pmd is still in TLB,
> >     which will lead to kernel panic.
> >
> > Fix it by skip setting up the huge I/O mappings when p4d/pud/pmd is
> > zero.
> >
>
> One obvious problem I see here is, once any 2nd level entry has 3rd
> level mapping, this entry can't map 2M section ever in future. This way,
> we will fragment entire virtual space over time.
>
> The code you are changing is common between 32-bit systems as well (I
> think). And running out of section mapping would be a reality in
> practical terms.
>
> So, if we can do the following as a fix up, we would be saved.
> 1) Invalidate 2nd level entry from TLB, and
> 2) Free the page which holds last level page table
>
> BTW, is there any further discussion going on this topic which I am
> missing ?

Yes, I suggested to free up a pte table in my last reply.
https://patchwork.kernel.org/patch/10134581/

Thanks,
-Toshi

[-- Attachment #2: Type: text/html, Size: 3810 bytes --]

  reply	other threads:[~2018-02-21  7:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-28 11:24 [RFC patch] ioremap: don't set up huge I/O mappings when p4d/pud/pmd is zero Hanjun Guo
2017-12-29  8:00 ` Hanjun Guo
2018-01-05 22:15 ` Kani, Toshi
2018-01-06  9:46   ` Hanjun Guo
2018-01-08 23:36     ` Kani, Toshi
2018-02-20  9:24 ` Chintan Pandya
2018-02-21  0:34   ` Kani, Toshi
2018-02-21  7:36     ` Wangxuefeng (E) [this message]
2018-02-21 11:57       ` 答复: " Will Deacon
2018-02-21 12:47         ` 答复: " Wangxuefeng (E)
2018-02-26 10:57         ` Hanjun Guo
2018-02-26 11:04           ` Will Deacon
2018-02-26 12:53             ` Hanjun Guo
2018-02-27 19:49               ` Kani, Toshi
2018-02-27 19:59                 ` Will Deacon
2018-02-27 20:02                   ` 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=etPan.5a8d2180.1dbfd272.49b8@localhost \
    --to=wxf.wang@hisilicon.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=cpandya@codeaurora.org \
    --cc=guohanjun@huawei.com \
    --cc=hanjun.guo@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mhocko@suse.com \
    --cc=toshi.kani@hpe.com \
    --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).