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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 61C68CA0FE1 for ; Fri, 1 Sep 2023 10:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ltq1yFYuAIL9eaakrKy//4gBsjwoyDMZmuUYRINTupk=; b=juFlJQKe821g5t ZC2fDf9Z8BPMIBux/vTVzD3sFzE5PqhhIKlGyvGBlQV23xkJjYmyevB5vhu6jRn0lF3RyWod0gu4n iz2MGBmdIAutkZD9l0HITBQoXdsSEB527YXfd9k8JwUm9SrxGn10CTLsD24d7pa0vi5c0lwijRaY3 LfsvLaXlq0iO2NuMTuDckMqs7TAwQQAleGDceRZVYDBFw9eaWsOdRI2xikRDoZ//DjN3x/V21vOQl iQ536rSjHprCs0eQToB4XsuGg287AATTgWZPCnm1BWYMbiiu2dhCX848sX5LKM+sBbESSsevqalua DHQnAtVRsHajUm165xQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qc174-00GoDt-0O; Fri, 01 Sep 2023 10:10:50 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qc171-00GoCE-2J for linux-arm-kernel@lists.infradead.org; Fri, 01 Sep 2023 10:10:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693563042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q456NUShtf2WogSHXj6ov5yi106wsm6xbREboVKzgDk=; b=d0aKSqWb8qDST/Xs7pqwD1eM15y9kmhJsqNfk8I+MzgmwdvZOUD0Hww2ijOkOBckT/A7pd GteKdTNP6vNUV+6j0aqu+VpjQECXlB6DmeFlg7EtwYL6e7k2K4uwXVzTtuCriXN7ohjKDX aDOli3tos0H0TVKhU+xnl9BovVZND1o= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-687-QwiV2FkgMJGMDhMCbxQXZA-1; Fri, 01 Sep 2023 06:10:37 -0400 X-MC-Unique: QwiV2FkgMJGMDhMCbxQXZA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B42BE3C0D848; Fri, 1 Sep 2023 10:10:36 +0000 (UTC) Received: from localhost (unknown [10.72.113.156]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06C42201B07A; Fri, 1 Sep 2023 10:10:35 +0000 (UTC) Date: Fri, 1 Sep 2023 18:10:32 +0800 From: Baoquan He To: "Leizhen (ThunderTown)" Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, catalin.marinas@arm.com, thunder.leizhen@huawei.com, dyoung@redhat.com, prudo@redhat.com, samuel.holland@sifive.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: Re: [PATCH v2 6/8] x86: kdump: use generic interface to simplify crashkernel reservation code Message-ID: References: <20230829121610.138107-1-bhe@redhat.com> <20230829121610.138107-7-bhe@redhat.com> <5b53d460-7134-e292-77ec-967016e89003@huaweicloud.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5b53d460-7134-e292-77ec-967016e89003@huaweicloud.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230901_031047_827605_B61F2EF2 X-CRM114-Status: GOOD ( 19.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 08/31/23 at 11:43am, Leizhen (ThunderTown) wrote: ...... > > -static void __init reserve_crashkernel(void) > > +static void __init arch_reserve_crashkernel(void) > > { > > - unsigned long long crash_size, crash_base, total_mem; > > + unsigned long long crash_base, crash_size, low_size = 0; > > + char *cmdline = boot_command_line; > > bool high = false; > > int ret; > > > > if (!IS_ENABLED(CONFIG_KEXEC_CORE)) > > return; > > > > - total_mem = memblock_phys_mem_size(); > > - > > - /* crashkernel=XM */ > > - ret = parse_crashkernel(boot_command_line, total_mem, > > - &crash_size, &crash_base, NULL, NULL); > > - if (ret != 0 || crash_size <= 0) { > > - /* crashkernel=X,high */ > > - ret = parse_crashkernel_high(boot_command_line, total_mem, > > - &crash_size, &crash_base); > > - if (ret != 0 || crash_size <= 0) > > - return; > > - high = true; > > - } > > + ret = parse_crashkernel(cmdline, memblock_phys_mem_size(), > > + &crash_size, &crash_base, > > + &low_size, &high); > > + if (ret) > > + return; > > > > if (xen_pv_domain()) { > > pr_info("Ignoring crashkernel for a Xen PV domain\n"); > > return; > > } > > > > - /* 0 means: find the address automatically */ > > - if (!crash_base) { > > - /* > > - * Set CRASH_ADDR_LOW_MAX upper bound for crash memory, > > - * crashkernel=x,high reserves memory over 4G, also allocates > > - * 256M extra low memory for DMA buffers and swiotlb. > > - * But the extra memory is not required for all machines. > > - * So try low memory first and fall back to high memory > > - * unless "crashkernel=size[KMG],high" is specified. > > - */ > > - if (!high) > > - crash_base = memblock_phys_alloc_range(crash_size, > > - CRASH_ALIGN, CRASH_ALIGN, > > - CRASH_ADDR_LOW_MAX); > > - if (!crash_base) > > - crash_base = memblock_phys_alloc_range(crash_size, > > - CRASH_ALIGN, CRASH_ALIGN, > > - CRASH_ADDR_HIGH_MAX); > > - if (!crash_base) { > > - pr_info("crashkernel reservation failed - No suitable area found.\n"); > > - return; > > - } > > - } else { > > - unsigned long long start; > > - > > - start = memblock_phys_alloc_range(crash_size, SZ_1M, crash_base, > > - crash_base + crash_size); > > - if (start != crash_base) { > > - pr_info("crashkernel reservation failed - memory is in use.\n"); > > - return; > > - } > > - } > > - > > - if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) { > > - memblock_phys_free(crash_base, crash_size); > > - return; > > - } > > - > > - pr_info("Reserving %ldMB of memory at %ldMB for crashkernel (System RAM: %ldMB)\n", > > - (unsigned long)(crash_size >> 20), > > - (unsigned long)(crash_base >> 20), > > - (unsigned long)(total_mem >> 20)); > > + reserve_crashkernel_generic(cmdline, crash_size, crash_base, > > + low_size, high); > > > > - crashk_res.start = crash_base; > > - crashk_res.end = crash_base + crash_size - 1; > > - insert_resource(&iomem_resource, &crashk_res); > > + return; > > This can be omitted. Will update, thx. > > > } ...... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel