linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v26 3/7] arm64: kdump: add kdump support
Date: Fri, 16 Sep 2016 15:50:24 +0100	[thread overview]
Message-ID: <57DC06B0.8030504@arm.com> (raw)
In-Reply-To: <20160907042908.6232-4-takahiro.akashi@linaro.org>

On 07/09/16 05:29, AKASHI Takahiro wrote:
> On crash dump kernel, all the information about primary kernel's system
> memory (core image) is available in elf core header.
> The primary kernel will set aside this header with reserve_elfcorehdr()
> at boot time and inform crash dump kernel of its location via a new
> device-tree property, "linux,elfcorehdr".
> 
> Please note that all other architectures use traditional "elfcorehdr="
> kernel parameter for this purpose.
> 
> Then crash dump kernel will access the primary kernel's memory with
> copy_oldmem_page(), which reads one page by ioremap'ing it since it does
> not reside in linear mapping on crash dump kernel.
> 
> We also need our own elfcorehdr_read() here since the header is placed
> within crash dump kernel's usable memory.

One nit below, looks good.

Reviewed-by: James Morse <james.morse@arm.com>


Thanks,

James


> diff --git a/arch/arm64/kernel/crash_dump.c b/arch/arm64/kernel/crash_dump.c

> +/**
> + * copy_oldmem_page() - copy one page from old kernel memory
> + * @pfn: page frame number to be copied
> + * @buf: buffer where the copied page is placed
> + * @csize: number of bytes to copy
> + * @offset: offset in bytes into the page
> + * @userbuf: if set, @buf is in a user address space
> + *
> + * This function copies one page from old kernel memory into buffer pointed by
> + * @buf. If @buf is in userspace, set @userbuf to %1. Returns number of bytes
> + * copied or negative error in case of failure.
> + */
> +ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
> +			 size_t csize, unsigned long offset,
> +			 int userbuf)
> +{
> +	void *vaddr;
> +
> +	if (!csize)
> +		return 0;
> +
> +	vaddr = memremap(__pfn_to_phys(pfn), PAGE_SIZE, MEMREMAP_WB);
> +	if (!vaddr)
> +		return -ENOMEM;
> +
> +	if (userbuf) {

> +		if (copy_to_user(buf, vaddr + offset, csize)) {

If you re-cast buf with (char __user *), it should stop sparse complaining:
> ../arch/arm64/kernel/crash_dump.c:45:34: warning: incorrect type in argument 1
(different address spaces)
> ../arch/arm64/kernel/crash_dump.c:45:34:    expected void [noderef] <asn:1>*to
> ../arch/arm64/kernel/crash_dump.c:45:34:    got char *buf

  reply	other threads:[~2016-09-16 14:50 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07  4:29 [PATCH v26 0/7] arm64: add kdump support AKASHI Takahiro
2016-09-07  4:29 ` [PATCH v26 1/7] arm64: kdump: reserve memory for crash dump kernel AKASHI Takahiro
2016-09-22 10:23   ` Matthias Bruger
2016-09-23  8:37     ` AKASHI Takahiro
2016-09-07  4:29 ` [PATCH v26 2/7] arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
2016-09-14 18:09   ` James Morse
2016-09-15  8:13     ` Marc Zyngier
2016-09-16  3:21     ` AKASHI Takahiro
2016-09-16 14:49       ` James Morse
2016-09-20  7:36         ` AKASHI Takahiro
2016-09-07  4:29 ` [PATCH v26 3/7] arm64: kdump: add kdump support AKASHI Takahiro
2016-09-16 14:50   ` James Morse [this message]
2016-09-20  7:46     ` AKASHI Takahiro
2016-09-22 15:50   ` Matthias Brugger
2016-09-07  4:29 ` [PATCH v26 4/7] arm64: kdump: add VMCOREINFO's for user-space coredump tools AKASHI Takahiro
2016-09-16 16:04   ` James Morse
2016-09-07  4:29 ` [PATCH v26 5/7] arm64: kdump: enable kdump in the arm64 defconfig AKASHI Takahiro
2016-09-07  4:29 ` [PATCH v26 6/7] arm64: kdump: update a kernel doc AKASHI Takahiro
2016-09-16 16:08   ` James Morse
2016-09-20  8:27     ` AKASHI Takahiro
2016-09-26 17:21     ` Matthias Brugger
2016-09-07  4:32 ` [PATCH v26 7/7] Documentation: dt: chosen properties for arm64 kdump AKASHI Takahiro
2016-09-16 13:03   ` Rob Herring
2016-09-07  4:37 ` [PATCH v26 0/7] arm64: add kdump support AKASHI Takahiro
2016-09-16 16:04 ` James Morse
2016-09-16 20:17   ` Ard Biesheuvel
2016-09-19 16:05     ` James Morse
2016-09-19 16:10       ` Ard Biesheuvel
2016-09-21  7:42       ` AKASHI Takahiro
2016-09-21  7:33   ` AKASHI Takahiro
2016-10-03  7:54 ` Manish Jaggi
2016-10-03 11:04   ` AKASHI Takahiro
2016-10-03 12:41     ` Manish Jaggi
2016-10-04  2:56       ` AKASHI Takahiro
2016-10-04  9:46       ` James Morse
2016-10-04 10:05         ` Manish Jaggi
2016-10-04 10:53           ` James Morse
2016-10-04 13:23             ` Manish Jaggi
2016-10-05  5:48               ` AKASHI Takahiro
2016-10-05  5:41         ` AKASHI Takahiro
2016-10-04 10:18       ` Mark Rutland
2016-10-17 15:41 ` Ruslan Bilovol
2016-10-18  6:26   ` AKASHI Takahiro
2016-11-01 12:19     ` Ruslan Bilovol

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=57DC06B0.8030504@arm.com \
    --to=james.morse@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).