From patchwork Wed Nov 7 14:16:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 150390 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5220932ljp; Wed, 7 Nov 2018 06:16:24 -0800 (PST) X-Google-Smtp-Source: AJdET5czthIyfs3w2w0KtKuUFOqs21EsmryuToAVujsgXiXFs4hdBYPiCUDzXwt8tWUhGFQgURAp X-Received: by 2002:a62:42dc:: with SMTP id h89-v6mr420127pfd.0.1541600184489; Wed, 07 Nov 2018 06:16:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541600184; cv=none; d=google.com; s=arc-20160816; b=aL1FaSxbrPukx8aQOYN16dAh34Tx1YMtOolTAtsWGbF01sSn+0T89kWGZ4IohbQySc YdVzRssAvRtusbsV+YwLtWnhClYqBiVKZJyEZnFZ7GdDoN+Uz5N/b6v4v4FIAvQEzza8 74pd7T7pA0HeEkBhVZrsRS9IJOC3c0b8HE53vm4vjjOUng8LLM3wZKaA5lhT0Tq3m9pK 7SZeLhnKF3b/gF5WyXX3deTZ/ndpEQQqH13fv1OO9oIIcEchoeG+e/WlLu4HtjIA3NHA X5JNoT04D58nCfZxBOTIfwM2EPzVADRrgmJ/nKNf1hDCi96BelckHP6TKCATavaLEhHT X+rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TViYMN7rrAvvyRy96rxt8A/eBxLvHyunqiWbyfxTdDM=; b=Uc3zbFG4yKWvG9DdYslfkCfEkG4OtNg/ErbnAOElkSy5SOUifODmvPlDZ3MsZkURxb b9f2/DLcx8wgLAwoeZc07T8V3YLz+0kF5i7YLRvtoXesBA0l4He5D/t+7Peehf7hlk95 zCyPEvp0M2nRgw2DtCyd89smUdLV/DFjRyPYpPlOzouFoyk1akgojfRvgZ2n9RQtiTIC yjP4e2GubxvQtPW98w7TMtp5aLuES8ThxsEl99uHmF6DrxTbmZp1yCvG7t90ynlCn0oe 5hqQrQSG6oD1fNveQEErYI0HpEp3h14Br87SD4lqo4EPT5L7mEwifP89skBE7lN4jlTQ XQwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c+LxV3n8; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si703022pgn.313.2018.11.07.06.16.24; Wed, 07 Nov 2018 06:16:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c+LxV3n8; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727775AbeKGXq5 (ORCPT + 3 others); Wed, 7 Nov 2018 18:46:57 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54213 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726825AbeKGXq4 (ORCPT ); Wed, 7 Nov 2018 18:46:56 -0500 Received: by mail-wm1-f65.google.com with SMTP id f10-v6so2051703wme.3 for ; Wed, 07 Nov 2018 06:16:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TViYMN7rrAvvyRy96rxt8A/eBxLvHyunqiWbyfxTdDM=; b=c+LxV3n8mLJsMBXAXKUZGN0JdWaU6YI1euXM+k+otH75lZbbpoOt8OgB0ZLZEA3FTd dEoWxqlOpd7x0bqVr8eIDIYx5eEEjfAeELAptVymbmKRL8ZuMcw0IygiSQJX5/qNUFAP rn4HEdqA95IK4EZ0RvQMVuXVU+6nhYsJzzS+g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TViYMN7rrAvvyRy96rxt8A/eBxLvHyunqiWbyfxTdDM=; b=aaKi8JUZH+uZ/s7aNrJa4l2L4Vh1KE1o01UPCkKFevu0fZ2DVAPs9Jxmms3P0p9bbb qhhugsft6tNxlxJlVhi/8GFXHmG3HrPSjHX2ObJRePJeQhZ8OPuEcXUapKQw5nzAFPUB eNNJdXIdvugZLervms70RWIbzr1NVvLQkpOqHHMBQMj34sozjFVGEAugumrqjp2qjkHl bcy2W4TKnRI5XHK1OX/b26/sf7ONIqpwrAKXfByx3GcGTtWD41goHMaW2iw5W+2Ma/No BptQcAOSD3bHFm5Tfz2YOK2zgagf8vc7RlaO6vLf8TWiGTjdEZg9/wmhBjvuHNoXp7Fe bn2w== X-Gm-Message-State: AGRZ1gJwFGH2+ZliM7g2p2BdQ43xxEArvdvaxCxtytbIPDIXqTWa+Ugf lWmWdwW5e5S6U7wTbYhL3IFDTQ== X-Received: by 2002:a1c:3c82:: with SMTP id j124-v6mr352129wma.62.1541600181970; Wed, 07 Nov 2018 06:16:21 -0800 (PST) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id q2sm948447wrx.77.2018.11.07.06.16.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 06:16:20 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: marc.zyngier@arm.com, will.deacon@arm.com, bhsharma@redhat.com, linux-efi@vger.kernel.org, Ard Biesheuvel Subject: [PATCH v2 0/6] arm/efi: fix memblock reallocation crash due to persistent reservations Date: Wed, 7 Nov 2018 15:16:05 +0100 Message-Id: <20181107141611.12076-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org This series addresses the kexec/kdump crash on arm64 system with many CPUs that was reported by Bhupesh. Patch #1 fixes the actual crash, but may result in memblock_reserve() to fail. This is fixed in patch #4, where the point that the persistent reservations are applied is moved to after memblock_allow_resize() has been called. Patches #2 and #3 contain some minor preparatory changes that are required on ARM to ensure that efi_apply_persistent_mem_reservations() can be called at some point (i.e., when memblock resizing is already permitted and early memremap() is still usable) Patches #5 and #6 optimize the EFI persistent memreserve infrastructure so that fewer memblock reservations are required. Changes since v1: - Russell pointed out that switching to ordinary memremap() was not possible this early, and so I refactored the ARM early boot code slightly so that we can keep using early_memremap(). Ard Biesheuvel (6): arm64: memblock: don't permit memblock resizing until linear mapping is up ARM: mm: permit memblock resizing right after mapping the linear region ARM: mm: permit early_memremap() to be used in paging_init() efi/arm: defer persistent reservations until after paging_init() efi: permit multiple entries in persistent memreserve data structure efi: reduce the amount of memblock reservations for persistent allocations arch/arm/kernel/setup.c | 2 - arch/arm/mm/init.c | 1 - arch/arm/mm/mmu.c | 5 ++ arch/arm64/kernel/setup.c | 1 + arch/arm64/mm/init.c | 2 - arch/arm64/mm/mmu.c | 2 + drivers/firmware/efi/efi.c | 59 ++++++++++++++------ drivers/firmware/efi/libstub/arm-stub.c | 2 +- include/linux/efi.h | 23 +++++++- 9 files changed, 72 insertions(+), 25 deletions(-) -- 2.19.1 Tested-by: Bhupesh Sharma