From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80025C43331 for ; Thu, 26 Mar 2020 18:08:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3643C20714 for ; Thu, 26 Mar 2020 18:08:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3643C20714 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BEF1D6B0010; Thu, 26 Mar 2020 14:08:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B781F6B0032; Thu, 26 Mar 2020 14:08:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A66AD6B0036; Thu, 26 Mar 2020 14:08:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 8A01D6B0010 for ; Thu, 26 Mar 2020 14:08:20 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C63DC989B for ; Thu, 26 Mar 2020 18:08:20 +0000 (UTC) X-FDA: 76638297960.14.loaf24_e9d49788de51 X-HE-Tag: loaf24_e9d49788de51 X-Filterd-Recvd-Size: 3179 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Mar 2020 18:08:20 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E13227FA; Thu, 26 Mar 2020 11:08:18 -0700 (PDT) Received: from melchizedek.cambridge.arm.com (melchizedek.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 90B6D3F71E; Thu, 26 Mar 2020 11:08:17 -0700 (PDT) From: James Morse To: kexec@lists.infradead.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Cc: Eric Biederman , Andrew Morton , Catalin Marinas , Will Deacon , Anshuman Khandual , Bhupesh Sharma , James Morse Subject: [PATCH 0/3] kexec/memory_hotplug: Prevent removal and accidental use Date: Thu, 26 Mar 2020 18:07:27 +0000 Message-Id: <20200326180730.4754-1-james.morse@arm.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hello! arm64 recently queued support for memory hotremove, which led to some new corner cases for kexec. If the kexec segments are loaded for a removable region, that region may be removed before kexec actually occurs. This causes the first kernel to lockup when applying the relocations. (I've triggered this on x86 too). The first patch adds a memory notifier for kexec so that it can refuse to allow in-use regions to be taken offline. This doesn't solve the problem for arm64, where the new kernel must initially rely on the data structures from the first boot to describe memory. These don't describe hotpluggable memory. If kexec places the kernel in one of these regions, it must also provide a DT that describes the region in which the kernel was mapped as memory. (and somehow ensure its always present in the future...) To prevent this from happening accidentally with unaware user-space, patches two and three allow arm64 to give these regions a different name. This is a change in behaviour for arm64 as memory hotadd and hotremove were added separately. I haven't tried kdump. Unaware kdump from user-space probably won't describe the hotplug regions if the name is different, which saves us from problems if the memory is no longer present at kdump time, but means the vmcore is incomplete. These patches are based on arm64's for-next/core branch, but can all be merged independently. Thanks, James Morse (3): kexec: Prevent removal of memory in use by a loaded kexec image mm/memory_hotplug: Allow arch override of non boot memory resource names arm64: memory: Give hotplug memory a different resource name arch/arm64/include/asm/memory.h | 11 +++++++ kernel/kexec_core.c | 56 +++++++++++++++++++++++++++++++++ mm/memory_hotplug.c | 6 +++- 3 files changed, 72 insertions(+), 1 deletion(-) --=20 2.25.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDD4CC43331 for ; Thu, 26 Mar 2020 18:09:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B647B20714 for ; Thu, 26 Mar 2020 18:09:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SJu5GTVs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B647B20714 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=huIvPD7SXKtZ0wRT3U8RnNh/KVQoYKksBXBkW+qpW/Q=; b=SJu5GTVsOV7N3Q y+6pid8G1DVVUxRZ8F5BXOyPPd6TZyCc28DZwcfhS6wUVx4p1Lu1yySk5TPVZOrPvNSOu6vEQIIhY ocVq/pCNH+9WQbrS5kAO4+8qoURHhxJ+Wwc/d6MjBfyCEwMYhY40JEgG0XI37rTyXWNYv4oKDzc9u //BslnGvvBynCnwK92VLeCOe45tYUe5ODaM95rGF3hc4Np5znvw5V/ldPmpRuE0P0FYJSefLV2yrn rrJXzuUC1t4C3OY3lx9m9OhF/KDR9cQ1G0CllAfbSEAyb55cpClOd0nDgEfRQWvk4kKzH7DRxVMR9 RCHyzbXz70bYpGkKeiBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHWww-00082m-A9; Thu, 26 Mar 2020 18:09:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHWvW-0006vg-3k; Thu, 26 Mar 2020 18:08:28 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E13227FA; Thu, 26 Mar 2020 11:08:18 -0700 (PDT) Received: from melchizedek.cambridge.arm.com (melchizedek.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 90B6D3F71E; Thu, 26 Mar 2020 11:08:17 -0700 (PDT) From: James Morse To: kexec@lists.infradead.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 0/3] kexec/memory_hotplug: Prevent removal and accidental use Date: Thu, 26 Mar 2020 18:07:27 +0000 Message-Id: <20200326180730.4754-1-james.morse@arm.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200326_110822_275320_B9383F66 X-CRM114-Status: GOOD ( 13.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anshuman Khandual , Catalin Marinas , Bhupesh Sharma , James Morse , Eric Biederman , Andrew Morton , Will Deacon Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello! arm64 recently queued support for memory hotremove, which led to some new corner cases for kexec. If the kexec segments are loaded for a removable region, that region may be removed before kexec actually occurs. This causes the first kernel to lockup when applying the relocations. (I've triggered this on x86 too). The first patch adds a memory notifier for kexec so that it can refuse to allow in-use regions to be taken offline. This doesn't solve the problem for arm64, where the new kernel must initially rely on the data structures from the first boot to describe memory. These don't describe hotpluggable memory. If kexec places the kernel in one of these regions, it must also provide a DT that describes the region in which the kernel was mapped as memory. (and somehow ensure its always present in the future...) To prevent this from happening accidentally with unaware user-space, patches two and three allow arm64 to give these regions a different name. This is a change in behaviour for arm64 as memory hotadd and hotremove were added separately. I haven't tried kdump. Unaware kdump from user-space probably won't describe the hotplug regions if the name is different, which saves us from problems if the memory is no longer present at kdump time, but means the vmcore is incomplete. These patches are based on arm64's for-next/core branch, but can all be merged independently. Thanks, James Morse (3): kexec: Prevent removal of memory in use by a loaded kexec image mm/memory_hotplug: Allow arch override of non boot memory resource names arm64: memory: Give hotplug memory a different resource name arch/arm64/include/asm/memory.h | 11 +++++++ kernel/kexec_core.c | 56 +++++++++++++++++++++++++++++++++ mm/memory_hotplug.c | 6 +++- 3 files changed, 72 insertions(+), 1 deletion(-) -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel