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 D4E2EC433F5 for ; Tue, 8 Feb 2022 01:45:02 +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=cREqHUK8Lihxr8O4Mu7rzJw2sZ46Zx7KVSaiBj2VfWA=; b=YlOmqHZElz+Mx3 RQJLvDAp0+S5k1Yd3CMRmGA0oo5+ouCwrdG9wUv2uuAr5BBW/61zDUm0sGxRMNThum9576QIxNdHc ov97ZUejSasDziMQJykntYf8OzYNTTibO6XSSAIDc64rRWTCAvxNUUCimh8UiuBU4GDjm90hinESP omLGTYfgzF1u0KCcHCvkLPKqhsKWv9uXvkXP7HxDDukyUOPLFKcT3SqfanFdScbardP1PPD8BGsi3 zcZWlZ7N9FzrZGvKQnalMsKfC2OlTerY4nq1i+1bKSN1qmfB6Er6bKQSVdaQK9sy35XAViq00RzrW XXqaI6mBoReQwlWmIvgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHFXs-00CDBf-Qz; Tue, 08 Feb 2022 01:43:53 +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 1nHFXp-00CDAm-55 for linux-arm-kernel@lists.infradead.org; Tue, 08 Feb 2022 01:43:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644284627; 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=gMDvDoEbO/rD1x32YWplF1Fz9lP4H196sTYmBtGIooA=; b=YgQLKQ5WjjCqAfHns21KJgdK8Kxt5d/AUQeUgA7OugM5uZloNzekoetT1LgHO3AYFSYBVf pCFbdANoVlBg+egO9QtpsqjtkhucFFCB3+IsKmOKLPhfdH1tFxQjTp9C6iSHvItTSv8bfV Dbub6W1nBdK13I+TdthKKabqWiE9RWs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-DRUqT-IqMT6jLWYXW_CfFg-1; Mon, 07 Feb 2022 20:43:44 -0500 X-MC-Unique: DRUqT-IqMT6jLWYXW_CfFg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5587C64140; Tue, 8 Feb 2022 01:43:40 +0000 (UTC) Received: from localhost (ovpn-12-95.pek2.redhat.com [10.72.12.95]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 650F65F707; Tue, 8 Feb 2022 01:43:10 +0000 (UTC) Date: Tue, 8 Feb 2022 09:43:07 +0800 From: Baoquan He To: Zhen Lei Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , linux-kernel@vger.kernel.org, Dave Young , Vivek Goyal , Eric Biederman , kexec@lists.infradead.org, Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, Rob Herring , Frank Rowand , devicetree@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , John Donnelly , Dave Kleikamp Subject: Re: [PATCH v20 1/5] arm64: Use insert_resource() to simplify code Message-ID: References: <20220124084708.683-1-thunder.leizhen@huawei.com> <20220124084708.683-2-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220124084708.683-2-thunder.leizhen@huawei.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220207_174349_295724_FA250E50 X-CRM114-Status: GOOD ( 22.74 ) 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 01/24/22 at 04:47pm, Zhen Lei wrote: > insert_resource() traverses the subtree layer by layer from the root node > until a proper location is found. Compared with request_resource(), the > parent node does not need to be determined in advance. > > In addition, move the insertion of node 'crashk_res' into function > reserve_crashkernel() to make the associated code close together. This is nice cleanup. Acked-by: Baoquan He > > Signed-off-by: Zhen Lei > --- > arch/arm64/kernel/setup.c | 17 +++-------------- > arch/arm64/mm/init.c | 1 + > 2 files changed, 4 insertions(+), 14 deletions(-) > > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c > index f70573928f1bff0..a81efcc359e4e78 100644 > --- a/arch/arm64/kernel/setup.c > +++ b/arch/arm64/kernel/setup.c > @@ -225,6 +225,8 @@ static void __init request_standard_resources(void) > kernel_code.end = __pa_symbol(__init_begin - 1); > kernel_data.start = __pa_symbol(_sdata); > kernel_data.end = __pa_symbol(_end - 1); > + insert_resource(&iomem_resource, &kernel_code); > + insert_resource(&iomem_resource, &kernel_data); > > num_standard_resources = memblock.memory.cnt; > res_size = num_standard_resources * sizeof(*standard_resources); > @@ -246,20 +248,7 @@ static void __init request_standard_resources(void) > res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1; > } > > - request_resource(&iomem_resource, res); > - > - if (kernel_code.start >= res->start && > - kernel_code.end <= res->end) > - request_resource(res, &kernel_code); > - if (kernel_data.start >= res->start && > - kernel_data.end <= res->end) > - request_resource(res, &kernel_data); > -#ifdef CONFIG_KEXEC_CORE > - /* Userspace will find "Crash kernel" region in /proc/iomem. */ > - if (crashk_res.end && crashk_res.start >= res->start && > - crashk_res.end <= res->end) > - request_resource(res, &crashk_res); > -#endif > + insert_resource(&iomem_resource, res); > } > } > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > index db63cc885771a52..90f276d46b93bc6 100644 > --- a/arch/arm64/mm/init.c > +++ b/arch/arm64/mm/init.c > @@ -109,6 +109,7 @@ static void __init reserve_crashkernel(void) > kmemleak_ignore_phys(crash_base); > crashk_res.start = crash_base; > crashk_res.end = crash_base + crash_size - 1; > + insert_resource(&iomem_resource, &crashk_res); > } > #else > static void __init reserve_crashkernel(void) > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel