Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965628AbcKXNwR (ORCPT ); Thu, 24 Nov 2016 08:52:17 -0500 Received: from mail-sn1nam02on0040.outbound.protection.outlook.com ([104.47.36.40]:41050 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S938991AbcKXNwP (ORCPT ); Thu, 24 Nov 2016 08:52:15 -0500 X-Greylist: delayed 58907 seconds by postgrey-1.27 at vger.kernel.org; Thu, 24 Nov 2016 08:52:14 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; Date: Thu, 24 Nov 2016 14:51:51 +0100 From: Robert Richter To: Ard Biesheuvel CC: Will Deacon , Robert Richter , Mark Rutland , 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: <20161124135151.GJ10776@rric.localdomain> References: <20161028091905.GM22012@rric.localdomain> <20161107210514.GP20591@arm.com> <20161109195132.GZ22012@rric.localdomain> <20161117142528.GJ22855@arm.com> <20161117151805.GJ2151@rric.localdomain> <20161123211538.GH10776@rric.localdomain> <20161124134238.GI10776@rric.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [92.229.88.216] X-ClientProxiedBy: VI1PR07CA0117.eurprd07.prod.outlook.com (10.165.229.171) To BY2PR07MB2344.namprd07.prod.outlook.com (10.166.114.146) X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB2344;2:OTv7ofkY6CEK2+NZRMVwcHFgMtfWUj7anIJ9UEDyhZwqAr2jVLfC0fSb6kTEhiw14j47+fXL9AZGronaIq1jXmvp9FmjYWo4j4L2yQ8UgteTkTEz0mu2OWZAr7mscaP7cs8QASgcdKfFPB1/1tXAD1jGoUvAvBpCW2IC9SZlbok=;3:/To6E23DAmUmikOim08GdiiheO+SAMt6xmuMZmUxU5ibRwBRJDkalQ3hpjxnDGR/EmniuR7k+QLmlv+0Ksrqe9HuTbyUjEDi0eQ+v5xoeqDnzJRKnTuRJikcj0/KDMhv6D1pk5QFw0Y30iTaYoX7dYfGj9aS2sqmx/AwhhBctpE=;25:8j5Deg8qtAqEcnd4PackhEuvSBI1Tacdh6x7lrMo7OcgEWBRS+RAXgYLTNmZMisVdIpan9TeIgNlwu9A97kXePWQREYD1TqZJ+k5GJ0mohS2CLuaPfQ/mCxo8sv0gURFRbE6zAdmru97wnS5Imyby85d91XaF8vnd/eyKniwZvFbGG9aCB4WkCKgQTWVxqLwmchhCPHCwSHTCORVYPrB4R21fMQK2ht5paHaAkazWQlIU5U5N6WwFQkKvCrQSufk9DOrUxSpd2qilsQYdlLSeqqFXTP4oUOBq1pznqw6U2VhyQKMyHOyKOkIBjGiJNhBKy7vGQqeW1JyPBuT/A+zhMqeOvbTAUgEAYmqlKGT1Q9hh7UMIaRwynEIdxRp7Jb4f+UfFFht4V4Hl6jr5PBOtG+jmdjDtcz/OecqMxxR0bodvf9rqbNMHCWoT9d7ZQ02LeJViIx3MsLwAGxC3hXQsw== X-MS-Office365-Filtering-Correlation-Id: d45aef6b-a4d7-4c2e-f9e5-08d4147116fc X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BY2PR07MB2344; X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB2344;31:eObJvjkyFrCQCMRjKGXnB6Ty4LpIsqFNl+BP8xI5i5eIO0svX5WJXlsQPmrhORjz6ooagQrBILj1k6RGLGyk/Yl3r41tsEzDb0ebkHz8hDB8Q3Yy7+V196zfkBcIYyOtnFssXwTvBfBVU8UN7xzEZn9YZaaCc5O8n4dNi6LWI5WTgZuGAN+rBUu/PEqHTg545ZOYv8uydfm3LQnqMVc/RqwVLUhLpqLQPXaQPZoHo82eAxkBDCpQsq7FFrQSK97SeHGeG0hKwlacvY8+Bu1oYc45AlboL249IT0kID2x3C87TCqCXknauXHlOQjqGW+k;20:B4EiwAHGFEAlcsDh582gSQglsPs1XUAzXwHmVSLDp3dCtYGREGIO0VKccgaVLvdYh0VQJRp5dfOvYTFGxch5nYK3Q1GoUj3/shysn72As6sMP0B1RkAV0WkwY5ofWyDMoBR2M0d3KOAUI1jSjcvo3W2QqriueDsqFXax3qVukYrl8NFAk1VfosKCB9YiZLbOuG0rfw4OAaS24asoUs0jnk5nznK7qiQwRxKOiKBIcxMKfDFqcW+F3t79zC/jiM+RUqbGX5u0VojxUq23tWU7i2QQQq7II8SyKC1udtc1bSN68HiMDjKADqKTOdVQU/DubLgOetzDnN3LcfxXYJaWw2zavL6H2ydtAlH+mgSDY6r5U+MdetsVo9NggBrnEQgvtek4HkMqBeEf9dQuPaLq/kFq2m1VprXVuhi1Fvt3F/pT17KEi0Zqps4b2PG3bkE+mh89FLoAps8KaUtmdwoiC5UZiu8qKO1bc8buZdYmefayF5KFpJr/VgIafR19Yuw1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(6045199)(6040361)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(6061324)(20161123555025)(20161123564025)(20161123560025)(20161123562025)(6072148);SRVR:BY2PR07MB2344;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB2344; X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB2344;4:ecjAMcZfEzFNBpaJz3ncwWqoFYVMdbPGpgQO+jVvEO6AjZB9f1+OULfcczWMGyU8aKggmh6EEIe+fBWFbHXwkrzJWYDKqc8zFnzABHHK/TeAnTylBTueCcoQ7WQYLkp2tJ0XtxgkQYM4tWPap07unNd2e9lf7CU2iIbppz5iGtdmOrAT1Bu5cAgdYeDN0ciV+1K0pkwkn+jJk/EDNOb3vTiaqnM4SAZGTEkk/vQmTt0LkYUDgmKywBQ9XF4QLcF8+dLhxsqO85CTWOf/k/Ld4N2qAqUgNRVFq9FXkP5ttVpUMBEBb5+S6a2CGggrqGnrvTtf7sEjFltwoLYC73y0Uz+nfnAqv6trgHYSUhikGDPeiT4QyqtO0VqBxcc5a2VmcHMUF7gdeLYXfyVBm+Cl/+RExbykP5ty0Cf0xL6gehyx/WaScmYLngRz4+d1hyK8/cE+ASE/y94C1fHfNNuyBwY1XmX2huZ9SLk5XChiuIHF3fUzzzIttForGaJbcdklJdaf5Z8B9H9OaWEO0uj0EHSIgEaXnbDf+zIkOGFRC+2FuBFPX+cDsHMWmNYKyRVzdTNp4GJi6CxlUD9vCkctIW+BgjJLNTyiuCZNsuA4OEujU+Q9ml3pWsx9jwFTGCsk X-Forefront-PRVS: 0136C1DDA4 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(24454002)(39380400001)(39410400001)(81156014)(7846002)(92566002)(229853002)(47776003)(38730400001)(83506001)(68736007)(9686002)(66066001)(97736004)(81166006)(3846002)(4001350100001)(189998001)(8676002)(86362001)(77096005)(33656002)(106356001)(7736002)(42186005)(6116002)(97756001)(305945005)(105586002)(4326007)(46406003)(110136003)(23726003)(2906002)(1076002)(5660300001)(54356999)(50986999)(6916009)(101416001)(2950100002)(93886004)(50466002)(76176999)(6666003)(39400400001)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR07MB2344;H:rric.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR07MB2344;23:kEL/jKi9F4d+c84YbJkAboiehRBFgSeaPMtZTl8r+?= =?us-ascii?Q?iOComA+rzgA0xViaa+KUvClHeiA5Py13NH10rtwPrxYRh60norMGoWVShfSf?= =?us-ascii?Q?Cyhj/8IGiiHHP3LIBD1q1WkSxsW3rrhCXlScb/qiL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zPiKFBYf97eOYh68P8VddFAYh+vOtND3aV+sphtHVBLtcgbZlbrFZ7?= =?us-ascii?Q?o7K8YXfUoY5oUy5iEe7W4LRVLGDlOKoA5US5S2vx9zSG8BYByG0jBjSpxWv1?= =?us-ascii?Q?El8yf3GvCWI8R9B+bwItQhvucu7lpaLShXfPK3QB7CiW6h/h9fr96ewpTs93?= =?us-ascii?Q?d2hCLJ14mJaHS1pnFQZiQBCJM8UtjZWmIz/K70pwNg6NJQqzTrZ1oA6aLY+l?= =?us-ascii?Q?fwkcj39QOdwLhsJY260gq75YbKBV90jJMMrk1LLVmz4Lf3mHxuw6YGyCdueO?= =?us-ascii?B?dz09?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB2344;6:j8eJgzewqfVjsjT4qqAo91mhe8/JGR/EpPfaTpZkWD+utF9De+avo2lRpE+liFDnVnWx2tu8YsfMNvcmqUK7bVO+JdmrDXhIuU6Zpe+cb86WhDCcgeXIP8f2Vlliee+vo9JtEVsZx1V/cK5p/cZSbPkrLINyC3VDsjgT/EgU/9M/86ZxfMokQJnJTbji0ssKhljGdWE7hRD85kNp3IojSJPwvtSFocu1a4e57i+S1kyePvnSyjs0phZxFe7PvEafT2hxoDW9jK+KTKn2e8SAz/KzuT4j/56u1RWgPHbbMMYn90x7DFUSX3ihYpisS5yBgslVl+pB48pXY2wFFDUtAPUsuBdQJZCknOFprawZXno=;5:B+LUXFO/OW0cK31IlK8Ye/CvdxtAjfJUWoQTbzIsLfsw/W/+yRhgl51SX0CWoe/xGj/0IyqrhYeF2uuWuJcRwuVDgiYhekTQRdkKijK905ZGLKiX643cvSwQY65U1nE4O2KwZaR6P7Q+D7jjNmWTtxkoDOPs3QgVuj1h+PNJPys=;24:3QAQbzmseaMxt4z5JBc3q6x/lLjl3Z4TmsneQbFbnd2HWDucoaIyp0Jq8c0TBQqMbO5xULetH9vl3jJjQQIS/gRZ/LYDgtPgSMHYdiviwcE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB2344;7:ZKUXL6IeaobpA2N3Bglc1a2ItC4d4mCkPIWV7JqGYUL1FZ5VSbIBOD7NC3w2QkZYQkg3USwIdI0NKBv1fGj1JdUdGRwC7y3geXQt22nb9ibaRc98qH+KFVyLJXeH8BNZ8qO6zETQWD36LgE8AdjY80vGxjgvSr56NNVFgYRGnTzsvGuH4s+bA+QyuK5cASFrUwbR9+q317gl3uM2pkZWquCt8h0cmySnVlZwG1F6fdaVLOhGUvz9ftDY1AL0raKljySHgKLtKprEXLUticF/jaQuoLe0HBv+XlqLX2eWUpEKCYI6wToI4xYFyuo3icPKFenegrkLNDr85d5Yy5AQXuYS5p1iLTxO2Jz8jjue1K0= X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2016 13:52:09.0820 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB2344 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2016 Lines: 47 On 24.11.16 13:44:31, Ard Biesheuvel wrote: > On 24 November 2016 at 13:42, Robert Richter wrote: > > On 23.11.16 21:25:06, Ard Biesheuvel wrote: > >> Why? MEMREMAP_WB is used often, among other things for mapping > >> firmware tables, which are marked as NOMAP, so in these cases, the > >> linear address is not mapped. > > > > If fw tables are mapped wb, that is wrong and needs a separate fix. > > > > Why is that wrong? The whole issue with mapping acpi tables is not marking them cachable, what wb does. Otherwise we could just use linear mapping for those mem ranges. > >> > If you think pfn_valid() is wrong here, I am happy to send a patch > >> > that fixes this by using page_is_ram(). In any case, the worst case > >> > that may happen is to behave the same as v4.4, we might fix then the > >> > wrong use of pfn_valid() where it is not correctly used to check for > >> > ram. > >> > > >> > >> page_is_ram() uses string comparisons to look for regions called > >> 'System RAM'. Is that something we can tolerate for each pfn_valid() > >> calll? > >> > >> Perhaps the solution is to reimplement page_is_ram() for arm64 using > >> memblock_is_memory() instead, But that still means we need to modify > >> the generic memremap() code first to switch to it before changing the > >> arm64 implementation of pfn_valid > > > > No, that's not the solution. pfn_valid() should just check if there is > > a valid struct page, as other archs do. And if there is a mis-use of > > pfn_valid() to check for ram, only that calls should be fixed to use > > page_is_ram(), however this is implemented, or something appropriate. > > But I don't see any problematic code, and if so, I will fix that. > > > > memremap() uses pfn_valid() to decide whether some address is covered > by the linear mapping. If we correct pfn_valid() to adhere to your > definition, we will need to fix memremap() first in any case. As said, will fix that if needed. But I think the caller is wrong then. -Robert