All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Pratyush Anand <panand@redhat.com>
Cc: mark.rutland@arm.com, geoff@infradead.org,
	catalin.marinas@arm.com, will.deacon@arm.com,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	bauerman@linux.vnet.ibm.com, dyoung@redhat.com,
	kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v24 5/9] arm64: kdump: add kdump support
Date: Tue, 16 Aug 2016 11:13:45 +0100	[thread overview]
Message-ID: <57B2E759.201@arm.com> (raw)
In-Reply-To: <20160811100310.GA29357@localhost.localdomain>

Hi Pratyush,

On 11/08/16 11:03, Pratyush Anand wrote:
> On 10/08/2016:11:48:27 PM, Pratyush Anand wrote:
>> On 10/08/2016:05:38:05 PM, James Morse wrote:
>>> =========================%<=========================
>>> diff --git a/arch/arm64/kernel/crash_dump.c b/arch/arm64/kernel/crash_dump.c
>>> index 2dc54d129be1..784d4c30b534 100644
>>> --- a/arch/arm64/kernel/crash_dump.c
>>> +++ b/arch/arm64/kernel/crash_dump.c
>>> @@ -37,6 +37,11 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
>>>         if (!csize)
>>>                 return 0;
>>>
>>> +       if (memblock_is_memory(pfn << PAGE_SHIFT) &&
>>> +           !memblock_is_map_memory(pfn << PAGE_SHIFT))
>>> +               /* skip this nomap memory region, reserved by firmware */
>>> +               return 0;
> 
> This should return 0 or -EINVAL? because, its caller does not care properly
> about 0 return value (when csize is non-zero). So either we need to return
> -EINVAL or we need to fix it's caller so that pread() would know that required
> number of data were not read.

I blindly followed 'number of bytes copied' -> 0. It worked for me, but may not
be correct.

remap_oldmem_pfn_checked() looks like it substitutes the zero page in this (or
at least a similar) case, maybe we should do the same for nomap pages.


> 
>>> +
>>>         vaddr = ioremap_cache(__pfn_to_phys(pfn), PAGE_SIZE);
>>>         if (!vaddr)
>>>                 return -ENOMEM;
>>> =========================%<=========================
>>
>> In any case kernel must not panic, so I think we must have above hunk. However,
>> we also need to look into kexec-tools that why it is asking kernel to copy those
>> unneeded chunks.
>>
>> I will test tomorrow with above hunk.
> 
> After that hunk it did not crash but vmcore-dmesg fails with following message:
> "No program header covering vaddr 0x401ff0found kexec bug?"
> 
> It happened because vmcore-dmesg is sending wrong offset to the pread(), and so
> it did not crash after the above kernel hunk but it still read garbage wrong
> log_buf virtual address pointer.
> 
> vmcore-dmesg is sending wrong offset because page_offset(vp_offset) calculation
> is not perfect for my case, explained here [1].
> 
> So, if I correct page_offset(vp_offset) (as arm64_mem.page_offset = ehdr.e_entry
> - "kernel Code Start PA" + phys_offset), then vmcore-dmesg and vmcore copy
> worked fine, however if I use makedumpfile to copy(compressed) data from
> /proc/vmcore then it still generates "synchronous external abort". I think, it

At a guess makedumpfile is mmap()ing /proc/vmcore so it can use multiple
threads to read (then compress) the data. This bypasses the check added to
copy_oldmem_page(). We probably need to provide a remap_oldmem_pfn_range() that
checks whether the range contains nomap pages.

I will try and send a fixup patch to do this later this week, (unless someone
beats me to it!)


> generated because it would have found garbage data in EFI memory region.

If it was marked as belonging to efi in the efi memory map, the kernel shouldn't
be touching it. If you add 'efi=debug' to your kernel cmdline you get a table of
the addresses and properties.


Thanks,

James


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v24 5/9] arm64: kdump: add kdump support
Date: Tue, 16 Aug 2016 11:13:45 +0100	[thread overview]
Message-ID: <57B2E759.201@arm.com> (raw)
In-Reply-To: <20160811100310.GA29357@localhost.localdomain>

Hi Pratyush,

On 11/08/16 11:03, Pratyush Anand wrote:
> On 10/08/2016:11:48:27 PM, Pratyush Anand wrote:
>> On 10/08/2016:05:38:05 PM, James Morse wrote:
>>> =========================%<=========================
>>> diff --git a/arch/arm64/kernel/crash_dump.c b/arch/arm64/kernel/crash_dump.c
>>> index 2dc54d129be1..784d4c30b534 100644
>>> --- a/arch/arm64/kernel/crash_dump.c
>>> +++ b/arch/arm64/kernel/crash_dump.c
>>> @@ -37,6 +37,11 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
>>>         if (!csize)
>>>                 return 0;
>>>
>>> +       if (memblock_is_memory(pfn << PAGE_SHIFT) &&
>>> +           !memblock_is_map_memory(pfn << PAGE_SHIFT))
>>> +               /* skip this nomap memory region, reserved by firmware */
>>> +               return 0;
> 
> This should return 0 or -EINVAL? because, its caller does not care properly
> about 0 return value (when csize is non-zero). So either we need to return
> -EINVAL or we need to fix it's caller so that pread() would know that required
> number of data were not read.

