Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751287AbcKQQ6I (ORCPT ); Thu, 17 Nov 2016 11:58:08 -0500 Received: from mail-by2nam03on0083.outbound.protection.outlook.com ([104.47.42.83]:20138 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752037AbcKQQ4w (ORCPT ); Thu, 17 Nov 2016 11:56:52 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; Date: Thu, 17 Nov 2016 16:18:05 +0100 From: Robert Richter To: Will Deacon CC: Robert Richter , Mark Rutland , "Ard Biesheuvel" , Catalin Marinas , David Daney , Hanjun Guo , "linux-arm-kernel@lists.infradead.org" , "linux-efi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] arm64: mm: Fix memmap to be initialized for the entire section Message-ID: <20161117151805.GJ2151@rric.localdomain> References: <1475747527-32387-1-git-send-email-rrichter@cavium.com> <20161006161114.GH22012@rric.localdomain> <20161017185801.GT25086@rric.localdomain> <20161027160136.GD24290@arm.com> <20161028091905.GM22012@rric.localdomain> <20161107210514.GP20591@arm.com> <20161109195132.GZ22012@rric.localdomain> <20161117142528.GJ22855@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161117142528.GJ22855@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [92.229.80.42] X-ClientProxiedBy: VI1PR06CA0005.eurprd06.prod.outlook.com (10.162.116.143) To BL2PR07MB2338.namprd07.prod.outlook.com (10.167.101.16) X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;2:QW0ExkVAuWHiSt5DLkFdorbuVNe2qvooxOQmSIBIxaDh5/SiCwXTNPwx96JP1hoe6Cr4THxWL5Jt4KPhJXvL6F7jekzPYRE/ojMKEIQYdIVtRY6nyLfOtPr2rz3Zg46bSnTDaRxdg2LxRcpgx3BHAMol60dx8bzE0mJRuMeYp7c=;3:Rv45vtfECrQVCA7qZWcbNmyW4n7MhUcx9ZX60DZCx09mjLT4/M4zUEeG5vlhoTu/FeMnK5jlGWDb4nZZP0gVkgsFWO697+UBTPLF9oDaNBqsDZJlHlqa9Us4Z4PjYtzWtJmDiP9j+e9xgWSx3KMF/M5PDlBg0iSiLugEPwAqC5Q= X-MS-Office365-Filtering-Correlation-Id: a3cce394-bdc0-4a17-62f6-08d40efcf644 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BL2PR07MB2338; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;25:77T8yNh3I5FTdIbFmdMXMDuwCmnHWAlTKtj5KL3iA8LqPcPx0+R6ukS3Yqaw1LlJs1IT9Ilb6amzAwu4JIeb1Uc2O+/f59a//6/hp5GZ5IkKKIlBm8rEx7OKBG0bNphoQmUzbPvQwLgLUeIzijdEFtytenWEfICP6fwek7TJEfXyrFgde60vMxqUHKYjq/Opdi5y1ICWMjB6HyDnV9N6qxAUqQQzgJTwSjXIkb4zOZyrWgm8+x3YTFClieYVgrinbGxbMzUOAzLVMZVzE/zc8XmiHPYtPASioC0s5TJ2ZKMsR+dmmmOfOn8vIeatROarRylqCVV6XqhWvwtQATH3AeH0oAiI01bJd/Kds/IXt6bMlHWwzxHqu01yVcDnYI6Z+9gE/JWHly/e74606lOzLRI3O6uEtjWzISkMky+0ERIfPyMRg168wgLq/hVvl78mD44vAPXZqVD3+v0HmjBlJ/KDqvhDn/N/cel/Sl8gaJQrLAUZPRum5GK9q0VGMzhBlYbPp6AZ5aaMTB5MPLUImuDTUEJFxQZEi7iBCnfU5wWDXxZPof9My2UJ665OH4Nq0GBYg0xU5BuVVKlskF0vVA3U3MDbMDzzy1iCi0d9sZaM8IGEjVt2S/tup11j9u8cz9Ep67t7caX442eW1IhyyRN8mTgdpkA+I1G8Q54u4b6M2wh9Ef+vXzQLjghqSjU7qjvfIFnKqElLkVMbgkBEcpx4sQaKAGnddWTrzGAMf7zafzqEF26CUDqMxn1zhzrm1N5OTzwOFLraCvc65KElFQ== X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;31:QwVQvE3MnK0jAGUY5aGfHot8qoDSgGB6GmC7VBPjQd5JlgugBafy2sHa5/zX7IrEQuxg6MLNDQJswXG9nXq/05ORl6Yf09TErRkpg13XpFG6zJ28YruDj1QPuuUb/VJ2QQmkf01JaB3x3yV8iZE0As6brejuA/vj8FezhV4cN3g/pgm140dn7zZlcJHR+VBc454w2HwAN0LfKSPmAKe6iPQ9AeFYEls3yjJsg7AKY7Yr9PgzZwRKkwde5DaCdrlRPFkXOm+tJcaSynuxjkCJQA==;20:pu+uT+ddwntbJsT1awOD+kQa4db0CEioSWtrmhmvOxX2LqY8afBIFU+ma0vOIWRvrjYjoJyf4opX5k9WXFAYRyaDq6wkDO/4vvls6RPNeMsc/RrlcfvX6aoeBmdkWlJLCXDAodd8Yr5mFmxeipA7xEbc5z5MaMU2djbdtsKsHXLDyMoSE8MRHsEbrDqaDRBLfpPWlEWqesO0YJXI7jliUgk1m9EDRS9RFmc0Yftkfei3uq3vfvHdsBO/4++PzpglxuXu0r1lDIcg9S8vJqvTo0hk99lmhZlP1u6io//8UYXX3NgTBen4vFPwlj/iXH4w0pOOatgERiy83bSNWNGdZU6opD6AF09DFrg9ykFWHzz5amuHK3Xp5SSyy7wEum7zXpSag8Bo2svCqQJb3f8zuDZldzMk3fEQvjkcXJGGHpjOQBzpEr89lPw0Lf673zxUpZLpiz1islpKuonWPtXjY6LJZVyRJxoGZ4Rtfe7qi4JdqDhLvb+SGaXVrVMvK5dv X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040281)(6060326)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6061324)(6041223);SRVR:BL2PR07MB2338;BCL:0;PCL:0;RULEID:;SRVR:BL2PR07MB2338; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;4:ask8ZqPJoKRdtEKUDh7Y4g9lom2dojpC0SgKadX2Y+qpFrAVUCgjeHQBV0Qq4SAPiIQ+WfIM70O7d7SsEtTAZ5Ssjc2OLNfJqYWDXrWlkyVLMVl1qKIidTRxUFrmgYwiuSclAEVHEL1tWEiat/IigqeHIQ5bj10KLaU0W5Azc1yUhfGx2rAOMfPRzuiLU2rBp7NoZ90QEt4WEvL0WRwhhWlDCowetbyWjVaGbVvX0DUZ/lBbC/lESOQt6sF+YCpkHCyUnGrYpqsoiAt4m3MfOxKCiRPopr2XBWIMYDHVIY7VzlsV2tCDBn/nwdwIyvwplF+7SsnRs7dy4Zu/7DxjAwkmtbe56IGXL8i1J/LTrQCfXYZJYuY5qtoLIyE7FqX7WpRR0eK/GoHZ+anIZmmPGsmOh53ldMJ0QMEzImC789fvyzAYuaTdC3N973Z5UERibP8qmBsy7YvHyj0bPQVaTw== X-Forefront-PRVS: 01294F875B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(24454002)(189002)(4001350100001)(47776003)(105586002)(6116002)(189998001)(92566002)(83506001)(97736004)(4326007)(50466002)(8676002)(46406003)(2906002)(66066001)(1076002)(3846002)(23726003)(7736002)(68736007)(106356001)(305945005)(42186005)(7846002)(110136003)(77096005)(101416001)(81166006)(81156014)(33656002)(6666003)(2950100002)(6916009)(86362001)(93886004)(5660300001)(76176999)(97756001)(9686002)(50986999)(54356999)(229853002)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2PR07MB2338;H:rric.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BL2PR07MB2338;23:315eyRw+ob7pzp8kefTt0Awwa2ZEQ2Rjb9EJxrDSs?= =?us-ascii?Q?EsnL94mNyQru5Sy+LJBJ//DSJlrIjXf3YSYKBx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PR07MB2338;7:3/gIvVJa0BhhEGt00neGFhrwtki62/l1QebmgFtXKnbUggsLzqFnEkp3/eQWfq8BUcz6JnyQtKPcQezYO6mYplM2jgCQNg96OjfJMez0P+SOuinwpm4qdHC2l2dlkgpraL7NLnqbcPI4h8EWO54kQ84lIIsJnugUvOfTk9y9LGHK2s/cWz5Se4X5w6u8fluAyFE2P2LpxCBWNXpIJs1O7aycmqAVE7siwr/hIT0btlxu8/49HAtyWklszTECKprz4CZJygE4dcyp8XSFSc1bTuUB9681wlv77dASkts6QdEgpgrYEKqyrmYsan/crSBeYgVXfhfPTvJXaGl9zyY07lfi3SOn3qyIrAF+Jney5zU= X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2016 15:18:17.4182 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2338 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1599 Lines: 36 Thanks for your answer. On 17.11.16 14:25:29, Will Deacon wrote: > On Wed, Nov 09, 2016 at 08:51:32PM +0100, Robert Richter wrote: > > Thus, I don't see where my patch breaks code. Even acpi_os_ioremap() > > keeps the same behaviour as before since it still uses memblock_is_ > > memory(). Could you more describe your concerns why do you think this > > patch breaks the kernel and moves the problem somewhere else? I > > believe it fixes the problem at all. > > acpi_os_ioremap always ends up in __ioremap_caller, regardless of > memblock_is_memory(). __ioremap_caller then fails if pfn_valid is true. But that's the reason my patch changed the code to use memblock_is_ map_memory() instead. I was looking into the users of pfn_valid() esp. in arm64 code and changed it where required. This week I looked into the kernel again for code that might break by a pfn_valid() change. I found try_ram_remap() in memremap.c that has changed behaviour now, but this is explicit for MEMREMAP_WB, so it should be fine. Maybe it might be better to use page_is_ram() in addition to pfn_valid() where necessary. This should work now after commit: e7cd190385d1 arm64: mark reserved memblock regions explicitly in iomem I still think pfn_valid() is not the correct use to determine the mem attributes for mappings, there are further checks required. The risk of breaking something with my patch is small and limited only to the mapping of efi reserved regions (which is the state of 4.4). If something breaks anyway it can easily be fixed by adding more checks to pfn_valid() as suggested above. -Robert