From patchwork Thu Jan 4 15:34:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Poonam Aggrwal X-Patchwork-Id: 10144305 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 8746460594 for ; Thu, 4 Jan 2018 09:37:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81F7E2624C for ; Thu, 4 Jan 2018 09:37:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 76C822852D; Thu, 4 Jan 2018 09:37:23 +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=-1.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DATE_IN_FUTURE_03_06, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 0C5692624C for ; Thu, 4 Jan 2018 09:37:22 +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: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:In-Reply-To:References: List-Owner; bh=cgQQXTvag3f2O4sGtXZzGgZguLrS7JNrBfYjPhao/h0=; b=g5ThFeo4+JQkAH EKNO7yUapA3HgceY/u8Y+jntOwg0GjeTUQeAj4VzoSrHHOGNeLv65ID4P29mGe8h+55ath3Ue/9dB IMbUutnn4eleHZqxhQbYx8o7eS+IiNzHCvzSropf593wrKIVIHT5eyJvn/jV0qenRwvtNnl0hAOuc Rnr+gQRSgOZ+pWxkmKryhhz/13K94ZL6qacy+Ys6C0pIOlyGyH7EvgPhMO0ry0YfkhAs08gNWfm7w OzxRDJs6fUnpJvOhGdiU47CMhiPHY0MIIKRh/XbnFhKA14W7obGOUCh6dzJkf1YA4oI3Sfusjy6hz NOVmTOYdWDP9hV/GtfGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eX1xf-0005yU-4H; Thu, 04 Jan 2018 09:37:19 +0000 Received: from mail-co1nam03on0060.outbound.protection.outlook.com ([104.47.40.60] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eX1xF-0005Tb-14 for linux-arm-kernel@lists.infradead.org; Thu, 04 Jan 2018 09:37:13 +0000 Received: from MWHPR03CA0059.namprd03.prod.outlook.com (10.174.173.176) by CY1PR03MB2361.namprd03.prod.outlook.com (10.166.207.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Thu, 4 Jan 2018 09:36:40 +0000 Received: from BN1AFFO11FD031.protection.gbl (2a01:111:f400:7c10::128) by MWHPR03CA0059.outlook.office365.com (2603:10b6:301:3b::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Thu, 4 Jan 2018 09:36:40 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD031.mail.protection.outlook.com (10.58.52.185) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Thu, 4 Jan 2018 09:36:14 +0000 Received: from yukti-OptiPlex-780.ap.freescale.net (yukti-OptiPlex-780.ap.freescale.net [10.232.133.145]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w049aaBn020907; Thu, 4 Jan 2018 02:36:37 -0700 From: Poonam Aggrwal To: Subject: [PATCH][v2] arm64: Allocate elfcorehdr & crashkernel mem before any reservation Date: Thu, 4 Jan 2018 21:04:08 +0530 Message-ID: <1515080048-9154-1-git-send-email-poonam.aggrwal@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131595321743776152; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(7966004)(336005)(376002)(39380400002)(396003)(39860400002)(346002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(51416003)(50466002)(48376002)(77096006)(2906002)(68736007)(305945005)(316002)(59450400001)(97736004)(4326008)(966005)(5660300001)(105606002)(86362001)(106466001)(6916009)(6666003)(498600001)(2351001)(81156014)(36756003)(8656006)(8676002)(53936002)(47776003)(104016004)(85426001)(81166006)(356003)(6306002)(16586007)(54906003)(50226002)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2361; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD031; 1:KifOQDJF1yHCdKoDBIV3Vz6mvexSjfXcmbEDWVvo4u4HQfYvG6XyXOq7HYU87KUkrZXGwEoHHo3Bs7lXg+VM93A/ChR+LpprAcgUSu3/hv96xxarPifxCTXYdrIkU0eq MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57b65f3c-b259-49e1-1998-08d55356991b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:CY1PR03MB2361; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 3:zbLf073rk241PNLjMJ+E9pT/EhYnyOgmVRfUFhXnVobEJyO2eZEpvN9qQpVY3c65To5tPLilUO+Pz1eoOtJGjkACUZqRHod2o2CtpUkOE4hJIzMS3O7+6WByXpcSOJ4Q2rKbDPh0parA85d728SNdnNLLE1MiZ/WF4x2ox2mjPlWWQfLE0ioVmhEXD220c7nFCbICbHTBIq1wIHCz7ZYIUk8de5wKQOOLSfUPXsp4JrExY2ti63aUs/sk6dyFr0bHq05fsTlBf2AyHoZXU/Vor5R5B7yVZMmdkdUsMYb9E7yV1oX2uklQcfG26glBma5k13wu4iWj96E6vSTi5mF+u2AcbN7RhEicqNCeb4j62M=; 25:U+4z55mGxFlpkh+bmB6I2TZrZmXQscVp1zwOTDdyPCq86qsZtthgNrs4wtmYfSovTT8IvAEl9UegbtVI33efeBZj+S+frBz9RP8BlrPvF1RNqNmTJZfFMzp9DrkX3g2I5VH+mOW3ke+9bZBZtUhruSOd6uarz7LXmYGWQeOpAUEGqLBDZQeHfJVdGCGZy3RHSwZ2Dxj39n8xbF2yi6xVnW6m4R0ARfUFCoFacKk+Uwiy7fFVu0iRusHmjUVU9TkxMSQWYa+pCCeTrLrZuoqVkYoAauNKrE/nVaq5cit/Ebwd/+6P2W+uvqeYYXE2FPfEE3dwW0kFepu2MrF6fyOIbA== X-MS-TrafficTypeDiagnostic: CY1PR03MB2361: X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2361; 31:0Q2wkkxO/TWsp+zJ3wscj6JmjX+KvrPBmG9a2PGPutGXrO9uoJDaIuciUoB4uGCgxbjOXMf2mY1hnnNW4KbspRoL6yCgvtauYc5IGRvgztFsUmOGFqLdMnLHxxcq78l824kE0upBqALcm/nK45XJ2kH29jTqa/Qgn+DemPDqeCg9jvIGs0D0c1nI3uRl2753wKk3lVImQ2w3VPZI9p0br3sAnZmJedqkuRA1ENWLX9U=; 4:CMNVbiHi6X6OzST8gDE9OYqpxismdL36PD6FwJYSBn7EHuhq7bABYE5V4pj4SS4QfRJPJo3zN0rGqEs7Kwy0A2ekE2k2yl5bl4HzQWVGob4C1QscZcklciBDQbC/PPtjZfJz4413G0hz/jz7totlqMPeLpaXNc1qGl3G49zIxY2GmH5qfOJiFV2yVbcJu3clDPw+TrxZnryhlJ0fIUx1BpmVWpbRajZmnUR1ltVTwtTjssJC9CW6hkagRhQ4JWWmSO/A6F9MmayU1i3SXzT6f3olv/OP5UrJCKQZ4Ti0NH1KsuWH4KQS336TNryhUw/v X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231023)(944510075)(944921075)(946801075)(946901075)(3002001)(6055026)(6096035)(20161123556025)(20161123561025)(20161123565025)(20161123559100)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123563025)(201708071742011); SRVR:CY1PR03MB2361; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY1PR03MB2361; X-Forefront-PRVS: 054231DC40 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2361; 23:BdHfiLRboi6k7uhcGwhj3Q6Aka9T8OFivXpfT0YRB?= =?us-ascii?Q?31fZsaruq88XcZY1dAy0NVcU5ik1/CIqLZfnJQlPW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E/lt7yMoiWej6ycHnmwqVkQIWyoieK46ddVNIsohAI3gclcEh7OPdIYbdT0b3UJSh3cWhc3wPx56+4NuMAXnrWS+i+mlaZ7H2BFj0FJyL2z66qwsdfKJW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2018 09:36:14.2060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57b65f3c-b259-49e1-1998-08d55356991b X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2361 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180104_013653_595964_1DF6026E X-CRM114-Status: GOOD ( 13.99 ) 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: Poonam Aggrwal , will.deacon@arm.com, takahiro.akashi@linaro.org, Guanhua , james.morse@arm.com, Abhimanyu Saini 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 Address for both crashkernel memory and elfcorehdr can be assigned statically. For crashkernel memory it is via crashkernel=SIZE@ADDRESS and elfcorehdr_addr via by kexec-utils in dump kernel device tree. So memory should be reserved for both the above areas before any other memory reservations are done. Otherwise overlaps may happen and memory allocations will fail leading to failure in booting the dump capture kernel. Signed-off-by: Guanhua Signed-off-by: Poonam Aggrwal Signed-off-by: Abhimanyu Saini --- v2: corrected the email address reworked based on the discussions:(with Will Deacon and Takahiro) https://patchwork.kernel.org/patch/10104249/ arch/arm64/mm/init.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 00e7b90..24ce15d 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -453,6 +453,14 @@ void __init arm64_memblock_init(void) * Register the kernel text, kernel data, initrd, and initial * pagetables with memblock. */ + + /* make these the first reservations to avoid chances of + * overlap + */ + reserve_elfcorehdr(); + + reserve_crashkernel(); + memblock_reserve(__pa_symbol(_text), _end - _text); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) { @@ -472,10 +480,6 @@ void __init arm64_memblock_init(void) else arm64_dma_phys_limit = PHYS_MASK + 1; - reserve_crashkernel(); - - reserve_elfcorehdr(); - high_memory = __va(memblock_end_of_DRAM() - 1) + 1; dma_contiguous_reserve(arm64_dma_phys_limit);