I blindly followed 'number of bytes copied' -> 0. It worked for me, but may not
be correct.

remap_oldmem_pfn_checked() looks like it substitutes the zero page in this (or
at least a similar) case, maybe we should do the same for nomap pages.


> 
>>> +
>>>         vaddr = ioremap_cache(__pfn_to_phys(pfn), PAGE_SIZE);
>>>         if (!vaddr)
>>>                 return -ENOMEM;
>>> =========================%<=========================
>>
>> In any case kernel must not panic, so I think we must have above hunk. However,
>> we also need to look into kexec-tools that why it is asking kernel to copy those
>> unneeded chunks.
>>
>> I will test tomorrow with above hunk.
> 
> After that hunk it did not crash but vmcore-dmesg fails with following message:
> "No program header covering vaddr 0x401ff0found kexec bug?"
> 
> It happened because vmcore-dmesg is sending wrong offset to the pread(), and so
> it did not crash after the above kernel hunk but it still read garbage wrong
> log_buf virtual address pointer.
> 
> vmcore-dmesg is sending wrong offset because page_offset(vp_offset) calculation
> is not perfect for my case, explained here [1].
> 
> So, if I correct page_offset(vp_offset) (as arm64_mem.page_offset = ehdr.e_entry
> - "kernel Code Start PA" + phys_offset), then vmcore-dmesg and vmcore copy
> worked fine, however if I use makedumpfile to copy(compressed) data from
> /proc/vmcore then it still generates "synchronous external abort". I think, it

At a guess makedumpfile is mmap()ing /proc/vmcore so it can use multiple
threads to read (then compress) the data. This bypasses the check added to
copy_oldmem_page(). We probably need to provide a remap_oldmem_pfn_range() that
checks whether the range contains nomap pages.

I will try and send a fixup patch to do this later this week, (unless someone
beats me to it!)


> generated because it would have found garbage data in EFI memory region.

If it was marked as belonging to efi in the efi memory map, the kernel shouldn't
be touching it. If you add 'efi=debug' to your kernel cmdline you get a table of
the addresses and properties.


Thanks,

James

  reply	other threads:[~2016-08-16 10:13 UTC|newest]

