From patchwork Tue Jun 14 12:02:28 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: 12880961 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 C97A8C433EF for ; Tue, 14 Jun 2022 12:02:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D94878D0240; Tue, 14 Jun 2022 08:02:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D44608D023D; Tue, 14 Jun 2022 08:02:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B95F98D0240; Tue, 14 Jun 2022 08:02:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AC1FF8D023D for ; Tue, 14 Jun 2022 08:02:44 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 86AFA21182 for ; Tue, 14 Jun 2022 12:02:44 +0000 (UTC) X-FDA: 79576704648.22.8232DD1 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf22.hostedemail.com (Postfix) with ESMTP id BEB10C00B6 for ; Tue, 14 Jun 2022 12:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655208163; x=1686744163; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5iNOOTJdL5ijo85SJxVFVHCZr4Xdf/z52sXS4dv1fJU=; b=GPjFgFOYMWyzEPeCBZomWjCIWOPZY522Dv6T3A92NE3e1aojWdYyCG1w JW048DJK2qH7U1NqIyT2v4/ln2nOihTRGuTDX+AaP7RwkJ+1uK1goMbwJ n2xIP/FKh4XOR5VbgPpJBKIN573jDjAmuIadD/qhcPPmgA3J7S5KnuQKW Go/d6YGRNtrJlEEqr9/zGko+AHssxlmPY9bYxfA4+mh9ephilIZAXevD2 LslzqRgWmmmLD3OjlRs1dFT5L7yYNU3s8YHtomO/urnD/H59AmO74lGXc B+naq8J3fxpx0jmRv9LZ2EJMBWWM+uDj5Voe1JXbmF56seFMcsMrQhcXc A==; X-IronPort-AV: E=McAfee;i="6400,9594,10377"; a="267281679" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="267281679" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 05:02:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="558311426" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 14 Jun 2022 05:02:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id DA1A7911; Tue, 14 Jun 2022 15:02:32 +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: [PATCHv7 11/14] x86: Disable kexec if system has unaccepted memory Date: Tue, 14 Jun 2022 15:02:28 +0300 Message-Id: <20220614120231.48165-12-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> References: <20220614120231.48165-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655208164; a=rsa-sha256; cv=none; b=bOmJcLTnIaseoHvEX4EmmAJGoghoYKCEfty2+9UXhSBAp1VZ0dz2wugLiift2A16pnsbLe qdOi6GqFO8Im+dG0jE6Huk/s6bF9vEU3/9F1y4NswVXjFlHKPLeSEcceCLr+Mve0w5SsHr QO46mTWsJOjpwMmhJ+PWnSFtykUSlFc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=GPjFgFOY; spf=none (imf22.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.20) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655208164; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=T83ZuDv6C39ecNEbaEJCyi/QMOfVe0PDc9sBvHINSvQ=; b=l42IFO/QqHoPmjU0beFd3nEMpQAAczFNW4TzmJY+KZhUhhjNRXD1Mf4QtNwtVTXXFWZCo/ sv57ZxKgZvu2tOYB6LPLSc/3Guf1NNWM1d94jrALm3vIMyWWoDTsIMuG+9c7Jkc0JsDgQb WFX1VC6SnHWsnZVqhP9Rz0awZgekD1w= X-Stat-Signature: ycpn3xg4zqpgtknnkp1kb1hswd6f4r7t X-Rspamd-Queue-Id: BEB10C00B6 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=GPjFgFOY; spf=none (imf22.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.20) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam02 X-HE-Tag: 1655208163-287371 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 Signed-off-by: Kirill A. Shutemov --- arch/x86/mm/unaccepted_memory.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/x86/mm/unaccepted_memory.c b/arch/x86/mm/unaccepted_memory.c index bcd56fe82b9e..05e216716690 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 @@ -95,3 +96,21 @@ bool range_contains_unaccepted_memory(phys_addr_t start, phys_addr_t end) return ret; } + +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 + + return 0; +} +fs_initcall(unaccepted_init);