mbox series

[0/3] arm64: kexec,kdump: fix boot failures on acpi-only system

Message ID 20180615075623.13454-1-takahiro.akashi@linaro.org
Headers show
Series arm64: kexec,kdump: fix boot failures on acpi-only system | expand

Message

AKASHI Takahiro June 15, 2018, 7:56 a.m. UTC
# apologies for a bit late updates

This patch series is a set of bug fixes to address kexec/kdump
failures which are sometimes observed on ACPI-only system and reported
in LAK-ML before.

In short, the phenomena are:
1. kexec'ed kernel can fail to boot because some ACPI table is corrupted
   by a new kernel (or other data) being loaded into System RAM. Currently
   kexec may possibly allocate space ignoring such "reserved" regions.
   We will see no messages after "Bye!"

2. crash dump (kdump) kernel can fail to boot and get into panic due to
   an alignment fault when accessing ACPI tables. This can happen because
   those tables are not always properly aligned while they are mapped
   non-cacheable (ioremap'ed) as they are not recognized as part of System
   RAM under the current implementation.

After discussing several possibilities to address those issues,
the agreed approach, in my understanding, is
* to add resource entries for every "reserved", i.e. memblock_reserve(),
  regions to /proc/iomem.
  (NOMAP regions, also marked as "reserved," remains at top-level for
  backward compatibility.)
* For case (1), user space (kexec-tools) should rule out such regions
  in searching for free space for loaded data.
* For case (2), the kernel should access ACPI tables by mapping
  them with appropriate memory attributes described in UEFI memory map.
  (This means that it doesn't require any changes in /proc/iomem, and
  hence user space.)

Please find past discussions about /proc/iomem in [1].

Patch#1 addresses kexec case, for which you are also required to update
user space. See necessary patches in [2]. If you want to review Patch#1,
please also take a look at and review [2].

Patch#2 and #3 addresses kdump case. This is a revised version after
Ard's comments.[3]

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-March/565980.html
[2] https://git.linaro.org/people/takahiro.akashi/kexec-tools.git arm64/resv_mem
[3] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-April/573655.html

AKASHI Takahiro (2):
  arm64: acpi,efi: fix alignment fault in accessing ACPI tables at kdump
  init: map UEFI memory map early if on arm or arm64

James Morse (1):
  arm64: export memblock_reserve()d regions via /proc/iomem

 arch/arm64/include/asm/acpi.h      | 23 ++++++++++++------
 arch/arm64/kernel/acpi.c           | 11 +++------
 arch/arm64/kernel/setup.c          | 38 ++++++++++++++++++++++++++++++
 drivers/firmware/efi/arm-runtime.c | 27 ++++++++++-----------
 init/main.c                        |  3 +++
 5 files changed, 72 insertions(+), 30 deletions(-)

-- 
2.17.0

Comments

Bhupesh Sharma June 15, 2018, 12:52 p.m. UTC | #1
Hi Akashi,

Thanks for the patchset - we have been waiting for quite some time for
this fix so that crashkernel can boot on arm64 machines which support
boot'ing via ACPI tables.

I have tested this on my huawei-taishan arm64 board, so:
Tested-by: Bhupesh Sharma <bhsharma@redhat.com>


BTW, if possible I would suggest to use:
Reported-by: Bhupesh Sharma <bhsharma@redhat.com>

rather than:
Reported-by: Bhupesh Sharma <bhupesh.linux@gmail.com>

Thanks,
Bhupesh


On Fri, Jun 15, 2018 at 1:26 PM, AKASHI Takahiro
<takahiro.akashi@linaro.org> wrote:
> # apologies for a bit late updates

>

> This patch series is a set of bug fixes to address kexec/kdump

> failures which are sometimes observed on ACPI-only system and reported

> in LAK-ML before.

>

> In short, the phenomena are:

> 1. kexec'ed kernel can fail to boot because some ACPI table is corrupted

>    by a new kernel (or other data) being loaded into System RAM. Currently

>    kexec may possibly allocate space ignoring such "reserved" regions.

>    We will see no messages after "Bye!"

>

> 2. crash dump (kdump) kernel can fail to boot and get into panic due to

>    an alignment fault when accessing ACPI tables. This can happen because

>    those tables are not always properly aligned while they are mapped

>    non-cacheable (ioremap'ed) as they are not recognized as part of System

>    RAM under the current implementation.

>

> After discussing several possibilities to address those issues,

> the agreed approach, in my understanding, is

> * to add resource entries for every "reserved", i.e. memblock_reserve(),

>   regions to /proc/iomem.

>   (NOMAP regions, also marked as "reserved," remains at top-level for

>   backward compatibility.)

> * For case (1), user space (kexec-tools) should rule out such regions

>   in searching for free space for loaded data.

> * For case (2), the kernel should access ACPI tables by mapping

>   them with appropriate memory attributes described in UEFI memory map.

>   (This means that it doesn't require any changes in /proc/iomem, and

>   hence user space.)

>

> Please find past discussions about /proc/iomem in [1].

>

> Patch#1 addresses kexec case, for which you are also required to update

> user space. See necessary patches in [2]. If you want to review Patch#1,

> please also take a look at and review [2].

>

> Patch#2 and #3 addresses kdump case. This is a revised version after

> Ard's comments.[3]

>

> [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-March/565980.html

> [2] https://git.linaro.org/people/takahiro.akashi/kexec-tools.git arm64/resv_mem

> [3] http://lists.infradead.org/pipermail/linux-arm-kernel/2018-April/573655.html

>

> AKASHI Takahiro (2):

>   arm64: acpi,efi: fix alignment fault in accessing ACPI tables at kdump

>   init: map UEFI memory map early if on arm or arm64

>

> James Morse (1):

>   arm64: export memblock_reserve()d regions via /proc/iomem

>

>  arch/arm64/include/asm/acpi.h      | 23 ++++++++++++------

>  arch/arm64/kernel/acpi.c           | 11 +++------

>  arch/arm64/kernel/setup.c          | 38 ++++++++++++++++++++++++++++++

>  drivers/firmware/efi/arm-runtime.c | 27 ++++++++++-----------

>  init/main.c                        |  3 +++

>  5 files changed, 72 insertions(+), 30 deletions(-)

>

> --

> 2.17.0

>
James Morse June 15, 2018, 4:29 p.m. UTC | #2
Hi Akashi,

Thanks for putting this together,

On 15/06/18 08:56, AKASHI Takahiro wrote:
> This patch series is a set of bug fixes to address kexec/kdump

> failures which are sometimes observed on ACPI-only system and reported

> in LAK-ML before.

> 

> In short, the phenomena are:

> 1. kexec'ed kernel can fail to boot because some ACPI table is corrupted

>    by a new kernel (or other data) being loaded into System RAM. Currently

>    kexec may possibly allocate space ignoring such "reserved" regions.

>    We will see no messages after "Bye!"

> 

> 2. crash dump (kdump) kernel can fail to boot and get into panic due to

>    an alignment fault when accessing ACPI tables. This can happen because

>    those tables are not always properly aligned while they are mapped

>    non-cacheable (ioremap'ed) as they are not recognized as part of System

>    RAM under the current implementation.

> 

> After discussing several possibilities to address those issues,

> the agreed approach, in my understanding, is

> * to add resource entries for every "reserved", i.e. memblock_reserve(),

>   regions to /proc/iomem.

>   (NOMAP regions, also marked as "reserved," remains at top-level for

>   backward compatibility.)


This means user-space can tell the difference between reserved-system-ram and
reserved-address-space.


> * For case (1), user space (kexec-tools) should rule out such regions

>   in searching for free space for loaded data.


... but doesn't today, because it fails to account for second-level entries.
We've always had second-level entries, so this is a user-space bug. We need both
fixed to fix the issue.

Our attempts to fix this just in the kernel reached a dead end, because Kdump
needs to include reserved-system-ram, whereas kexec has to avoid it. User-space
needs to be able to tell reserved-system-ram and reserved-address-space apart.
Hence we need to expose that information, and pick it up in user-space.

Patched-kernel and unpatch-user-space will work the same way it does today, as
the additional reserved regions are ignored by user-space.

Unpatched-kernel and patched-user-space will also work the same way it does
today as the additional reserved regions are missing.

I think this is the only way forwards on this issue...


> * For case (2), the kernel should access ACPI tables by mapping

>   them with appropriate memory attributes described in UEFI memory map.

>   (This means that it doesn't require any changes in /proc/iomem, and

>   hence user space.)


(this one is handled entirely in the kernel)


Thanks,

James
AKASHI Takahiro June 18, 2018, 5:57 a.m. UTC | #3
James,

Thank you for follow-up explanation.
I have nothing to add :)

-Takahiro AKASHI

On Fri, Jun 15, 2018 at 05:29:32PM +0100, James Morse wrote:
> Hi Akashi,

> 

> Thanks for putting this together,

> 

> On 15/06/18 08:56, AKASHI Takahiro wrote:

> > This patch series is a set of bug fixes to address kexec/kdump

> > failures which are sometimes observed on ACPI-only system and reported

> > in LAK-ML before.

> > 

> > In short, the phenomena are:

> > 1. kexec'ed kernel can fail to boot because some ACPI table is corrupted

> >    by a new kernel (or other data) being loaded into System RAM. Currently

> >    kexec may possibly allocate space ignoring such "reserved" regions.

> >    We will see no messages after "Bye!"

> > 

> > 2. crash dump (kdump) kernel can fail to boot and get into panic due to

> >    an alignment fault when accessing ACPI tables. This can happen because

> >    those tables are not always properly aligned while they are mapped

> >    non-cacheable (ioremap'ed) as they are not recognized as part of System

> >    RAM under the current implementation.

> > 

> > After discussing several possibilities to address those issues,

> > the agreed approach, in my understanding, is

> > * to add resource entries for every "reserved", i.e. memblock_reserve(),

> >   regions to /proc/iomem.

> >   (NOMAP regions, also marked as "reserved," remains at top-level for

> >   backward compatibility.)

> 

> This means user-space can tell the difference between reserved-system-ram and

> reserved-address-space.

> 

> 

> > * For case (1), user space (kexec-tools) should rule out such regions

> >   in searching for free space for loaded data.

> 

> ... but doesn't today, because it fails to account for second-level entries.

> We've always had second-level entries, so this is a user-space bug. We need both

> fixed to fix the issue.

> 

> Our attempts to fix this just in the kernel reached a dead end, because Kdump

> needs to include reserved-system-ram, whereas kexec has to avoid it. User-space

> needs to be able to tell reserved-system-ram and reserved-address-space apart.

> Hence we need to expose that information, and pick it up in user-space.

> 

> Patched-kernel and unpatch-user-space will work the same way it does today, as

> the additional reserved regions are ignored by user-space.

> 

> Unpatched-kernel and patched-user-space will also work the same way it does

> today as the additional reserved regions are missing.

> 

> I think this is the only way forwards on this issue...

> 

> 

> > * For case (2), the kernel should access ACPI tables by mapping

> >   them with appropriate memory attributes described in UEFI memory map.

> >   (This means that it doesn't require any changes in /proc/iomem, and

> >   hence user space.)

> 

> (this one is handled entirely in the kernel)

> 

> 

> Thanks,

> 

> James