Thread overview: 117+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09  1:52 [PATCH v24 0/9] arm64: add kdump support AKASHI Takahiro
2016-08-09  1:52 ` AKASHI Takahiro
2016-08-09  1:52 ` [PATCH v24 1/9] arm64: kdump: reserve memory for crash dump kernel AKASHI Takahiro
2016-08-09  1:52   ` AKASHI Takahiro
2016-08-09  1:55   ` [PATCH v24 2/9] memblock: add memblock_cap_memory_range() AKASHI Takahiro
2016-08-09  1:55     ` AKASHI Takahiro
2016-08-09  1:55     ` AKASHI Takahiro
2016-08-10 16:26     ` James Morse
2016-08-10 16:26       ` James Morse
2016-08-10 16:26       ` James Morse
2016-08-09  1:56   ` [PATCH v24 3/9] arm64: limit memory regions based on DT property, usable-memory-range AKASHI Takahiro
2016-08-09  1:56     ` AKASHI Takahiro
2016-08-09  1:56     ` [PATCH v24 4/9] arm64: kdump: implement machine_crash_shutdown() AKASHI Takahiro
2016-08-09  1:56       ` AKASHI Takahiro
2016-08-09  1:56     ` [PATCH v24 5/9] arm64: kdump: add kdump support AKASHI Takahiro
2016-08-09  1:56       ` AKASHI Takahiro
2016-08-10 16:38       ` James Morse
2016-08-10 16:38         ` James Morse
2016-08-10 18:18         ` Pratyush Anand
2016-08-10 18:18           ` Pratyush Anand
2016-08-11 10:03           ` Pratyush Anand
2016-08-11 10:03             ` Pratyush Anand
2016-08-16 10:13             ` James Morse [this message]
2016-08-16 10:13               ` James Morse
2016-08-17 15:33               ` [PATCH] fixup! " James Morse
2016-08-17 15:33                 ` James Morse
2016-08-18  7:32                 ` AKASHI Takahiro
2016-08-18  7:32                   ` AKASHI Takahiro
2016-08-19  8:00                 ` Pratyush Anand
2016-08-19  8:00                   ` Pratyush Anand
2016-08-19 13:34                   ` James Morse
2016-08-19 13:34                     ` James Morse
2016-08-19 15:19                     ` Pratyush Anand
2016-08-19 15:19                       ` Pratyush Anand
2016-08-18  7:15         ` [PATCH v24 5/9] " AKASHI Takahiro
2016-08-18  7:15           ` AKASHI Takahiro
2016-08-18  7:19           ` Dave Young
2016-08-18  7:19             ` Dave Young
2016-08-19  1:26           ` AKASHI Takahiro
2016-08-19  1:26             ` AKASHI Takahiro
2016-08-19 11:22             ` Pratyush Anand
2016-08-19 11:22               ` Pratyush Anand
2016-08-22  1:29               ` AKASHI Takahiro
2016-08-22  1:29                 ` AKASHI Takahiro
2016-08-22  7:07                 ` Pratyush Anand
2016-08-22  7:07                   ` Pratyush Anand
2016-08-22 13:47                 ` James Morse
2016-08-22 13:47                   ` James Morse
2016-08-23  0:38                   ` AKASHI Takahiro
2016-08-23  0:38                     ` AKASHI Takahiro
2016-08-23 11:23                     ` Pratyush Anand
2016-08-23 11:23                       ` Pratyush Anand
2016-08-24  8:04                       ` Dave Young
2016-08-24  8:04                         ` Dave Young
2016-08-24  8:04                         ` Dave Young
2016-08-24 10:25                         ` James Morse
2016-08-24 10:25                           ` James Morse
2016-08-24 10:25                           ` James Morse
2016-08-25  1:04                           ` Dave Young
2016-08-25  1:04                             ` Dave Young
2016-08-25  1:04                             ` Dave Young
2016-08-19 13:28             ` James Morse
2016-08-19 13:28               ` James Morse
2016-08-22  1:23               ` AKASHI Takahiro
2016-08-22  1:23                 ` AKASHI Takahiro
2016-08-24 14:44       ` Ard Biesheuvel
2016-08-24 14:44         ` Ard Biesheuvel
2016-08-26  6:22         ` AKASHI Takahiro
2016-08-26  6:22           ` AKASHI Takahiro
2016-08-09  1:56     ` [PATCH v24 6/9] arm64: kdump: add VMCOREINFO's for user-space coredump tools AKASHI Takahiro
2016-08-09  1:56       ` AKASHI Takahiro
2016-08-09  1:56     ` [PATCH v24 7/9] arm64: kdump: enable kdump in the arm64 defconfig AKASHI Takahiro
2016-08-09  1:56       ` AKASHI Takahiro
2016-08-09  1:56     ` [PATCH v24 8/9] arm64: kdump: update a kernel doc AKASHI Takahiro
2016-08-09  1:56       ` AKASHI Takahiro
2016-08-09  1:57   ` [PATCH v24 9/9] Documentation: dt: chosen properties for arm64 kdump AKASHI Takahiro
2016-08-09  1:57     ` AKASHI Takahiro
2016-08-09  1:57     ` AKASHI Takahiro
2016-08-19 13:26     ` Rob Herring
2016-08-19 13:26       ` Rob Herring
2016-08-19 13:26       ` Rob Herring
2016-08-22  4:28       ` AKASHI Takahiro
2016-08-22  4:28         ` AKASHI Takahiro
2016-08-22  4:28         ` AKASHI Takahiro
2016-08-30 16:34         ` Rob Herring
2016-08-30 16:34           ` Rob Herring
2016-08-30 16:34           ` Rob Herring
2016-08-30 23:45           ` AKASHI Takahiro
2016-08-30 23:45             ` AKASHI Takahiro
2016-08-30 23:45             ` AKASHI Takahiro
2016-08-31  5:02             ` AKASHI Takahiro
2016-08-31  5:02               ` AKASHI Takahiro
2016-08-31  5:02               ` AKASHI Takahiro
2016-09-02 10:11               ` AKASHI Takahiro
2016-09-02 10:11                 ` AKASHI Takahiro
2016-09-02 10:11                 ` AKASHI Takahiro
2016-09-27 23:39       ` Mark Rutland
2016-09-27 23:39         ` Mark Rutland
2016-09-27 23:39         ` Mark Rutland
2016-08-09  2:04 ` [PATCH v24 0/9] arm64: add kdump support AKASHI Takahiro
2016-08-09  2:04   ` AKASHI Takahiro
2016-08-31  3:41 ` Manish Jaggi
2016-08-31  3:41   ` Manish Jaggi
2016-08-31  5:31   ` AKASHI Takahiro
2016-08-31  5:31     ` AKASHI Takahiro
2016-09-02 12:53     ` Manish Jaggi
2016-09-02 12:53       ` Manish Jaggi
2016-09-05  8:15       ` AKASHI Takahiro
2016-09-05  8:15         ` AKASHI Takahiro
2016-09-05 12:42         ` Manish Jaggi
2016-09-05 12:42           ` Manish Jaggi
2016-09-06 15:33           ` Marc Zyngier
2016-09-06 15:33             ` Marc Zyngier
2016-09-06 16:15             ` Manish Jaggi
2016-09-06 16:15               ` Manish Jaggi
2016-09-06 16:42               ` Marc Zyngier
2016-09-06 16:42                 ` Marc Zyngier

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=57B2E759.201@arm.com \
    --to=james.morse@arm.com \
    --cc=bauerman@linux.vnet.ibm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dyoung@redhat.com \
    --cc=geoff@infradead.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=panand@redhat.com \
    --cc=takahiro.akashi@linaro.org \
    --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 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.