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 E457AC433EF for ; Mon, 20 Jun 2022 07:44:11 +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=u4s7ZmCFxGdpyBv+mQfdhlzLsglgLOdhtPSGKylAi2U=; b=SBk/soM0K3nW9p 0ulOUmx/YqWG6cV1p1oEm0o2icyEsVxnd9kw8/COsP/s4HAtACsrW9ErQOmN5fFJdKiCw8ew9I+Pn SZnOIza0w8nmqfuL72LPqq+WlcGnuhuHvnhvta7GHQ/+QWUhk6G9k7foOmlU1hijd1DZvSQL8qrwK hmu5FuxKNNj8/nlr/0AkM0LO0+h4yL8Pl8rgTtTr560sVPiRznlAAMOWsK/1Uz1WlmIs7/V8tB4lS 2OprDl8YWAB3Fofq7GYd+q8GcaU6wRIW3jxl92Pk0Ct5lVC4EgcPizPe7xdIp+rQtDc6PzeuD3Qr4 doO6VotQNJldxqHuL7FQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3C44-00Gj5B-BA; Mon, 20 Jun 2022 07:43:16 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o3C40-00Gj31-21 for linux-arm-kernel@lists.infradead.org; Mon, 20 Jun 2022 07:43:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655710990; 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=ZUNmq+SKtB8IP20c0SQTXtLsVBfIbeKTb4f/dBL0tMs=; b=TunkGyaqtEoaJ1t/ESeesbqJqElasPp8DcQKj0I1ACYcy25X9msBgi0TlVt6nEyFgs0P0s tSJf13lO8SBSvUOkIjaju94ZnASD2IVpnAIPblZtexLWG7ymL9cQGys+ehAcLBYH6wXTtE NskhaB+4nFpYqdzADKL8R1hivjloosw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-569-czD0OaIeNQauw7EnkZNbLw-1; Mon, 20 Jun 2022 03:43:04 -0400 X-MC-Unique: czD0OaIeNQauw7EnkZNbLw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E0D45811E81; Mon, 20 Jun 2022 07:43:02 +0000 (UTC) Received: from localhost (ovpn-13-50.pek2.redhat.com [10.72.13.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76A10C44AE3; Mon, 20 Jun 2022 07:43:01 +0000 (UTC) Date: Mon, 20 Jun 2022 15:42:58 +0800 From: Baoquan He To: Zhen Lei Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Eric Biederman , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, Dave Young , Vivek Goyal , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Jonathan Corbet , linux-doc@vger.kernel.org, Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , John Donnelly , Dave Kleikamp Subject: Re: [PATCH 3/5] arm64: kdump: Remove some redundant checks in map_mem() Message-ID: References: <20220613080932.663-1-thunder.leizhen@huawei.com> <20220613080932.663-4-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220613080932.663-4-thunder.leizhen@huawei.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220620_004312_276692_DDC0FA16 X-CRM114-Status: GOOD ( 23.31 ) 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 06/13/22 at 04:09pm, Zhen Lei wrote: > arm64_memblock_init() > if (!IS_ENABLED(CONFIG_ZONE_DMA/DMA32)) > reserve_crashkernel() > //initialize crashk_res when > //"crashkernel=" is correctly specified > paging_init() > map_mem() > > As shown in the above pseudo code, the crashk_res.end can only be > initialized to non-zero when both "!IS_ENABLED(CONFIG_ZONE_DMA/DMA32)" > and crash_mem_map are true. So some checks in map_mem() can be adjusted > or optimized. LGTM, Acked-by: Baoquan He > > Signed-off-by: Zhen Lei > --- > arch/arm64/mm/mmu.c | 25 +++++++++++-------------- > 1 file changed, 11 insertions(+), 14 deletions(-) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 626ec32873c6c36..6028a5757e4eae2 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -529,12 +529,12 @@ static void __init map_mem(pgd_t *pgdp) > > #ifdef CONFIG_KEXEC_CORE > if (crash_mem_map) { > - if (IS_ENABLED(CONFIG_ZONE_DMA) || > - IS_ENABLED(CONFIG_ZONE_DMA32)) > - flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; > - else if (crashk_res.end) > + if (crashk_res.end) > memblock_mark_nomap(crashk_res.start, > resource_size(&crashk_res)); > + else if (IS_ENABLED(CONFIG_ZONE_DMA) || > + IS_ENABLED(CONFIG_ZONE_DMA32)) > + flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; > } > #endif > > @@ -571,16 +571,13 @@ static void __init map_mem(pgd_t *pgdp) > * through /sys/kernel/kexec_crash_size interface. > */ > #ifdef CONFIG_KEXEC_CORE > - if (crash_mem_map && > - !IS_ENABLED(CONFIG_ZONE_DMA) && !IS_ENABLED(CONFIG_ZONE_DMA32)) { > - if (crashk_res.end) { > - __map_memblock(pgdp, crashk_res.start, > - crashk_res.end + 1, > - PAGE_KERNEL, > - NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS); > - memblock_clear_nomap(crashk_res.start, > - resource_size(&crashk_res)); > - } > + if (crashk_res.end) { > + __map_memblock(pgdp, crashk_res.start, > + crashk_res.end + 1, > + PAGE_KERNEL, > + NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS); > + memblock_clear_nomap(crashk_res.start, > + resource_size(&crashk_res)); > } > #endif > } > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel