From patchwork Tue Jul 10 11:25:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 10516855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3F9DA6032A for ; Tue, 10 Jul 2018 11:27:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C88028CE3 for ; Tue, 10 Jul 2018 11:27:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2059D28D38; Tue, 10 Jul 2018 11:27:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B7E8128CE3 for ; Tue, 10 Jul 2018 11:27:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PicNH3KvEwofvRegodyre/kEQFrsap2JU1o+iZ0EzLg=; b=tazeUnKksDXvvR pgpnDyvIjFnOln7x4OZtpFfOboOMyxBh8IGReUezIQyAqbxX0sq+rf7xQQ7KzEvEyc9+0i+88FhJ6 ihDeiUPLxSp4zAAQWFO6K29KD68IlMBX1uGFH8jtAPEna3k7MK1e3BuRyamVwU2EDgFQL5xnQAAdw U1YEElrRITQVzB1rLST7e9otXluhQn+84QtV9ITVNWXDwNjMkUzY99lI/rRqbvvs7Q/HSsfaec0nL Hal8dSxRmocwsgqpjkan/63+Ot/3UCVw8fvwnUFyrhu/b1WJcl4VLo5Ar3EGHhtGAXr3xbVH4IO4b D6+Ruxf4IKJVKv8Cc5rA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcqo3-0004Bw-VW; Tue, 10 Jul 2018 11:27:43 +0000 Received: from cloudserver094114.home.pl ([79.96.170.134]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fcqo0-0004A4-GY for linux-arm-kernel@lists.infradead.org; Tue, 10 Jul 2018 11:27:42 +0000 Received: from 79.184.255.246.ipv4.supernova.orange.pl (79.184.255.246) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83) id 3d13353b17e17877; Tue, 10 Jul 2018 13:27:28 +0200 From: "Rafael J. Wysocki" To: Jeremy Linton Subject: Re: 4.18rc3 TX2 boot failure with "ACPICA: AML parser: attempt to continue loading table after error" Date: Tue, 10 Jul 2018 13:25:58 +0200 Message-ID: <2264016.O8iB3BUh2s@aspire.rjw.lan> In-Reply-To: <3574827.zOC4apc8e1@aspire.rjw.lan> References: <218e4339-477d-eb0d-6007-764c8e24229f@arm.com> <3574827.zOC4apc8e1@aspire.rjw.lan> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180710_042740_712529_F56C114D X-CRM114-Status: GOOD ( 32.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-acpi@vger.kernel.org" , Lorenzo Pieralisi , "Schmauss, Erik" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Tuesday, July 10, 2018 1:13:17 PM CEST Rafael J. Wysocki wrote: > On Tuesday, July 10, 2018 5:44:05 AM CEST Jeremy Linton wrote: > > Hi, > > > > On 07/09/2018 04:28 PM, Rafael J. Wysocki wrote: > > > On Mon, Jul 9, 2018 at 10:45 PM, Jeremy Linton wrote: > > >> Hi, > > >> > > >> First thanks for the patch.. > > >> > > >> On 07/08/2018 04:14 AM, Rafael J. Wysocki wrote: > > >>> > > >>> On Monday, July 2, 2018 11:41:42 PM CEST Jeremy Linton wrote: > > >>>> > > >>>> Hi, > > >>>> > > >>>> I'm experiencing two problems with commit 5088814a6e931 which is > > >>>> "ACPICA: AML parser: attempt to continue loading table after error" > > >>>> > > >>>> The first is this boot failure on a thunderX2: > > >>>> > > >>>> [ 10.770098] ACPI Error: Ignore error and continue table load > > >> > > >> > > >> [trimming] > > >> > > >>>> ]--- > > >>>> > > >>>> Which does appear to be the result of some bad data in the table, but it > > >>>> was working with 4.17, and reverting this commit solves the problem. > > >>> > > >>> > > >>> Does the patch below make any difference? > > >>> > > >>> --- > > >>> drivers/acpi/acpica/psobject.c | 3 +++ > > >>> 1 file changed, 3 insertions(+) > > >>> > > >>> Index: linux-pm/drivers/acpi/acpica/psobject.c > > >>> =================================================================== > > >>> --- linux-pm.orig/drivers/acpi/acpica/psobject.c > > >>> +++ linux-pm/drivers/acpi/acpica/psobject.c > > >>> @@ -39,6 +39,9 @@ static acpi_status acpi_ps_get_aml_opcod > > >>> ACPI_FUNCTION_TRACE_PTR(ps_get_aml_opcode, walk_state); > > >>> walk_state->aml = walk_state->parser_state.aml; > > >>> + if (!walk_state->aml) > > >>> + return AE_CTRL_PARSE_CONTINUE; > > >>> + > > >> > > >> > > >> Well this seems to avoid the crash, but now it hangs right after on the > > >> "Ignore error and continue table load" message. > > > > > > Well, maybe we should just abort in that case. > > > > > > I'm wondering what happens if you replace the return statement in the > > > patch above with > > > > > > return_ACPI_STATUS(AE_AML_BAD_OPCODE) > > > > Yes, that is where I went when I applied the patch but I used > > AE_CTRL_TERMINATE, which terminates the loop in acpi_ps_parse_loop() and > > that appears to successfully finish/terminate the initial parsing pass. > > But, it then crashes in acpi_ns_lookup called via the > > acpi_walk_resources sequences that goes through ut_evalute_object() due > > to the path/scope_info->scope.node being ACPI_ROOT_OBJECT (-1) and > > bypassing the null check. Adding a ACPI_ROOT_OBJECT check as well as the > > null checks in acpi_ns_lookup results in a successful boot. Tracking > > down how the terminate (or whatever) is leaving the info->prefix_node > > (in acpi_ns_evaluate) set to ROOT_OBJECT instead of null, is something I > > don't yet understand. > > > > Anyway, I tried Using BAD_OPCODE rather than TERMINATE and it seems to > > have the same basic result as PARSE_CONTINUE. > > OK, thanks! > > I evidently didn't look deep enough. > > Can you please check the patch below? > > I'm not sure if we can pass this broken state to > acpi_ps_complete_final_op(), so it may be necessary to return > an error directly when aml_op_start is NULL. > > --- > drivers/acpi/acpica/psloop.c | 3 +++ > 1 file changed, 3 insertions(+) > > Index: linux-pm/drivers/acpi/acpica/psloop.c > =================================================================== > --- linux-pm.orig/drivers/acpi/acpica/psloop.c > +++ linux-pm/drivers/acpi/acpica/psloop.c > @@ -493,6 +493,9 @@ acpi_status acpi_ps_parse_loop(struct ac > ASL_CV_CAPTURE_COMMENTS(walk_state); > > aml_op_start = parser_state->aml; > + if (!aml_op_start) > + break; > + > if (!op) { > status = > acpi_ps_create_op(walk_state, aml_op_start, &op); > > -- So maybe something like this: --- drivers/acpi/acpica/psloop.c | 3 +++ 1 file changed, 3 insertions(+) Index: linux-pm/drivers/acpi/acpica/psloop.c =================================================================== --- linux-pm.orig/drivers/acpi/acpica/psloop.c +++ linux-pm/drivers/acpi/acpica/psloop.c @@ -494,6 +494,9 @@ acpi_status acpi_ps_parse_loop(struct ac aml_op_start = parser_state->aml; if (!op) { + if (!aml_op_start) + return_ACPI_STATUS(AE_AML_INTERNAL); + status = acpi_ps_create_op(walk_state, aml_op_start, &op); if (ACPI_FAILURE(status)) {