From patchwork Fri Jun 25 06:19:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1496928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=jkTptDo3; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GB6M94Zdlz9sXb for ; Fri, 25 Jun 2021 16:20:53 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GB6MB2P35z3bwk for ; Fri, 25 Jun 2021 16:20:54 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=jkTptDo3; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=jkTptDo3; dkim-atps=neutral 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 4GB6Lh5GZFz3bvc for ; Fri, 25 Jun 2021 16:20:28 +1000 (AEST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15P63drG185864 for ; Fri, 25 Jun 2021 02:20:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=wHfLT3EGPu65heCEzji8/qAsJGGj3q4vryMd88Qp6Hs=; b=jkTptDo3XuJDl10HsNbJ+E+nFhrx3czyiHqo4m0H/sPdwBMlX2Mzzz5Nqv734ilE4CtC XMvKP8J+yYB2b8c8cRugS8/hTkuz98Zo5Fc+fDCgUPONHkYcxsGUEO2blbny1/TJv0A3 kXXj+Zw2Ol9vnbVSLb6HZXczsAPHoEqKAwV6ctp7BbiQyTAe/frEVhvEDyiezais7pK1 WpvIgbimX7fMwYOy8Ks7yy8fyyts+JpyHb4CCrOtobvlH6w8Y97ruwoxPpfZVEQvrJpn 0fuMEfs+w53ZPcNlgP6Fi7G+YDz9MuA6t96gWRcqKQMAPualggjD2xSWAJo5aKF+RoJK 6g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39d8jnt2bk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 25 Jun 2021 02:20:25 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15P65u0K194817 for ; Fri, 25 Jun 2021 02:20:25 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 39d8jnt2aj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Jun 2021 02:20:25 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15P66YDQ001317; Fri, 25 Jun 2021 06:20:22 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04fra.de.ibm.com with ESMTP id 399878skeu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Jun 2021 06:20:22 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15P6KKff32178540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Jun 2021 06:20:20 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2134542041; Fri, 25 Jun 2021 06:20:20 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9042D4203F; Fri, 25 Jun 2021 06:20:18 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.46.25]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 25 Jun 2021 06:20:18 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 25 Jun 2021 11:49:22 +0530 Message-Id: <20210625061937.47314-8-hegdevasant@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210625061937.47314-1-hegdevasant@linux.vnet.ibm.com> References: <20210625061937.47314-1-hegdevasant@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Zg-XDobwUB-S_jI2bSPRk1EagXzcOdoj X-Proofpoint-GUID: 8Itsw_rEWjo2lu81OO6Wvtpm6QfP0Vfw X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-06-25_02:2021-06-24, 2021-06-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106250034 Subject: [Skiboot] [PATCH 07/22] trace: Add nvram hack to use the old trace export behaviour X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Oliver O'Halloran Previously we put all the trace buffer exports in the exports/ node. However, there's one trace buffer for each core so I moved them into a subdirectory since they were crowding up the place. Most kernels don't support recursively exporting subnodes though so kernel's don't have support for recursively exporting subnodes, so add a hack to restore the old behaviour for now. Signed-off-by: Oliver O'Halloran [Fixed run-trace test case - Vasant] Signed-off-by: Vasant Hegde --- core/init.c | 3 +++ core/test/run-trace.c | 5 +++++ core/trace.c | 17 ++++++++++------- include/trace.h | 1 + 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/core/init.c b/core/init.c index d5ba67edd..09749f475 100644 --- a/core/init.c +++ b/core/init.c @@ -1369,6 +1369,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt) /* Disable protected execution facility in BML */ cpu_disable_pef(); + /* export the trace buffers */ + trace_add_dt_props(); + /* Now release parts of memory nodes we haven't used ourselves... */ mem_region_release_unused(); diff --git a/core/test/run-trace.c b/core/test/run-trace.c index b26827643..88b090358 100644 --- a/core/test/run-trace.c +++ b/core/test/run-trace.c @@ -102,6 +102,11 @@ struct debug_descriptor debug_descriptor = { .trace_mask = -1 }; +const char *nvram_query_safe(const char *key __unused) +{ + return NULL; +} + void lock_caller(struct lock *l, const char *caller) { (void)caller; diff --git a/core/trace.c b/core/trace.c index 5a3ad4921..561bd79e0 100644 --- a/core/trace.c +++ b/core/trace.c @@ -18,6 +18,7 @@ #include #include #include +#include #define DEBUG_TRACES @@ -155,7 +156,7 @@ void trace_add(union trace *trace, u8 type, u16 len) unlock(&ti->lock); } -static void trace_add_dt_props(void) +void trace_add_dt_props(void) { uint64_t boot_buf_phys = (uint64_t) &boot_tracebuf.trace_info; struct dt_node *exports, *traces; @@ -168,9 +169,14 @@ static void trace_add_dt_props(void) if (!exports) return; - traces = dt_new(exports, "traces"); - if (!exports) - return; + /* + * nvram hack to put all the trace buffer exports in the exports + * node. This is useful if the kernel doesn't also export subnodes. + */ + if (nvram_query_safe("flat-trace-buf")) + traces = exports; + else + traces = dt_new(exports, "traces"); prop = malloc(sizeof(u64) * 2 * be32_to_cpu(debug_descriptor.num_traces)); @@ -256,7 +262,4 @@ void init_trace_buffers(void) continue; t->trace = t->primary->trace; } - - /* Trace node in DT. */ - trace_add_dt_props(); } diff --git a/include/trace.h b/include/trace.h index 04c8440b9..1b1be249c 100644 --- a/include/trace.h +++ b/include/trace.h @@ -25,6 +25,7 @@ struct trace_info { /* Allocate trace buffers once we know memory topology */ void init_trace_buffers(void); +void trace_add_dt_props(void); /* This will fill in timestamp and cpu; you must do type and len. */ void trace_add(union trace *trace, u8 type, u16 len);