Message ID | 20230412224620.8909-2-tanure@linux.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp655581vqo; Wed, 12 Apr 2023 16:07:47 -0700 (PDT) X-Google-Smtp-Source: AKy350amqgfzSRpx0WRpLdrWPzxUYIbPUJYGELXMLqDilR07LqaZvV08Rm+N24+T1yBjAndLm9pf X-Received: by 2002:a17:907:20b2:b0:94e:6b12:caab with SMTP id pw18-20020a17090720b200b0094e6b12caabmr425979ejb.51.1681340867373; Wed, 12 Apr 2023 16:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681340867; cv=none; d=google.com; s=arc-20160816; b=bE04Fltn/WC39Wnulxctf8S9ystpKzioUkrLx1KLz4dVxzx0Ey2/sbYJlvblIWEX+U 8HKhYpn/QATkKL6dLmyyZN0pVkxpawR1PVZN2Ph1PrSsIDdXc+qIfpBIzf046TMIAxb1 M9rTx1MxYdOy1us9+tQylnEzIZA9/UycCy0xDY8M4LQ+BF3jqKkQi21tPBWHpVIG7YTv 538+wLtWBA4v3YDlPHe5QbYnOqPH01OxXfOH5L5wGDOrDhfuQ07FUAUt8VGsqSMJ/juN QCwPUH+P2b0RNXudFBIRLRT/tpmzFqwqv/EDbHG3B4d7VZd7yRUnF3e4a7bOqfLEE4Ao 6/Yg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=n6IQmhNHxPjInxSQpSIu3wq6BYWmrEpb2ujMy7CJmmE=; b=Vy5WpzFNczm1aqj41vpnHXv7YQEGAgEnzVfiGIcFZyw5CyYbaR1/xs+31HJIm6hJX7 GA6jsDIkfsU5aN3uzRJhoYecTAWWZgTfCFCrQz8TA2DqgBXkNWGgGT1Kav/JJjKvoL50 gLHu5ByY502PUg43hyLfT8P8h1RUgER2leB9AAHphbTWHnTMpdW9gt8F4mtH8/1SGVjW KdSXonACJ4HZ5/W/9k2x8VqR0ZUcSk/NRSNjwGp0YaYUPUkchCK4SKGy1UE+gCXVJLrs 0sHXERZOpHvo4S2kwxYt3D4VQwteEBFd2snjHVFxpC3woKJ0vMgnZtH/5eL8gclUWsbB PZvw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020aa7d70e000000b00505070e007esi102073edq.232.2023.04.12.16.07.23; Wed, 12 Apr 2023 16:07:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjDLWqj (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Wed, 12 Apr 2023 18:46:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbjDLWqh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 12 Apr 2023 18:46:37 -0400 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96A5D8693; Wed, 12 Apr 2023 15:46:34 -0700 (PDT) Received: by mail-oi1-f171.google.com with SMTP id bx42so25270665oib.6; Wed, 12 Apr 2023 15:46:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681339594; x=1683931594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n6IQmhNHxPjInxSQpSIu3wq6BYWmrEpb2ujMy7CJmmE=; b=A+++A1jG7M9J0QqMWgdmD/agkTMRSxWd5oeejJyeQhkUoyaN+I+FofW5U1v3/Q18cI 9g3RDHOO2/Z29hwpEKNMBS2WPnddgmiJRo01G0DsgbgBvsjE54GvkZ1Dgzyx18JmfJEq zHHNipEZbxSIytZcPa/jWUdxdbncQOKYff/r6DPAO4nvR2jjtQ3y9IghVsJ3vEjoruML qsOTVfh8mEfFklx9p1PqGhH+afJ/2YYOs5jrFkrGrWE4ERBpsd+n5Qmikh0fbd623qqG YQBatW8dv5CxrfrCvM0QF+RFXyu/+e8OJQ+WGDgHqBJ/VUfxOJDYKGhLiTcfZcdJKvho lQIg== X-Gm-Message-State: AAQBX9dlK6wYhVfOzofISHzWUi0cocv2NDcEF+OMHfNz1CshR9KPtCQN SHja98zoVQveU0qJAn55ZVs= X-Received: by 2002:a05:6808:694:b0:38c:9f1:2c88 with SMTP id k20-20020a056808069400b0038c09f12c88mr111818oig.32.1681339593707; Wed, 12 Apr 2023 15:46:33 -0700 (PDT) Received: from archfamilia.lan ([181.219.149.7]) by smtp.gmail.com with ESMTPSA id cg9-20020a056808328900b0038beb8c1289sm50012oib.15.2023.04.12.15.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 15:46:33 -0700 (PDT) From: Lucas Tanure <tanure@linux.com> To: Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>, Mike Rapoport <rppt@kernel.org>, Andrew Morton <akpm@linux-foundation.org> Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, jbrunet@baylibre.com, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, martin.blumenstingl@googlemail.com, narmstrong@baylibre.com, stefan@agner.ch, Lucas Tanure <tanure@linux.com> Subject: [PATCH v3 1/1] of: fdt: Scan /memreserve/ last Date: Wed, 12 Apr 2023 18:46:20 -0400 Message-Id: <20230412224620.8909-2-tanure@linux.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230412224620.8909-1-tanure@linux.com> References: <20230412224620.8909-1-tanure@linux.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763013681254907315?= X-GMAIL-MSGID: =?utf-8?q?1763013681254907315?= |
Series |
Fix Random Kernel panic from when fail to reserve memory
|
|
Commit Message
Lucas Tanure
April 12, 2023, 10:46 p.m. UTC
Change the order of scanning /memreserve/ and /reserved-memory node.
/reserved-memory node should go first, as it has a more updated
description of the memory regions and it can apply flags, like nomap.
Also, /memreserve/ should avoid reserving regions described in
/reserved-memory node.
Signed-off-by: Lucas Tanure <tanure@linux.com>
---
drivers/of/fdt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On Wed, Apr 12, 2023 at 5:46 PM Lucas Tanure <tanure@linux.com> wrote: > > Change the order of scanning /memreserve/ and /reserved-memory node. > /reserved-memory node should go first, as it has a more updated > description of the memory regions and it can apply flags, like nomap. > Also, /memreserve/ should avoid reserving regions described in > /reserved-memory node. Please give some background details why we need to make this change. As-is, sounds like some theoretical issue. IOW, incorporate some of the details in the cover letter here. For single patches, you don't need a cover letter anyways. Powerpc folks, please comment and/or test. I worry there could be some subtle differences with this change. > > Signed-off-by: Lucas Tanure <tanure@linux.com> > --- > drivers/of/fdt.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > index d1a68b6d03b3..c28aedd7ae1f 100644 > --- a/drivers/of/fdt.c > +++ b/drivers/of/fdt.c > @@ -635,6 +635,9 @@ void __init early_init_fdt_scan_reserved_mem(void) > if (!initial_boot_params) > return; > > + fdt_scan_reserved_mem(); > + fdt_reserve_elfcorehdr(); > + > /* Process header /memreserve/ fields */ > for (n = 0; ; n++) { > fdt_get_mem_rsv(initial_boot_params, n, &base, &size); > @@ -643,8 +646,6 @@ void __init early_init_fdt_scan_reserved_mem(void) > memblock_reserve(base, size); > } > > - fdt_scan_reserved_mem(); > - fdt_reserve_elfcorehdr(); > fdt_init_reserved_mem(); > } > > -- > 2.40.0 >
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index d1a68b6d03b3..c28aedd7ae1f 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -635,6 +635,9 @@ void __init early_init_fdt_scan_reserved_mem(void) if (!initial_boot_params) return; + fdt_scan_reserved_mem(); + fdt_reserve_elfcorehdr(); + /* Process header /memreserve/ fields */ for (n = 0; ; n++) { fdt_get_mem_rsv(initial_boot_params, n, &base, &size); @@ -643,8 +646,6 @@ void __init early_init_fdt_scan_reserved_mem(void) memblock_reserve(base, size); } - fdt_scan_reserved_mem(); - fdt_reserve_elfcorehdr(); fdt_init_reserved_mem(); }