Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2635180iog; Mon, 20 Jun 2022 01:04:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sjLrGltrTvnVlBcwOdh9ZdxxUFiR2pz64Lx2oGIDmRmA3/TNT3mgC/TxDp0xAII6HCL+PE X-Received: by 2002:a17:902:724a:b0:167:9222:2755 with SMTP id c10-20020a170902724a00b0016792222755mr22082011pll.98.1655712261621; Mon, 20 Jun 2022 01:04:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655712261; cv=none; d=google.com; s=arc-20160816; b=XEgPPV54DcCbo9nTL16PtCuEy6QFIHC1BRn+BeD3RPUfzkADkT8tqOWAchAEeoLeWN ugGgbeUfeExp0uC9tZqZe4mz+mHsBk5+nYqZoIQUAfJAznB78F73XKy33Ji8Xg5C0V01 Y7QZ5liZWPijvWg7kBwB9X73H0RkxE83L0Cnse0dWW/jn7wzEAUwoZVSzaRRr9lgpyBF VNw6R/PPd7fQppg2V6+CeuAeLuG2XYdfLMvlnVzvSAM1WqhAueDQwbnpKoY1PqWH7ksa 7xlWKeHHtoa43FrUX663SvszBhhJJQZP/YGdJ1Z1aRDBSiXEjWAiV2cZVoGtcehBGC3k aejQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZUNmq+SKtB8IP20c0SQTXtLsVBfIbeKTb4f/dBL0tMs=; b=MEER1v4ReSmCmzAGYuIh2l3c/mICRT8JD58lrshy4yfHthz6KoK3Mi1bfEXpxSaSpd pmro+5jG9KfulfjDy1PpDQY5WBuiOcHhBcE3uT+H8XyMxvuZixG+bUSplplt87XQ6R3A xzpOdB9UBSUBMc9WEvPYYOJIjzs2laZkaE05aD9BVJVz7/Myvm6YhXM7gV/KIwnUWMep pywGw06f3nYWqsFFWFOuhnBry6opaMM6jTqEZ8odw65+LHkFvxiprTGtIBGje3clMtnl LHC4rxPC567SljkZiDtEIiy2+ynRvBaS3AZcGL/jcUJoRUJtxdn+4E+O+Gpr1yjXXsTP jVDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Oob3RNfE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k189-20020a6384c6000000b003fa2f028fb2si13486698pgd.575.2022.06.20.01.04.09; Mon, 20 Jun 2022 01:04:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Oob3RNfE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239483AbiFTHnT (ORCPT + 99 others); Mon, 20 Jun 2022 03:43:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238584AbiFTHnP (ORCPT ); Mon, 20 Jun 2022 03:43:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5F99A6418 for ; Mon, 20 Jun 2022 00:43:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655710988; 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=Oob3RNfE9CyGj/q7fotZKH9cSguoE5tW+zeg2dhXmNUeAWJNgudyyxnev5nu+djz9bZYXT y/VA+0kJG69OBGU5+bqeqhx5maiXUSJfFRTd8c8TVg5pU+BX9xpqZ9F1tUy2sZ98IYxbS8 2t/LmjDbu2kXM6eJve2W6fVnl79d6fc= 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-Type: text/plain; charset=us-ascii 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-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 >