From patchwork Fri Oct 14 06:01:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 682134 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3swH7R6RYLz9s3T for ; Fri, 14 Oct 2016 17:02:27 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3swH7R5j5tzDt48 for ; Fri, 14 Oct 2016 17:02:27 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3swH6h5c6hzDt2c for ; Fri, 14 Oct 2016 17:01:48 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9E61W0F099848 for ; Fri, 14 Oct 2016 02:01:46 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 262rva2d1q-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 14 Oct 2016 02:01:46 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Oct 2016 00:01:45 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 14 Oct 2016 00:01:44 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 396C11FF0029 for ; Fri, 14 Oct 2016 00:01:24 -0600 (MDT) Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9E61hEd10092810; Thu, 13 Oct 2016 23:01:43 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 869DC78047; Fri, 14 Oct 2016 00:01:43 -0600 (MDT) Received: from birb.localdomain (unknown [9.81.213.224]) by b03ledav004.gho.boulder.ibm.com (Postfix) with SMTP id D6AC978041; Fri, 14 Oct 2016 00:01:42 -0600 (MDT) Received: from ka1.ozlabs.ibm.com (localhost.localdomain [127.0.0.1]) by birb.localdomain (Postfix) with ESMTP id 8937B228D8EA; Fri, 14 Oct 2016 17:01:38 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Fri, 14 Oct 2016 17:01:33 +1100 X-Mailer: git-send-email 2.1.4 In-Reply-To: <1476424893-7292-1-git-send-email-stewart@linux.vnet.ibm.com> References: <1476424893-7292-1-git-send-email-stewart@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101406-0008-0000-0000-000005D05EFF X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005908; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000186; SDB=6.00768164; UDB=6.00367652; IPR=6.00544304; BA=6.00004807; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012985; XFM=3.00000011; UTC=2016-10-14 06:01:45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101406-0009-0000-0000-00003C21A52C Message-Id: <1476424893-7292-6-git-send-email-stewart@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-14_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610140105 Subject: [Skiboot] [PATCH 5/5] fast-reset: free fdt on fast reset, count fast reboots X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- core/fast-reboot.c | 6 +++++- core/init.c | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) 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)