From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Pratyush Anand <panand@redhat.com>,
geoff@infradead.org, catalin.marinas@arm.com,
will.deacon@arm.com, james.morse@arm.com,
Mark Salter <msalter@redhat.com>,
bauerman@linux.vnet.ibm.com, dyoung@redhat.com,
kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v29 3/9] arm64: kdump: reserve memory for crash dump kernel
Date: Mon, 23 Jan 2017 18:51:46 +0900 [thread overview]
Message-ID: <20170123095145.GA23406@linaro.org> (raw)
In-Reply-To: <20170119112850.GD11176@leverpostej>
Mark,
On Thu, Jan 19, 2017 at 11:28:50AM +0000, Mark Rutland wrote:
> On Thu, Jan 19, 2017 at 06:49:42PM +0900, AKASHI Takahiro wrote:
> > On Tue, Jan 17, 2017 at 11:54:42AM +0000, Mark Rutland wrote:
> > > On Tue, Jan 17, 2017 at 05:20:44PM +0900, AKASHI Takahiro wrote:
> > > > On Fri, Jan 13, 2017 at 11:39:15AM +0000, Mark Rutland wrote:
> > > > > Great! I think it would be better to follow the approach of
> > > > > mark_rodata_ro(), rather than opening up set_memory_*(), but otherwise,
> > > > > it looks like it should work.
> > > >
> > > > I'm not quite sure what the approach of mark_rodata_ro() means, but
> > > > I found that using create_mapping_late() may cause two problems:
> > > >
> > > > 1) it fails when PTE_CONT bits mismatch between an old and new mmu entry.
> > > > This can happen, say, if the memory range for crash dump kernel
> > > > starts in the mid of _continuous_ pages.
> > >
> > > That should only happen if we try to remap a segment different to what
> > > we originally mapped.
> > >
> > > I was intending that we'd explicitly map the reserved region separately
> > > in the boot path, like we do for kernel segments in map_kernel(). We
> > > would allow sections and/or CONT entires.
> > >
> > > Then, in __map_memblock() we'd then skip that range as we do for the
> > > linear map alias of the kernel image.
> > >
> > > That way, we can later use create_mapping_late for that same region, and
> > > it should handle sections and/or CONT entries in the exact same way as
> > > it does for the kernel image segments in mark_rodata_ro().
> >
> > I see.
> > Which one do you prefer, yours above or my (second) solution?
> > Either way, they do almost the same thing in terms of mapping.
>
> While both should work, I'd prefer to match the existing map_kernel()
> logic, (i.e. my suggestion above), for consistency.
OK
> > > I don't think we have much code useful for unmapping. We could re-use
> > > create_mapping_late for this, passing a set of prot bits that means the
> > > entries are invalid (e.g. have a PAGE_KERNEL_INVALID).
> >
> > Do you really think that we should totally invalidate mmu entries?
> > I guess that, given proper cache & TLB flush operations, RO attribute is
> > good enough for memory consistency, no?
> > (None accesses the region, as I said, except in the case of re-loading
> > crash dump kernel though.)
>
> My worry is that the first kernel and kdump kernel may map (portions of)
> the region with potentially confliciting memory attributes. So it would
> be necessary to completely unmap the region.
I think that this can happen only if the second kernel boots up,
leaving non-crashed cpus still running for some reason.
> You raise a good point that this would also mean we need to perform some
> cache maintenance, which makes that a little more painful. We'd need a
> sequence like:
>
> * Unmap the region
> * TLB invalidation
> * Remap the region with non-cacheable attributes
> * Cache maintenance
> * Unmap the region
> * TLB invalidation
I don't get why we need to remap the region and do cache
maintenance here. Please elaborate a bit more?
My current implementation of arch_kexec_protect_crashkres() is:
kexec_segment_flush(kexec_crash_image);
create_mapping_late(crashk_res.start, ..., __pgprot(0));
or PAGE_KERNEL_INVALID
flush_tlb_all();
kexec_segment_flush() will eventually do dcache-flush for all the modified
data in crash dump kernel memory.
> > > We'd have to perform the TLB invalidation ourselves, but that shouldn't
> > > be too painful.
> >
> > Do we need to invalidate TLBs not only before but also after changing
> > permission attributes as make_rodata_ro() does?
>
> I believe we'd only have to perform the TLB invalidation after the
> change of attributes.
OK
Thanks,
-Takahiro AKASHI
> Thanks,
> Mark.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2017-01-23 9:52 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-28 4:33 [PATCH v29 0/9] arm64: add kdump support AKASHI Takahiro
2016-12-28 4:35 ` [PATCH v29 1/9] memblock: add memblock_cap_memory_range() AKASHI Takahiro
2017-01-10 11:16 ` Will Deacon
2017-01-11 1:57 ` Dennis Chen
2016-12-28 4:35 ` [PATCH v29 2/9] arm64: limit memory regions based on DT property, usable-memory-range AKASHI Takahiro
2016-12-28 4:36 ` [PATCH v29 3/9] arm64: kdump: reserve memory for crash dump kernel AKASHI Takahiro
2017-01-12 15:09 ` Mark Rutland
2017-01-13 8:16 ` AKASHI Takahiro
2017-01-13 11:39 ` Mark Rutland
2017-01-17 8:20 ` AKASHI Takahiro
2017-01-17 11:54 ` Mark Rutland
2017-01-19 9:49 ` AKASHI Takahiro
2017-01-19 11:28 ` Mark Rutland
2017-01-23 9:51 ` AKASHI Takahiro [this message]
2017-01-23 10:23 ` Mark Rutland
2017-01-24 7:55 ` AKASHI Takahiro
2016-12-28 4:36 ` [PATCH v29 4/9] arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
2017-01-10 11:32 ` Will Deacon
2017-01-11 6:36 ` AKASHI Takahiro
2017-01-11 10:54 ` Will Deacon
2017-01-12 4:21 ` AKASHI Takahiro
2017-01-12 12:01 ` Will Deacon
2017-01-23 17:46 ` Will Deacon
2017-01-24 7:52 ` AKASHI Takahiro
2016-12-28 4:36 ` [PATCH v29 5/9] arm64: kdump: add VMCOREINFO's for user-space tools AKASHI Takahiro
2016-12-28 4:36 ` [PATCH v29 6/9] arm64: kdump: provide /proc/vmcore file AKASHI Takahiro
2016-12-28 4:36 ` [PATCH v29 7/9] arm64: kdump: enable kdump in defconfig AKASHI Takahiro
2016-12-28 4:36 ` [PATCH v29 8/9] Documentation: kdump: describe arm64 port AKASHI Takahiro
2016-12-28 4:37 ` [PATCH v29 9/9] Documentation: dt: chosen properties for arm64 kdump AKASHI Takahiro
2017-01-10 11:10 ` Will Deacon
2017-01-12 15:39 ` Mark Rutland
2017-01-13 9:13 ` AKASHI Takahiro
2017-01-13 11:17 ` Mark Rutland
2017-01-16 8:25 ` AKASHI Takahiro
2017-01-17 8:26 ` Dave Young
2017-01-19 9:01 ` AKASHI Takahiro
2017-01-17 11:13 ` Mark Rutland
2017-01-06 3:26 ` [PATCH v29 0/9] arm64: add kdump support Pratyush Anand
2017-01-06 4:34 ` 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=20170123095145.GA23406@linaro.org \
--to=takahiro.akashi@linaro.org \
--cc=bauerman@linux.vnet.ibm.com \
--cc=catalin.marinas@arm.com \
--cc=dyoung@redhat.com \
--cc=geoff@infradead.org \
--cc=james.morse@arm.com \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=msalter@redhat.com \
--cc=panand@redhat.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