From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v30 05/11] arm64: kdump: protect crash dump kernel memory
Date: Fri, 27 Jan 2017 19:41:14 +0000 [thread overview]
Message-ID: <20170127194114.GA31865@leverpostej> (raw)
In-Reply-To: <20170127154217.GA4113@fireball>
On Sat, Jan 28, 2017 at 12:42:20AM +0900, AKASHI Takahiro wrote:
> On Fri, Jan 27, 2017 at 01:59:05PM +0000, James Morse wrote:
> > On 24/01/17 08:49, AKASHI Takahiro wrote:
> > > + /*
> > > + * While crash dump kernel memory is contained in a single memblock
> > > + * for now, it should appear in an isolated mapping so that we can
> > > + * independently unmap the region later.
> > > + */
> > > + if (crashk_res.end && crashk_res.start >= start &&
> > > + crashk_res.end <= end) {
> > > + if (crashk_res.start != start)
> > > + __create_pgd_mapping(pgd, start, __phys_to_virt(start),
> > > + crashk_res.start - start,
> > > + PAGE_KERNEL,
> > > + early_pgtable_alloc,
> > > + debug_pagealloc_enabled());
> > > +
> > > + /* before kexec_load(), the region can be read-writable. */
> > > + __create_pgd_mapping(pgd, crashk_res.start,
> > > + __phys_to_virt(crashk_res.start),
> > > + crashk_res.end - crashk_res.start + 1,
> > > + PAGE_KERNEL, early_pgtable_alloc,
> > > + debug_pagealloc_enabled());
> > > +
> > > + if (crashk_res.end != end)
> > > + __create_pgd_mapping(pgd, crashk_res.end + 1,
> > > + __phys_to_virt(crashk_res.end + 1),
> > > + end - crashk_res.end - 1,
> > > + PAGE_KERNEL,
> > > + early_pgtable_alloc,
> > > + debug_pagealloc_enabled());
> >
> > > + return;
> >
> > Doesn't this mean we skip all the 'does this overlap with the kernel text' tests
> > that happen further down in this file?
>
> You're right. We should still ckeck the overlap against
> [start..crashk_res.start] and [crashk_res.end+1..end].
>
> (Using memblock_isolate_range() could simplify the code.)
My key concern here was that we handle both of these in the same way, so
using memblock_isolate_range() for both generally sounds fine to me.
One concern I had with using memblock_isolate_range() is that it does
not guarantee that the region remains isolated. So if there was a
subsequent memblock_add() call, memblock_merge_regions() might end up
merging the region with an adjacent region.
If we isolate the regions at the start of map_mem(), and have a comment
explaining that we must avoid subsequent memblock merging, then I think
this would be ok.
Thanks,
Mark.
next prev parent reply other threads:[~2017-01-27 19:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 8:46 [PATCH v30 00/11] arm64: add kdump support AKASHI Takahiro
2017-01-24 8:49 ` [PATCH v30 01/11] memblock: add memblock_cap_memory_range() AKASHI Takahiro
2017-01-24 8:49 ` [PATCH v30 02/11] arm64: limit memory regions based on DT property, usable-memory-range AKASHI Takahiro
2017-01-24 8:49 ` [PATCH v30 03/11] arm64: kdump: reserve memory for crash dump kernel AKASHI Takahiro
2017-01-24 8:49 ` [PATCH v30 04/11] arm64: mm: allow for unmapping memory region from kernel mapping AKASHI Takahiro
2017-01-24 11:32 ` Pratyush Anand
2017-01-25 6:37 ` AKASHI Takahiro
2017-01-25 15:49 ` James Morse
2017-01-26 8:08 ` AKASHI Takahiro
2017-01-24 8:49 ` [PATCH v30 05/11] arm64: kdump: protect crash dump kernel memory AKASHI Takahiro
2017-01-25 17:37 ` James Morse
2017-01-26 11:28 ` AKASHI Takahiro
2017-01-27 11:19 ` James Morse
2017-01-27 17:15 ` AKASHI Takahiro
2017-01-27 18:56 ` Mark Rutland
2017-01-30 8:42 ` AKASHI Takahiro
2017-01-30 8:27 ` AKASHI Takahiro
2017-01-27 13:59 ` James Morse
2017-01-27 15:42 ` AKASHI Takahiro
2017-01-27 19:41 ` Mark Rutland [this message]
2017-01-24 8:50 ` [PATCH v30 06/11] arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
2017-01-24 8:50 ` [PATCH v30 07/11] arm64: kdump: add VMCOREINFO's for user-space tools AKASHI Takahiro
2017-01-24 8:50 ` [PATCH v30 08/11] arm64: kdump: provide /proc/vmcore file AKASHI Takahiro
2017-01-24 8:50 ` [PATCH v30 09/11] arm64: kdump: enable kdump in defconfig AKASHI Takahiro
2017-01-24 8:50 ` [PATCH v30 10/11] Documentation: kdump: describe arm64 port AKASHI Takahiro
2017-01-24 8:53 ` [PATCH v30 11/11] Documentation: dt: chosen properties for arm64 kdump AKASHI Takahiro
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=20170127194114.GA31865@leverpostej \
--to=mark.rutland@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 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).