From patchwork Tue May 17 15:34:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 12852697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42175C433FE for ; Tue, 17 May 2022 15:35:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C70396B0088; Tue, 17 May 2022 11:35:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA7C86B0087; Tue, 17 May 2022 11:35:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D7766B0081; Tue, 17 May 2022 11:35:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 66C856B007E for ; Tue, 17 May 2022 11:35:08 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 48AA62094F for ; Tue, 17 May 2022 15:35:08 +0000 (UTC) X-FDA: 79475633496.01.9D5E93C Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by imf24.hostedemail.com (Postfix) with ESMTP id 3848C1800EB for ; Tue, 17 May 2022 15:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652801707; x=1684337707; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xF84dLhyksFpMyCb7NPvfM3NGwTlY5bjd8sAol6pl90=; b=Ua+4RYfJThOxCM0AabYpxLbnhHFjmfgZeyivbwKDk7vwF6hd/0uKvKvY a1j3XXawkOgGaCUEaErMD4qhI9jtpt+t4tM9iCtWmsbtRg82uWRXVVTH9 INe3mbZiTWGxAo8whn8qdL99IZUVsUPRj2bj89DH2R9gj+HUY4SEPQiq+ MeF84kd8p1QqD0NIqabcZ/04ZLcDbl42bF0JNrLil+YzG5nlOiRZfgJkO KOFu+WbkW9x4UV/gkSUZ0QhSqSsRTzJNhLBATG9Wpd9+Js3TpzFauFyyW WIrd2+7pqsnDHRJGYAKyXwnt0kyP0SNY8lXTOi20yUBJnnbQgdSnoeL45 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="357629666" X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="357629666" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 08:35:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,233,1647327600"; d="scan'208";a="555823109" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 17 May 2022 08:34:58 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id CBC23D38; Tue, 17 May 2022 18:34:50 +0300 (EEST) From: "Kirill A. Shutemov" To: Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Ard Biesheuvel Cc: Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , Dave Hansen , Mike Rapoport , David Hildenbrand , marcelo.cerri@canonical.com, tim.gardner@canonical.com, khalid.elmously@canonical.com, philip.cox@canonical.com, x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv6 11/15] x86: Disable kexec if system has unaccepted memory Date: Tue, 17 May 2022 18:34:40 +0300 Message-Id: <20220517153444.11195-12-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> References: <20220517153444.11195-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 3848C1800EB X-Stat-Signature: 49zb337wk8rdk4qyccfe7t3qn9tgzagz Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Ua+4RYfJ; spf=none (imf24.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 192.55.52.43) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-HE-Tag: 1652801696-141264 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: On kexec, the target kernel has to know what memory has been accepted. Information in EFI map is out of date and cannot be used. boot_params.unaccepted_memory can be used to pass the bitmap between two kernels on kexec, but the use-case is not yet implemented. Disable kexec on machines with unaccepted memory for now. Signed-off-by: Kirill A. Shutemov --- arch/x86/mm/unaccepted_memory.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/mm/unaccepted_memory.c b/arch/x86/mm/unaccepted_memory.c index 1ca71eb98c24..b4c43e6089b0 100644 --- a/arch/x86/mm/unaccepted_memory.c +++ b/arch/x86/mm/unaccepted_memory.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only +#include #include #include #include @@ -114,6 +115,15 @@ static int __init unaccepted_init(void) if (!boot_params.unaccepted_memory) return 0; +#ifdef CONFIG_KEXEC_CORE + /* + * TODO: Information on memory acceptance status has to be communicated + * between kernel. + */ + pr_warn("Disable kexec: not yet supported on systems with unaccepted memory\n"); + kexec_load_disabled = 1; +#endif + bitmap_size = e820__end_of_ram_pfn() * PAGE_SIZE / PMD_SIZE; unaccepted_memory = __va(boot_params.unaccepted_memory);