From patchwork Mon Jul 10 12:56:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioanna Alifieraki X-Patchwork-Id: 1805809 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=QcMffsM+; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R03sz2G0wz20Ph for ; Mon, 10 Jul 2023 22:56:39 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qIqRL-00010o-Re; Mon, 10 Jul 2023 12:56:31 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qIqRD-0000nE-Ef for kernel-team@lists.ubuntu.com; Mon, 10 Jul 2023 12:56:23 +0000 Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 834423F16E for ; Mon, 10 Jul 2023 12:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1688993782; bh=Ox7k3IT8QWeMMDSNcQd/W3jjnZPZ177Vsc6ApMuVbEA=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QcMffsM+eY3xuMNEUJy0NxVY75ZtBekMEhpHlp+YTUKEgeEdy3dM/QVa9FCHMUeyR C5P58gjvnAPUvbIJkESjPC8hehgjDEn+AIxQmvADKj+dc/8br2xzVpNAnLXWPladhW shVmZPky1J3GN4wpxx1Kkt+doAyy9wwt2RBhxtuCH/pKxSjOY88idDA46WmTqqYv5l a8yNabwNJxl8HXmOVsMMBsBaVyNrS7JMq6C623xHY8VHmA5144AbG6EuT4XiT4YeX0 ZKxtRG9w8MglFdh4UTgTSLtBHbsdaQm8LVtyYtirsLR636afPuhSexr+GXyrBSpKzc UlpCOnvUT1Rzg== Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2b620465d0eso39136401fa.0 for ; Mon, 10 Jul 2023 05:56:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688993781; x=1691585781; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ox7k3IT8QWeMMDSNcQd/W3jjnZPZ177Vsc6ApMuVbEA=; b=hUFZu6HfI3lwH4OD8D6P2bB6oaVUGmTXjmDU1gE8JkN5d0425Bho0EEx3mJWoy9gNY 0gdQTPRAZihZVyXTqqI8nPdabMAvtgiRanHHWBZc6O5Yf9IleQCPNnF7nK6YHIVYOVvC 4KoP430w0VWMfBAb422eYh1iQiBekI1ihWONxHo7sv41m/1OUY2TwJJB5LfX9N2t/z/H WWbivtR53ykRb38VsvHyMQPQmnbRtzjGJGf/oRekRx++ri3obU8v2dpdamhQ68NMwzQY h8/h1ht1ZlxLHGMWM64IqtoUzFJf2snAEPZpz1wdieunXvwMij5+Ak10FMdcM6jG3+8u QXDA== X-Gm-Message-State: ABy/qLZk5/ZPEwRDpBjYqAxbdu+hByoThvHnRAUjHciKTBtditW2lK1E 0ueriPpYAMm5P9TqMKeCp3vm3zPka+o3uLS+TyIOQLZ7bgqnTjwwrv/eIWE9TcPEwaWe3ytbar5 2hjCU3Pm+aM7CvvWBcIyamMDLfKkVPDlnUylIG9dHLD8muxvYLw== X-Received: by 2002:a2e:809a:0:b0:2b6:a618:9f3b with SMTP id i26-20020a2e809a000000b002b6a6189f3bmr9425420ljg.24.1688993781610; Mon, 10 Jul 2023 05:56:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFo438Mh5r5PbDZRDjm3aRbxafH4Pf8qWv0j+bGqN0g4O1Wf3+VDKjgD+h30QT+aCIapyIow== X-Received: by 2002:a2e:809a:0:b0:2b6:a618:9f3b with SMTP id i26-20020a2e809a000000b002b6a6189f3bmr9425407ljg.24.1688993781230; Mon, 10 Jul 2023 05:56:21 -0700 (PDT) Received: from t14s.. ([212.251.14.163]) by smtp.gmail.com with ESMTPSA id m4-20020a170906258400b00992025654c4sm6133605ejb.182.2023.07.10.05.56.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 05:56:20 -0700 (PDT) From: Ioanna Alifieraki To: kernel-team@lists.ubuntu.com Subject: [SRU][J][PATCH 7/7] arm64: kdump: Support crashkernel=X fall back to reserve region above DMA zones Date: Mon, 10 Jul 2023 15:56:12 +0300 Message-Id: <20230710125612.37735-8-ioanna-maria.alifieraki@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230710125612.37735-1-ioanna-maria.alifieraki@canonical.com> References: <20230710125612.37735-1-ioanna-maria.alifieraki@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Zhen Lei BugLink: https://bugs.launchpad.net/bugs/2024479 For crashkernel=X without '@offset', select a region within DMA zones first, and fall back to reserve region above DMA zones. This allows users to use the same configuration on multiple platforms. Signed-off-by: Zhen Lei Acked-by: Baoquan He Reviewed-by: Catalin Marinas Link: https://lore.kernel.org/r/20221116121044.1690-3-thunder.leizhen@huawei.com Signed-off-by: Will Deacon (cherry picked from commit a9ae89df737756d92f0e14873339cf393f7f7eb0) Signed-off-by: Ioanna Alifieraki --- Documentation/admin-guide/kernel-parameters.txt | 2 +- arch/arm64/mm/init.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 839be687b768..124bfb3cc870 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -784,7 +784,7 @@ memory region [offset, offset + size] for that kernel image. If '@offset' is omitted, then a suitable offset is selected automatically. - [KNL, X86-64] Select a region under 4G first, and + [KNL, X86-64, ARM64] Select a region under 4G first, and fall back to reserve region above 4G when '@offset' hasn't been specified. See Documentation/admin-guide/kdump/kdump.rst for further details. diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 76ad3ea9507d..e2b41581e5cd 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -132,6 +132,7 @@ static void __init reserve_crashkernel(void) unsigned long long crash_max = CRASH_ADDR_LOW_MAX; char *cmdline = boot_command_line; int ret; + bool fixed_base = false; if (!IS_ENABLED(CONFIG_KEXEC_CORE)) return; @@ -163,12 +164,26 @@ static void __init reserve_crashkernel(void) crash_size = PAGE_ALIGN(crash_size); /* User specifies base address explicitly. */ - if (crash_base) + if (crash_base) { + fixed_base = true; crash_max = crash_base + crash_size; + } +retry: crash_base = memblock_phys_alloc_range(crash_size, CRASH_ALIGN, crash_base, crash_max); if (!crash_base) { + /* + * If the first attempt was for low memory, fall back to + * high memory, the minimum required low memory will be + * reserved later. + */ + if (!fixed_base && (crash_max == CRASH_ADDR_LOW_MAX)) { + crash_max = CRASH_ADDR_HIGH_MAX; + crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE; + goto retry; + } + pr_warn("cannot allocate crashkernel (size:0x%llx)\n", crash_size); return;