Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp992440pxb; Wed, 6 Apr 2022 06:13:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2qMOfLWQP+V6uBKUFsSgf0XoUfGmom2O5Te6KwKGKmgHbk5408wFtvujzdh7+4QdcjGlA X-Received: by 2002:a63:195f:0:b0:399:1f0e:a21d with SMTP id 31-20020a63195f000000b003991f0ea21dmr6952137pgz.393.1649250794576; Wed, 06 Apr 2022 06:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649250794; cv=none; d=google.com; s=arc-20160816; b=o82y5UGfupkejvlHq6mxWHVC/SmCNCx/hcD2l+J9C0o96myDG1M0wLGsBj6sv9C9D/ ynp8OJrCHdXJGFImIk/zs3Dh7qE6QGkT8pBxUPOx8WRbhwz7SXxfFCJrSoS3oBKTRE4X xf0PviGLo5ZHZ9seIr8SCiz0aW+XQNHXSDNro40ITIoQIxvA5MlIbgU2BAl5Zk7lM0BX LhP7CJGFWucUBUoWbZJo6PYwA2D21A4SI2QNL7JwKhQXL8oMmVij3FS/VzWi245soSKR 27Jq+4VV/2GPE3WqEqIXRoIB3G1wqGlYQ+zZr64OKHnBSIyy3uJwvSj+4P9lRUJ0jwE1 bJPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lcuoiOP5EJv9cxG+tQmt7VNSP7XEvnlmSkum++zAka8=; b=EjDj4aC8LSY6n7ayPoQOeYk488vJAc4JPqPOTmnAnTNKLAleUBJgRBwsYCBkiAFxHc EGDJ6oMRkJ68xHLv5HZqPNbhw9hndQ8mn3sGor0if6GciWvX1pF0zmw6LJ4eqrqOBSb6 GNXYNfBTu5uuKXmrZ58HxMjatsJsfEh8QPeLIWbtvlJ66JMTe0y2IuooyZ1kPXdIFS1P a5mBBrADhRCyTFGisPKfel2W0dSQc7Qd8ZomQXVL0wV9K6xhvtWiieUEV65+RqBMnubX aMXn/JWtwmiwA7H+dYkWswM1Nq4kSkNh+3Nbj8SufoW6FXgDjQa3O5fWT/6gnc9VJDza rwpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HpW8q0Na; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q2-20020a056a00084200b004faa67abb7fsi15252439pfk.46.2022.04.06.06.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:13:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HpW8q0Na; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB2A24F997D; Wed, 6 Apr 2022 03:41:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448009AbiDEUJm (ORCPT + 99 others); Tue, 5 Apr 2022 16:09:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351878AbiDEKD2 (ORCPT ); Tue, 5 Apr 2022 06:03:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 423AF90FE4; Tue, 5 Apr 2022 02:52:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34412B81BAE; Tue, 5 Apr 2022 09:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89FC2C385A1; Tue, 5 Apr 2022 09:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152342; bh=xm9x/FZCEUK/x/FQ/b38Amq5e9rRH5/BKJxWdvbog6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HpW8q0NakENo6VPBU4lYGa61UblongfTdWnDll/k/M4KxIsolxDFlNwSw19MACYX7 a9kql096w08UCcK9Db5FN/STqerwHqLTlDf3BGzOIocgwzeuGgSx8nTrq63CU/0hxj eiEWkZMyVf7YYPu18o5ApnDAdE/zpqc8xhufXLjo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Darren Hart , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 704/913] ACPI/APEI: Limit printable size of BERT table data Date: Tue, 5 Apr 2022 09:29:26 +0200 Message-Id: <20220405070400.937974988@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Darren Hart [ Upstream commit 3f8dec116210ca649163574ed5f8df1e3b837d07 ] Platforms with large BERT table data can trigger soft lockup errors while attempting to print the entire BERT table data to the console at boot: watchdog: BUG: soft lockup - CPU#160 stuck for 23s! [swapper/0:1] Observed on Ampere Altra systems with a single BERT record of ~250KB. The original bert driver appears to have assumed relatively small table data. Since it is impractical to reassemble large table data from interwoven console messages, and the table data is available in /sys/firmware/acpi/tables/data/BERT limit the size for tables printed to the console to 1024 (for no reason other than it seemed like a good place to kick off the discussion, would appreciate feedback from existing users in terms of what size would maintain their current usage model). Alternatively, we could make printing a CONFIG option, use the bert_disable boot arg (or something similar), or use a debug log level. However, all those solutions require extra steps or change the existing behavior for small table data. Limiting the size preserves existing behavior on existing platforms with small table data, and eliminates the soft lockups for platforms with large table data, while still making it available. Signed-off-by: Darren Hart Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/apei/bert.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/apei/bert.c b/drivers/acpi/apei/bert.c index 86211422f4ee..598fd19b65fa 100644 --- a/drivers/acpi/apei/bert.c +++ b/drivers/acpi/apei/bert.c @@ -29,6 +29,7 @@ #undef pr_fmt #define pr_fmt(fmt) "BERT: " fmt +#define ACPI_BERT_PRINT_MAX_LEN 1024 static int bert_disable; @@ -58,8 +59,11 @@ static void __init bert_print_all(struct acpi_bert_region *region, } pr_info_once("Error records from previous boot:\n"); - - cper_estatus_print(KERN_INFO HW_ERR, estatus); + if (region_len < ACPI_BERT_PRINT_MAX_LEN) + cper_estatus_print(KERN_INFO HW_ERR, estatus); + else + pr_info_once("Max print length exceeded, table data is available at:\n" + "/sys/firmware/acpi/tables/data/BERT"); /* * Because the boot error source is "one-time polled" type, -- 2.34.1