diff mbox

[5/5] fast-reset: free fdt on fast reset, count fast reboots

Message ID 1476424893-7292-6-git-send-email-stewart@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Stewart Smith Oct. 14, 2016, 6:01 a.m. UTC
A bit of a hack to free the flattened device tree on fast reset.
This means we don't leak ~500kb memory every fast reset.

We also count the number of fast resets we've done (if enabled),
which means that for stress testing, we have a hope of finding out
how many we managed to do before we hit a problem.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 core/fast-reboot.c | 6 +++++-
 core/init.c        | 3 ++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Comments

Andrew Donnellan Oct. 14, 2016, 6:06 a.m. UTC | #1
On 14/10/16 17:01, Stewart Smith wrote:
> A bit of a hack to free the flattened device tree on fast reset.
> This means we don't leak ~500kb memory every fast reset.

Are we calling it "fast reset" or "fast reboot"?
Joel Stanley Oct. 14, 2016, 7:55 a.m. UTC | #2
On Fri, Oct 14, 2016 at 4:36 PM, Andrew Donnellan
<andrew.donnellan@au1.ibm.com> wrote:
> On 14/10/16 17:01, Stewart Smith wrote:
>>
>> A bit of a hack to free the flattened device tree on fast reset.
>> This means we don't leak ~500kb memory every fast reset.
>
> Are we calling it "fast reset" or "fast reboot"?

Fast bikeshed
Stewart Smith Oct. 16, 2016, 11:45 p.m. UTC | #3
Joel Stanley <joel@jms.id.au> writes:
> On Fri, Oct 14, 2016 at 4:36 PM, Andrew Donnellan
> <andrew.donnellan@au1.ibm.com> wrote:
>> On 14/10/16 17:01, Stewart Smith wrote:
>>>
>>> A bit of a hack to free the flattened device tree on fast reset.
>>> This means we don't leak ~500kb memory every fast reset.
>>
>> Are we calling it "fast reset" or "fast reboot"?
>
> Fast bikeshed

That's about as good name as any.

But we should probably be consistent at some point. I vote we go with
whatever the OPAL call is named.
diff mbox

Patch

diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index cf8b3d481021..37744b8903f1 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -278,9 +278,12 @@  static bool fast_reset_p8(void)
 	return true;
 }
 
+extern void *fdt;
+
 void fast_reboot(void)
 {
 	bool success;
+	static int fast_reboot_count = 0;
 
 	if (proc_gen != proc_gen_p8) {
 		prlog(PR_DEBUG,
@@ -293,7 +296,8 @@  void fast_reboot(void)
 		return;
 	}
 
-	prlog(PR_INFO, "RESET: Initiating fast reboot...\n");
+	prlog(PR_NOTICE, "RESET: Initiating fast reboot %d...\n", ++fast_reboot_count);
+	free(fdt);
 
 	/* XXX We need a way to ensure that no other CPU is in skiboot
 	 * holding locks (via the OPAL APIs) and if they are, we need
diff --git a/core/init.c b/core/init.c
index bc14da7e789f..790db147aa09 100644
--- a/core/init.c
+++ b/core/init.c
@@ -453,12 +453,13 @@  static void load_initramfs(void)
 
 int64_t mem_dump_free(void);
 
+void *fdt;
+
 void __noreturn load_and_boot_kernel(bool is_reboot)
 {
 	const struct dt_property *memprop;
 	const char *cmdline;
 	uint64_t mem_top;
-	void *fdt;
 
 	memprop = dt_find_property(dt_root, DT_PRIVATE "maxmem");
 	if (memprop)