From: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
To: Dennis Chen <dennis.chen-5wv7dgnIgG8@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
nd-5wv7dgnIgG8@public.gmane.org,
Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
Steve Capper <steve.capper-5wv7dgnIgG8@public.gmane.org>,
Ard Biesheuvel
<ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
"Rafael J . Wysocki"
<rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Matt Fleming
<matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/2] arm64:acpi Fix the acpi alignment exeception when 'mem=' specified
Date: Thu, 23 Jun 2016 13:42:30 +0100 [thread overview]
Message-ID: <20160623124229.GD8836@leverpostej> (raw)
In-Reply-To: <1466681415-8058-2-git-send-email-dennis.chen-5wv7dgnIgG8@public.gmane.org>
On Thu, Jun 23, 2016 at 07:30:15PM +0800, Dennis Chen wrote:
> This is a rework patch based on [1]. According to the proposal from
> Mark Rutland, when applying the system memory limit through 'mem=x'
> kernel command line, don't remove the rest memory regions above the
> limit from the memblock, instead marking them as MEMBLOCK_NOMAP region,
> which will preserve the ability to identify regions as normal memory
> while not using them for allocation and the linear map.
>
> Without this patch, the ACPI core will map those acpi data regions(if
> they are above the limit) as device type memory, which will result in
> the alignment exception when ACPI core parses the AML data stream
> since the parsing will produce some non-alignment accesses.
>
> [1]:http://lists.infradead.org/pipermail/linux-arm-kernel/2016-June/438443.html
Please rewrite the message to be standalone (i.e. so peopel can read
this without having to folow the link).
Explain why using mem= makes ACPI think regions should be mapped as
Device memory, the problems this causes for ACPICA, then cover why we
want to nomap the region.
> Signed-off-by: Dennis Chen <dennis.chen-5wv7dgnIgG8@public.gmane.org>
> Cc: Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>
> Cc: Steve Capper <steve.capper-5wv7dgnIgG8@public.gmane.org>
> Cc: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
> Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
> Cc: Rafael J. Wysocki <rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
> Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org
> Cc: linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> arch/arm64/mm/init.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index d45f862..e509e24 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -222,12 +222,14 @@ void __init arm64_memblock_init(void)
>
> /*
> * Apply the memory limit if it was set. Since the kernel may be loaded
> - * high up in memory, add back the kernel region that must be accessible
> - * via the linear mapping.
> + * in the memory regions above the limit, so we need to clear the
> + * MEMBLOCK_NOMAP flag of this region to make it can be accessible via
> + * the linear mapping.
> */
> if (memory_limit != (phys_addr_t)ULLONG_MAX) {
> - memblock_enforce_memory_limit(memory_limit);
> - memblock_add(__pa(_text), (u64)(_end - _text));
> + memblock_mem_limit_mark_nomap(memory_limit);
> + if (!memblock_is_map_memory(__pa(_text)))
> + memblock_clear_nomap(__pa(_text), (u64)(_end - _text));
I think that the memblock_is_map_memory() check should go. Just because
a page of the kernel image is mapped doesn't mean that the rest is. That
will make this a 1-1 change.
Other than that, this looks right to me.
Thanks,
Mark.
> }
>
> if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_start) {
> --
> 1.8.3.1
>
WARNING: multiple messages have this Message-ID (diff)
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] arm64:acpi Fix the acpi alignment exeception when 'mem=' specified
Date: Thu, 23 Jun 2016 13:42:30 +0100 [thread overview]
Message-ID: <20160623124229.GD8836@leverpostej> (raw)
In-Reply-To: <1466681415-8058-2-git-send-email-dennis.chen@arm.com>
On Thu, Jun 23, 2016 at 07:30:15PM +0800, Dennis Chen wrote:
> This is a rework patch based on [1]. According to the proposal from
> Mark Rutland, when applying the system memory limit through 'mem=x'
> kernel command line, don't remove the rest memory regions above the
> limit from the memblock, instead marking them as MEMBLOCK_NOMAP region,
> which will preserve the ability to identify regions as normal memory
> while not using them for allocation and the linear map.
>
> Without this patch, the ACPI core will map those acpi data regions(if
> they are above the limit) as device type memory, which will result in
> the alignment exception when ACPI core parses the AML data stream
> since the parsing will produce some non-alignment accesses.
>
> [1]:http://lists.infradead.org/pipermail/linux-arm-kernel/2016-June/438443.html
Please rewrite the message to be standalone (i.e. so peopel can read
this without having to folow the link).
Explain why using mem= makes ACPI think regions should be mapped as
Device memory, the problems this causes for ACPICA, then cover why we
want to nomap the region.
> Signed-off-by: Dennis Chen <dennis.chen@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Steve Capper <steve.capper@arm.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Cc: linux-mm at kvack.org
> Cc: linux-acpi at vger.kernel.org
> Cc: linux-efi at vger.kernel.org
> ---
> arch/arm64/mm/init.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index d45f862..e509e24 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -222,12 +222,14 @@ void __init arm64_memblock_init(void)
>
> /*
> * Apply the memory limit if it was set. Since the kernel may be loaded
> - * high up in memory, add back the kernel region that must be accessible
> - * via the linear mapping.
> + * in the memory regions above the limit, so we need to clear the
> + * MEMBLOCK_NOMAP flag of this region to make it can be accessible via
> + * the linear mapping.
> */
> if (memory_limit != (phys_addr_t)ULLONG_MAX) {
> - memblock_enforce_memory_limit(memory_limit);
> - memblock_add(__pa(_text), (u64)(_end - _text));
> + memblock_mem_limit_mark_nomap(memory_limit);
> + if (!memblock_is_map_memory(__pa(_text)))
> + memblock_clear_nomap(__pa(_text), (u64)(_end - _text));
I think that the memblock_is_map_memory() check should go. Just because
a page of the kernel image is mapped doesn't mean that the rest is. That
will make this a 1-1 change.
Other than that, this looks right to me.
Thanks,
Mark.
> }
>
> if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_start) {
> --
> 1.8.3.1
>
WARNING: multiple messages have this Message-ID (diff)
From: Mark Rutland <mark.rutland@arm.com>
To: Dennis Chen <dennis.chen@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, nd@arm.com,
Catalin Marinas <catalin.marinas@arm.com>,
Steve Capper <steve.capper@arm.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Will Deacon <will.deacon@arm.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Matt Fleming <matt@codeblueprint.co.uk>,
linux-mm@kvack.org, linux-acpi@vger.kernel.org,
linux-efi@vger.kernel.org
Subject: Re: [PATCH 2/2] arm64:acpi Fix the acpi alignment exeception when 'mem=' specified
Date: Thu, 23 Jun 2016 13:42:30 +0100 [thread overview]
Message-ID: <20160623124229.GD8836@leverpostej> (raw)
In-Reply-To: <1466681415-8058-2-git-send-email-dennis.chen@arm.com>
On Thu, Jun 23, 2016 at 07:30:15PM +0800, Dennis Chen wrote:
> This is a rework patch based on [1]. According to the proposal from
> Mark Rutland, when applying the system memory limit through 'mem=x'
> kernel command line, don't remove the rest memory regions above the
> limit from the memblock, instead marking them as MEMBLOCK_NOMAP region,
> which will preserve the ability to identify regions as normal memory
> while not using them for allocation and the linear map.
>
> Without this patch, the ACPI core will map those acpi data regions(if
> they are above the limit) as device type memory, which will result in
> the alignment exception when ACPI core parses the AML data stream
> since the parsing will produce some non-alignment accesses.
>
> [1]:http://lists.infradead.org/pipermail/linux-arm-kernel/2016-June/438443.html
Please rewrite the message to be standalone (i.e. so peopel can read
this without having to folow the link).
Explain why using mem= makes ACPI think regions should be mapped as
Device memory, the problems this causes for ACPICA, then cover why we
want to nomap the region.
> Signed-off-by: Dennis Chen <dennis.chen@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Steve Capper <steve.capper@arm.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Cc: linux-mm@kvack.org
> Cc: linux-acpi@vger.kernel.org
> Cc: linux-efi@vger.kernel.org
> ---
> arch/arm64/mm/init.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index d45f862..e509e24 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -222,12 +222,14 @@ void __init arm64_memblock_init(void)
>
> /*
> * Apply the memory limit if it was set. Since the kernel may be loaded
> - * high up in memory, add back the kernel region that must be accessible
> - * via the linear mapping.
> + * in the memory regions above the limit, so we need to clear the
> + * MEMBLOCK_NOMAP flag of this region to make it can be accessible via
> + * the linear mapping.
> */
> if (memory_limit != (phys_addr_t)ULLONG_MAX) {
> - memblock_enforce_memory_limit(memory_limit);
> - memblock_add(__pa(_text), (u64)(_end - _text));
> + memblock_mem_limit_mark_nomap(memory_limit);
> + if (!memblock_is_map_memory(__pa(_text)))
> + memblock_clear_nomap(__pa(_text), (u64)(_end - _text));
I think that the memblock_is_map_memory() check should go. Just because
a page of the kernel image is mapped doesn't mean that the rest is. That
will make this a 1-1 change.
Other than that, this looks right to me.
Thanks,
Mark.
> }
>
> if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_start) {
> --
> 1.8.3.1
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-06-23 12:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 11:30 [PATCH 1/2] mm: memblock Add some new functions to address the mem limit issue Dennis Chen
2016-06-23 11:30 ` Dennis Chen
2016-06-23 11:30 ` [PATCH 2/2] arm64:acpi Fix the acpi alignment exeception when 'mem=' specified Dennis Chen
2016-06-23 11:30 ` Dennis Chen
[not found] ` <1466681415-8058-2-git-send-email-dennis.chen-5wv7dgnIgG8@public.gmane.org>
2016-06-23 12:42 ` Mark Rutland [this message]
2016-06-23 12:42 ` Mark Rutland
2016-06-23 12:42 ` Mark Rutland
2016-06-24 2:31 ` Dennis Chen
2016-06-24 2:31 ` Dennis Chen
2016-06-24 2:31 ` Dennis Chen
[not found] ` <1466681415-8058-1-git-send-email-dennis.chen-5wv7dgnIgG8@public.gmane.org>
2016-06-23 12:57 ` [PATCH 1/2] mm: memblock Add some new functions to address the mem limit issue Mark Rutland
2016-06-23 12:57 ` Mark Rutland
2016-06-23 12:57 ` Mark Rutland
2016-06-24 2:28 ` Dennis Chen
2016-06-24 2:28 ` Dennis Chen
2016-06-24 2:28 ` Dennis Chen
2016-06-23 15:26 ` kbuild test robot
2016-06-23 15:26 ` kbuild test robot
2016-06-23 15:26 ` kbuild test robot
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=20160623124229.GD8836@leverpostej \
--to=mark.rutland-5wv7dgnigg8@public.gmane.org \
--cc=ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
--cc=dennis.chen-5wv7dgnIgG8@public.gmane.org \
--cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org \
--cc=nd-5wv7dgnIgG8@public.gmane.org \
--cc=rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=steve.capper-5wv7dgnIgG8@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.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 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.