All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Stafford Horne <shorne@gmail.com>,
	Mike Rapoport <rppt@linux.ibm.com>,
	Jonas Bonn <jonas@southpole.se>,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	Mike Rapoport <rppt@kernel.org>,
	Arvind Sankar <nivedita@alum.mit.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	openrisc@lists.librecores.org
Subject: [PATCH v3 1/3] openrisc: Reserve memblock for initrd
Date: Fri, 11 Sep 2020 08:39:38 +0900	[thread overview]
Message-ID: <20200910233940.2132107-2-shorne@gmail.com> (raw)
In-Reply-To: <20200910233940.2132107-1-shorne@gmail.com>

Recently OpenRISC added support for external initrd images, but I found
some instability when using larger buildroot initrd images. It turned
out that I forgot to reserve the memblock space for the initrd image.

This patch fixes the instability issue by reserving memblock space.

Fixes: ff6c923dbec3 ("openrisc: Add support for external initrd images")
Signed-off-by: Stafford Horne <shorne@gmail.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
---
Changes since v2:
 - None

Changes since v1:
 - Updated to use separate variables as suggested by Mike.

 arch/openrisc/kernel/setup.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index b18e775f8be3..13c87f1f872b 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -80,6 +80,16 @@ static void __init setup_memory(void)
 	 */
 	memblock_reserve(__pa(_stext), _end - _stext);
 
+#ifdef CONFIG_BLK_DEV_INITRD
+	/* Then reserve the initrd, if any */
+	if (initrd_start && (initrd_end > initrd_start)) {
+		unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE);
+		unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE);
+
+		memblock_reserve(__pa(aligned_start), aligned_end - aligned_start);
+	}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
 	early_init_fdt_reserve_self();
 	early_init_fdt_scan_reserved_mem();
 
-- 
2.26.2


WARNING: multiple messages have this Message-ID (diff)
From: Stafford Horne <shorne@gmail.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v3 1/3] openrisc: Reserve memblock for initrd
Date: Fri, 11 Sep 2020 08:39:38 +0900	[thread overview]
Message-ID: <20200910233940.2132107-2-shorne@gmail.com> (raw)
In-Reply-To: <20200910233940.2132107-1-shorne@gmail.com>

Recently OpenRISC added support for external initrd images, but I found
some instability when using larger buildroot initrd images. It turned
out that I forgot to reserve the memblock space for the initrd image.

This patch fixes the instability issue by reserving memblock space.

Fixes: ff6c923dbec3 ("openrisc: Add support for external initrd images")
Signed-off-by: Stafford Horne <shorne@gmail.com>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
---
Changes since v2:
 - None

Changes since v1:
 - Updated to use separate variables as suggested by Mike.

 arch/openrisc/kernel/setup.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index b18e775f8be3..13c87f1f872b 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -80,6 +80,16 @@ static void __init setup_memory(void)
 	 */
 	memblock_reserve(__pa(_stext), _end - _stext);
 
+#ifdef CONFIG_BLK_DEV_INITRD
+	/* Then reserve the initrd, if any */
+	if (initrd_start && (initrd_end > initrd_start)) {
+		unsigned long aligned_start = ALIGN_DOWN(initrd_start, PAGE_SIZE);
+		unsigned long aligned_end = ALIGN(initrd_end, PAGE_SIZE);
+
+		memblock_reserve(__pa(aligned_start), aligned_end - aligned_start);
+	}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
 	early_init_fdt_reserve_self();
 	early_init_fdt_scan_reserved_mem();
 
-- 
2.26.2


  reply	other threads:[~2020-09-10 23:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 23:39 [PATCH v3 0/3] OpenRISC fixes for 5.9-rc4 Stafford Horne
2020-09-10 23:39 ` Stafford Horne [this message]
2020-09-10 23:39   ` [OpenRISC] [PATCH v3 1/3] openrisc: Reserve memblock for initrd Stafford Horne
2020-09-10 23:39 ` [PATCH v3 2/3] openrisc: Fix cache API compile issue when not inlining Stafford Horne
2020-09-10 23:39   ` [OpenRISC] " Stafford Horne
2020-09-10 23:39 ` [PATCH v3 3/3] openrisc: Fix issue with get_user for 64-bit values Stafford Horne
2020-09-10 23:39   ` [OpenRISC] " Stafford Horne
2020-09-10 23:39   ` Stafford Horne
2020-09-11 20:55   ` Luc Van Oostenryck
2020-09-11 20:55     ` [OpenRISC] " Luc Van Oostenryck
2020-09-11 20:55     ` Luc Van Oostenryck
2020-09-12  8:40     ` Stafford Horne
2020-09-12  8:40       ` [OpenRISC] " Stafford Horne
2020-09-12  8:40       ` Stafford Horne

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=20200910233940.2132107-2-shorne@gmail.com \
    --to=shorne@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonas@southpole.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nivedita@alum.mit.edu \
    --cc=openrisc@lists.librecores.org \
    --cc=rppt@kernel.org \
    --cc=rppt@linux.ibm.com \
    --cc=stefan.kristiansson@saunalahti.fi \
    /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.