From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: [BUG] ARM64: Create 4K page size mmu memory map at init time will trigger exception.
Date: Thu, 22 Aug 2013 17:16:14 +0100 [thread overview]
Message-ID: <20130822161614.GE1352@arm.com> (raw)
In-Reply-To: <BFAC7FA8F7636E45AB9ECBAC17346F3434557683@SZXEML508-MBS.china.huawei.com>
On Thu, Aug 22, 2013 at 04:35:29AM +0100, Leizhen (ThunderTown, Euler) wrote:
> This problem is on ARM64. When CONFIG_ARM64_64K_PAGES is not opened, the memory
> map size can be 2M(section) and 4K(PAGE). First, OS will create map for pgd
> (level 1 table) and level 2 table which in swapper_pg_dir. Then, OS register
> mem block into memblock.memory according to memory node in fdt, like memory at 0,
> and create map in setup_arch-->paging_init. If all mem block start address and
> size is integral multiple of 2M, there is no problem, because we will create 2M
> section size map whose entries locate in level 2 table. But if it is not
> integral multiple of 2M, we should create level 3 table, which granule is 4K.
> Now, current implementtion is call early_alloc-->memblock_alloc to alloc memory
> for level 3 table. This function will find a 4K free memory which locate in
> memblock.memory tail(high address), but paging_init is create map from low
> address to high address, so new alloced memory is not mapped, write page talbe
> entry to it will trigger exception.
I see how this can happen. There is a memblock_set_current_limit to
PGDIR_SIZE (1GB, we have a pre-allocated pmd) and in my tests I had at
least 1GB of RAM which got mapped first and didn't have this problem.
I'll come up with a patch tomorrow.
--
Catalin
P.S. Please try to send plain-text (rather than HTML) emails only, with
nicely wrapped lines. Thanks.
WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: "Leizhen (ThunderTown, Euler)" <thunder.leizhen@huawei.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Russell King <linux@arm.linux.org.uk>,
Will Deacon <Will.Deacon@arm.com>, Huxinwei <huxinwei@huawei.com>,
"Liujiang (Gerry)" <jiang.liu@huawei.com>,
Lizefan <lizefan@huawei.com>
Subject: Re: [BUG] ARM64: Create 4K page size mmu memory map at init time will trigger exception.
Date: Thu, 22 Aug 2013 17:16:14 +0100 [thread overview]
Message-ID: <20130822161614.GE1352@arm.com> (raw)
In-Reply-To: <BFAC7FA8F7636E45AB9ECBAC17346F3434557683@SZXEML508-MBS.china.huawei.com>
On Thu, Aug 22, 2013 at 04:35:29AM +0100, Leizhen (ThunderTown, Euler) wrote:
> This problem is on ARM64. When CONFIG_ARM64_64K_PAGES is not opened, the memory
> map size can be 2M(section) and 4K(PAGE). First, OS will create map for pgd
> (level 1 table) and level 2 table which in swapper_pg_dir. Then, OS register
> mem block into memblock.memory according to memory node in fdt, like memory@0,
> and create map in setup_arch-->paging_init. If all mem block start address and
> size is integral multiple of 2M, there is no problem, because we will create 2M
> section size map whose entries locate in level 2 table. But if it is not
> integral multiple of 2M, we should create level 3 table, which granule is 4K.
> Now, current implementtion is call early_alloc-->memblock_alloc to alloc memory
> for level 3 table. This function will find a 4K free memory which locate in
> memblock.memory tail(high address), but paging_init is create map from low
> address to high address, so new alloced memory is not mapped, write page talbe
> entry to it will trigger exception.
I see how this can happen. There is a memblock_set_current_limit to
PGDIR_SIZE (1GB, we have a pre-allocated pmd) and in my tests I had at
least 1GB of RAM which got mapped first and didn't have this problem.
I'll come up with a patch tomorrow.
--
Catalin
P.S. Please try to send plain-text (rather than HTML) emails only, with
nicely wrapped lines. Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: "Leizhen (ThunderTown, Euler)" <thunder.leizhen@huawei.com>
Cc: "linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Russell King <linux@arm.linux.org.uk>,
Will Deacon <Will.Deacon@arm.com>, Huxinwei <huxinwei@huawei.com>,
"Liujiang (Gerry)" <jiang.liu@huawei.com>,
Lizefan <lizefan@huawei.com>
Subject: Re: [BUG] ARM64: Create 4K page size mmu memory map at init time will trigger exception.
Date: Thu, 22 Aug 2013 17:16:14 +0100 [thread overview]
Message-ID: <20130822161614.GE1352@arm.com> (raw)
In-Reply-To: <BFAC7FA8F7636E45AB9ECBAC17346F3434557683@SZXEML508-MBS.china.huawei.com>
On Thu, Aug 22, 2013 at 04:35:29AM +0100, Leizhen (ThunderTown, Euler) wrote:
> This problem is on ARM64. When CONFIG_ARM64_64K_PAGES is not opened, the memory
> map size can be 2M(section) and 4K(PAGE). First, OS will create map for pgd
> (level 1 table) and level 2 table which in swapper_pg_dir. Then, OS register
> mem block into memblock.memory according to memory node in fdt, like memory@0,
> and create map in setup_arch-->paging_init. If all mem block start address and
> size is integral multiple of 2M, there is no problem, because we will create 2M
> section size map whose entries locate in level 2 table. But if it is not
> integral multiple of 2M, we should create level 3 table, which granule is 4K.
> Now, current implementtion is call early_alloc-->memblock_alloc to alloc memory
> for level 3 table. This function will find a 4K free memory which locate in
> memblock.memory tail(high address), but paging_init is create map from low
> address to high address, so new alloced memory is not mapped, write page talbe
> entry to it will trigger exception.
I see how this can happen. There is a memblock_set_current_limit to
PGDIR_SIZE (1GB, we have a pre-allocated pmd) and in my tests I had at
least 1GB of RAM which got mapped first and didn't have this problem.
I'll come up with a patch tomorrow.
--
Catalin
P.S. Please try to send plain-text (rather than HTML) emails only, with
nicely wrapped lines. Thanks.
next prev parent reply other threads:[~2013-08-22 16:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 3:35 [BUG] ARM64: Create 4K page size mmu memory map at init time will trigger exception Leizhen (ThunderTown, Euler)
2013-08-22 16:16 ` Catalin Marinas [this message]
2013-08-22 16:16 ` Catalin Marinas
2013-08-22 16:16 ` Catalin Marinas
2013-08-23 17:16 ` Catalin Marinas
2013-08-23 17:16 ` Catalin Marinas
2013-08-23 17:16 ` Catalin Marinas
2013-08-27 12:38 ` leizhen
2013-08-27 12:38 ` leizhen
2013-08-27 12:38 ` leizhen
2013-08-27 14:48 ` Catalin Marinas
2013-08-27 14:48 ` Catalin Marinas
2013-08-27 14:48 ` Catalin Marinas
2013-08-28 0:57 ` leizhen
2013-08-28 0:57 ` leizhen
2013-08-28 0:57 ` leizhen
2013-08-28 1:34 ` leizhen
2013-08-28 1:34 ` leizhen
2013-08-28 1:34 ` leizhen
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=20130822161614.GE1352@arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.