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 X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0DF9C433E9 for ; Wed, 27 Jan 2021 06:03:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA5952071C for ; Wed, 27 Jan 2021 06:03:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234996AbhA0GD3 (ORCPT ); Wed, 27 Jan 2021 01:03:29 -0500 Received: from foss.arm.com ([217.140.110.172]:46828 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237105AbhA0DrR (ORCPT ); Tue, 26 Jan 2021 22:47:17 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 32EF0139F; Tue, 26 Jan 2021 19:46:26 -0800 (PST) Received: from [192.168.0.130] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3105B3F66B; Tue, 26 Jan 2021 19:46:21 -0800 (PST) Subject: Re: [RFC 1/2] arm64/mm: Fix pfn_valid() for ZONE_DEVICE based memory To: Mike Rapoport Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, ardb@kernel.org, Mark Rutland , James Morse , Robin Murphy , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Dan Williams , David Hildenbrand References: <1608621144-4001-1-git-send-email-anshuman.khandual@arm.com> <1608621144-4001-2-git-send-email-anshuman.khandual@arm.com> <20210125073102.GF7648@linux.ibm.com> From: Anshuman Khandual Message-ID: <42e9d8cc-ea8a-7a95-c3d4-232cd362547b@arm.com> Date: Wed, 27 Jan 2021 09:16:42 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210125073102.GF7648@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/25/21 1:01 PM, Mike Rapoport wrote: > On Mon, Jan 25, 2021 at 11:52:32AM +0530, Anshuman Khandual wrote: >> >> On 12/22/20 12:42 PM, Anshuman Khandual wrote: >>> pfn_valid() asserts that there is a memblock entry for a given pfn without >>> MEMBLOCK_NOMAP flag being set. The problem with ZONE_DEVICE based memory is >>> that they do not have memblock entries. Hence memblock_is_map_memory() will >>> invariably fail via memblock_search() for a ZONE_DEVICE based address. This >>> eventually fails pfn_valid() which is wrong. memblock_is_map_memory() needs >>> to be skipped for such memory ranges. As ZONE_DEVICE memory gets hotplugged >>> into the system via memremap_pages() called from a driver, their respective >>> memory sections will not have SECTION_IS_EARLY set. >>> >>> Normal hotplug memory will never have MEMBLOCK_NOMAP set in their memblock >>> regions. Because the flag MEMBLOCK_NOMAP was specifically designed and set >>> for firmware reserved memory regions. memblock_is_map_memory() can just be >>> skipped as its always going to be positive and that will be an optimization >>> for the normal hotplug memory. Like ZONE_DEVIE based memory, all hotplugged >>> normal memory too will not have SECTION_IS_EARLY set for their sections. >>> >>> Skipping memblock_is_map_memory() for all non early memory sections would >>> fix pfn_valid() problem for ZONE_DEVICE based memory and also improve its >>> performance for normal hotplug memory as well. >>> >>> Cc: Catalin Marinas >>> Cc: Will Deacon >>> Cc: Ard Biesheuvel >>> Cc: Robin Murphy >>> Cc: linux-arm-kernel@lists.infradead.org >>> Cc: linux-kernel@vger.kernel.org >>> Fixes: 73b20c84d42d ("arm64: mm: implement pte_devmap support") >>> Signed-off-by: Anshuman Khandual >> >> Hello David/Mike, >> >> Given that we would need to rework early sections, memblock semantics via a >> new config i.e EARLY_SECTION_MEMMAP_HOLES and also some possible changes to >> ARCH_KEEP_MEMBLOCK and HAVE_ARCH_PFN_VALID, wondering if these patches here >> which fixes a problem (and improves performance) can be merged first. After >> that, I could start working on the proposed rework. Could you please let me >> know your thoughts on this. Thank you. > > I didn't object to these patches, I think they are fine. > I agree that we can look into update of arm64's pfn_valid(), maybe right > after decrease of section size lands in. Sure, will drop the RFC tag and prepare these patches. 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 X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30A74C433DB for ; Wed, 27 Jan 2021 03:48:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6F08206B5 for ; Wed, 27 Jan 2021 03:48:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6F08206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ATvMcg42ByAUwB1XvB18PpJyLcpOs8UBl52gkYV/8jc=; b=PKtBc+Y8YshS+fNDYJTG0PHpa xW/Z8AiGbksOV4QN2568EEN8WHACCXAnaymzEUl2g0D1UQN+VvLknvEckVQ4PDFkZDcJWf1HvRi1a srPYLmwDCCKnlTL8TAAlVmCi7LpZ3vwSdq0WMiMxaIStzaT18iCjtUpYoGVX5FDxWQUqqir51gd8D YLZ6NrofiIRcUyoDJVteW4jel99njY8QyUrLWLTh3ZL4LCYj0BaTXQsUZeejvcHyqWGTZ5GGJon4i y1HSD4jQq/vSAnmN/SOh37hvhfyydEscdhv96TOC18M+3GAtFy1MtsR6BvWK23nNnWcIbDrXqrwVi GVFk3NLmA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4bmr-0007dT-HJ; Wed, 27 Jan 2021 03:46:33 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l4bmp-0007cw-O6 for linux-arm-kernel@lists.infradead.org; Wed, 27 Jan 2021 03:46:32 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 32EF0139F; Tue, 26 Jan 2021 19:46:26 -0800 (PST) Received: from [192.168.0.130] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3105B3F66B; Tue, 26 Jan 2021 19:46:21 -0800 (PST) Subject: Re: [RFC 1/2] arm64/mm: Fix pfn_valid() for ZONE_DEVICE based memory To: Mike Rapoport References: <1608621144-4001-1-git-send-email-anshuman.khandual@arm.com> <1608621144-4001-2-git-send-email-anshuman.khandual@arm.com> <20210125073102.GF7648@linux.ibm.com> From: Anshuman Khandual Message-ID: <42e9d8cc-ea8a-7a95-c3d4-232cd362547b@arm.com> Date: Wed, 27 Jan 2021 09:16:42 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210125073102.GF7648@linux.ibm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210126_224631_884554_3C32118D X-CRM114-Status: GOOD ( 18.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , David Hildenbrand , catalin.marinas@arm.com, linux-kernel@vger.kernel.org, =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , James Morse , Dan Williams , will@kernel.org, ardb@kernel.org, linux-arm-kernel@lists.infradead.org, Robin Murphy 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 1/25/21 1:01 PM, Mike Rapoport wrote: > On Mon, Jan 25, 2021 at 11:52:32AM +0530, Anshuman Khandual wrote: >> >> On 12/22/20 12:42 PM, Anshuman Khandual wrote: >>> pfn_valid() asserts that there is a memblock entry for a given pfn without >>> MEMBLOCK_NOMAP flag being set. The problem with ZONE_DEVICE based memory is >>> that they do not have memblock entries. Hence memblock_is_map_memory() will >>> invariably fail via memblock_search() for a ZONE_DEVICE based address. This >>> eventually fails pfn_valid() which is wrong. memblock_is_map_memory() needs >>> to be skipped for such memory ranges. As ZONE_DEVICE memory gets hotplugged >>> into the system via memremap_pages() called from a driver, their respective >>> memory sections will not have SECTION_IS_EARLY set. >>> >>> Normal hotplug memory will never have MEMBLOCK_NOMAP set in their memblock >>> regions. Because the flag MEMBLOCK_NOMAP was specifically designed and set >>> for firmware reserved memory regions. memblock_is_map_memory() can just be >>> skipped as its always going to be positive and that will be an optimization >>> for the normal hotplug memory. Like ZONE_DEVIE based memory, all hotplugged >>> normal memory too will not have SECTION_IS_EARLY set for their sections. >>> >>> Skipping memblock_is_map_memory() for all non early memory sections would >>> fix pfn_valid() problem for ZONE_DEVICE based memory and also improve its >>> performance for normal hotplug memory as well. >>> >>> Cc: Catalin Marinas >>> Cc: Will Deacon >>> Cc: Ard Biesheuvel >>> Cc: Robin Murphy >>> Cc: linux-arm-kernel@lists.infradead.org >>> Cc: linux-kernel@vger.kernel.org >>> Fixes: 73b20c84d42d ("arm64: mm: implement pte_devmap support") >>> Signed-off-by: Anshuman Khandual >> >> Hello David/Mike, >> >> Given that we would need to rework early sections, memblock semantics via a >> new config i.e EARLY_SECTION_MEMMAP_HOLES and also some possible changes to >> ARCH_KEEP_MEMBLOCK and HAVE_ARCH_PFN_VALID, wondering if these patches here >> which fixes a problem (and improves performance) can be merged first. After >> that, I could start working on the proposed rework. Could you please let me >> know your thoughts on this. Thank you. > > I didn't object to these patches, I think they are fine. > I agree that we can look into update of arm64's pfn_valid(), maybe right > after decrease of section size lands in. Sure, will drop the RFC tag and prepare these patches. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel