Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941259AbcKXUBk (ORCPT ); Thu, 24 Nov 2016 15:01:40 -0500 Received: from mail-dm3nam03on0079.outbound.protection.outlook.com ([104.47.41.79]:38016 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934137AbcKXUAx (ORCPT ); Thu, 24 Nov 2016 15:00:53 -0500 X-Greylist: delayed 1046 seconds by postgrey-1.27 at vger.kernel.org; Thu, 24 Nov 2016 15:00:53 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; Date: Thu, 24 Nov 2016 20:26:59 +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: <20161124192659.GH2213@rric.localdomain> References: <20161123211538.GH10776@rric.localdomain> <20161124134238.GI10776@rric.localdomain> <20161124135151.GJ10776@rric.localdomain> <20161124141149.GE2213@rric.localdomain> <20161124150918.GF2213@rric.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161124150918.GF2213@rric.localdomain> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [92.229.88.216] X-ClientProxiedBy: VI1PR07CA0096.eurprd07.prod.outlook.com (10.165.229.150) To SN1PR07MB2349.namprd07.prod.outlook.com (10.169.127.15) X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2349;2:dUNDIVg/ojDU045wzqRIiHi4wtmzOcOKY1rGicME6KU+n3H7FYyVLmzq63eWZbGN54JTNxkbq5ZwNVt2Kjq3i0mOcQMet35wumXBH7X1QehY8VKSh1SzmTAEv+2p2QXvN7CBwbxCyHlUOXn1d9xIx/ZD5fgZut9X0/j2DFP0fI8=;3:yfrSp3KpgNdZLnaRxBS0jgftlO0SOqX+FoeEn73qXQnZIpjtfp3D+aRLyapkjlUG/dDD1TFfy0JqIuRYf2D4DT8Ka0UgImLQtV5ET6feqZvYyA8uf9I985HykQtOaAHleDgeC3cnMxUluE44k8C8Ydqtb3HiGEdFnc1uCoqZu9M=;25:bq1zc8ZdxoikRUIi0SFIIH2BnyDZTBeEETUS/KHB7yhkGoUpo4i3SlQ0XmwW9FaeHicNqTIL2qc+UUYlwPGmAsudE5nM5eNDGGp0aInuyKM6/vG7tRjFUXWyaPCMm4peOqujxDkzmAqalBvNRMFPUgGlzyxkb69hXKExlr9l/7YeDSRJvBPebFTacN6+BQZY6OjtD8DAaPW0wEKIpwZEfJpTGSQxjLhhPCDCytZUr6oHMAJnje8cvzmxoohERFsHNquMZ6U8Rko+2YkeLqKvP44KbwfxzP9h17/EX2AWenFNkDFzuslzHWG8QlofTAXh6Y5MiA/u8nyEcVmmyffy8qMSLqBM4JEAynkP1pHe9VOCt0oGWnzXYi9SwCkT4VRAnWWJ05YUUiVmqdnOPRDyYypyjHi9gW+YXwDaBRKUleA//7q4LzMBrGnxS/fHYIfcV1tfUiWrrWydQRqh0LlVxw== X-MS-Office365-Filtering-Correlation-Id: 3ee22989-333f-4d08-a533-08d4149fe5e6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2349; X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2349;31:Hvwf+HtquRTsFO4ErxbGLQOH2/Yw74RLEYIbr2HhnujjvjgCqVYjvnmbN9KJhZprASJuplUpsRFTerrro/hsU0IWF59tEZrDF1f+BA7KFBWTPNIcs/kURubAAlsO4pYlKbI8kvt1uixc663vJk/yvcnsiPlSgLYL6jtuC3DqbxtGXgR4pF/vtiXQyWsyjRCtVcSZYjMyHa5tLOpaBopHXdRZUyrOKv0QsGR5tH64RbgkBvfLnMHyvDkh1dXjh/C5ywtozQ4JD9KORjtDvufdEnYjBDDTottl3/glKWsIUis=;20:AGooX8eZQ9Q0/ylrJvIyf9ep6DVmiABPPqkbqLBPJh36n1nhPJ3SuC7foWG7I27mLs8R7ehhLDE3UvO4HmwyJjRzx/CtY7dlAfpIXA2UWwQjIs7Cexoxkkmco0mCw9xhuiRzLj+1FliOIJRLZPZIDyQeZat1m8nF5USfSwkQE4eUdsDg6Yaf0Tt+UrMU9P9eQyjWLrWVaiy5dVDdQGyqajO6mipoARZiA0enKyXDSHlVUrHIsjStF7+bJTr+PjnNwuA2IdYR3bwbX0wt9ufnkUV6c5cUOAZ3+6JBQ68lu/ZD+gYuxepLm6wyo3p+h+IAD1xHtxRn/GHz8Tdcy7tfb+QDC2TbTbEsx8XUYtUh0OlvA2KBof9XhhxEvQI9Ld+wyr+Xtj4o02VoMaQc/KepoPE1nyPTYq7cseo67lVn/a29xfvZAjmhXsrfaRJjDR+lmmcY/xuvCdXfE1tCFB0w2SexT6aD1DzdvydpVz9ISG02voKihs2Fl0ucPmvYbBm4 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)(3002001)(10201501046)(6061324)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148);SRVR:SN1PR07MB2349;BCL:0;PCL:0;RULEID:;SRVR:SN1PR07MB2349; X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2349;4:l6aYYZc60LhPNxzzBR0UMIyrzSXGw9w2acRXr2TASrfhovuDbBPZ33Rt2HvWjksn6Z+FfCqoPXp897tRykBlHV/JsT8dza0kW+0GluIE3ZWWDl3VJFnrhGZTfB2/MYJPig4kSG0wtNokn/UCBC/tuLlT+VReHzuVIsEuDG5t/jJtdoTKaA//IkKbTR1pXQe9IRGUXjpPHrLECWW6Vd9UGV08xIqWwKVLKVja9qbdoS9e2Dadu4Gdl7NUN4MwSP8Bvaa1M4HMx2/cn8eI1N33Pz1qrFHWknItkc6SykBVWR7/badC1jj3psDsQrscwijcgjN8b9FicCoieK701rdgfmvJxlWuLL8rvcNOXp5Zl5h90CCp+z2rHsDk/ff/UlvRzo4Px97TN5RYe9SO8Uq+CGgVntrIO5JA6qbmApXpaoCGiPJHsmq+FFHgmg6R05Pbx0msiVunIJLzz7CcMrWug8sgGpKiimGY3TmSfBX3Tx5upy684jtoxSBxDvqoE/W/sSlNu8JFdxFxab8IADppQRP8xDMqf9pCJtLEg/HIcOJRKfY5Yp3s/E40/wNktBzEU1nBvlwiC7mZOOZut8M6ZHZKyzl0lUsIJkX83ysv2EIqgwyHWpLsJGH2fWVG2FwD X-Forefront-PRVS: 0136C1DDA4 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(24454002)(189002)(199003)(76104003)(2906002)(68736007)(5660300001)(93886004)(47776003)(305945005)(66066001)(4326007)(38730400001)(97756001)(23726003)(3846002)(6116002)(46406003)(33656002)(50986999)(2950100002)(6916009)(54356999)(110136003)(76176999)(101416001)(92566002)(7736002)(7846002)(229853002)(6666003)(9686002)(39400400001)(106356001)(189998001)(4001350100001)(97736004)(83506001)(77096005)(42186005)(105586002)(8676002)(50466002)(81166006)(86362001)(1076002)(39380400001)(39410400001)(81156014)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR07MB2349;H:rric.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR07MB2349;23:8jC6N5+lWk4dwxkd5P6LBvdivdZx098nmQ4TxRDtJ?= =?us-ascii?Q?onVHzQf3iVbRB1LkeTwXte0Z3M9vREYTuBDVVjozBZtldLDDuTdVV71ur1Ge?= =?us-ascii?Q?+9TNUJ6ZyLM7SO3WUMBvuC7q45hVYfjTK6NU6RYllGxzVSB9EGKcGMpAEDfX?= =?us-asc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TX1QOchdV0cf644PZRcq0?= =?us-ascii?Q?v2K3nfniWSj9zyPE5Sn4n9grpHrL88axgPufO9ebErco8uVqF+t/QcHhn9b6?= =?us-ascii?Q?cZFHHUSzpmq5Bk7+cRz1HOVAsm/wwuwiWQfjDyp/3NwFCLTxxql/PTwgakVk?= =?us-ascii?Q?iWOQw+nUtkq+UIAbPm5nyz5R4pEONLPHAby4GhN4Jvpj1760Zjtmni6wcKij?= =?us-ascii?Q?pjK/JDwfG34rqUThc/4Jd5sLBStQeij0R/IMG+hVGcxSq3Cdj25t6Zo3pFie?= =?us-ascii?Q?3dVHDXRNEDojtdXCE3CTyM=3D?= X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2349;6:3GCqLDNYedayDMt9OJNSFR+/rdBKWZyEPChWWakEcCGIgJplFDaDEPhx32G47xKnTrm3LwkHbCfzAnyor8dCNo6yDCg22hcT3Bulpy8eb3pwjQTkxzYzGRMEDJ8qJKxsUTYvzmFPtdw07lKQFQYbxzrDOKciv8cw7xy+cOlYYROjQ1G00sHS4NV5ueOspk6vL8kZi2p4M4hoEN1RY9bhupwsusenXfNhQkOqzwstYdYh6MIpYZD2MGhhSZoh8vzI+yiea+OB6r2Ny89LK0sIJvCMktbWdZvhCF03uwqmu9ar3poMRT4Q66sd6jUnCQx80+nr8xCSVfHmEWLhBbgEO9To2OZ4IL7qA03D2CwGCFY=;5:sZTGTXOFwm3SEY3nLrANYO2OvOx4TdPJM86PaIDtYDn1arS8+O5OTNNDD0cxCk2R+1N45qTRvTyQyBQKfPnogMIlR87dDR1vpBlkOjUw3AFSRC5sFu3effZTqdXel1Dzy4Pa/cV/COIHoItmVGar97PXGswMiCdnU7OI8n87Mc4=;24:+A9RvKY7H0dk8KQv01elqOXahsWsz9Mt4IufA9x/qfwjh+34yVhbhC7/BFrmtOnq/8ZDmFOjB2IJ77U2WiAJlE6q0tWJQ5g0vLw/OzrDI0A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2349;7:+QnRwoMlnaRscdjHTAh/2NqRHn5zfqlfe+kWolGQ1nBi09DMYdRtAQ68bx8Lmf9Au4WkN/VQL+FHZrP7JfjhwpnAFsjVwGEdiuQskgLrWEqqIWpAXCycYvyf3SAN/knh0H2KXKReFfDLY3uu+rV/gN2yQucHyEdPA48V+Op0raH2rRbIzDMqUIcooEGbLLTtOSOGYVOkoSDF3pZJKjwyqiPKbmaxpbXUIltNRqruKNFF5M1ek/uOBDpYD6Gvl5aIa1+/PIcEvGOrXEsogA/nNnT9Q9mmjxAEbmxNTfRltI39YIPNjYW8+jjBabWfGI+OQkl0x2qRoCMs3i5PWYhxhsoHBsyy6RsrLR1ZQgdpbBA= X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2016 19:27:13.4648 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2349 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1497 Lines: 36 Ard, > > >> On 24 November 2016 at 13:51, Robert Richter wrote: > > >> > On 24.11.16 13:44:31, Ard Biesheuvel wrote: > > >> Regions containing firmware tables are owned by the firmware, and it > > >> is the firmware that tells us which memory attributes we are allowed > > >> to use. If those attributes include WB, it is perfectly legal to use a > > >> cacheable mapping. That does *not* mean they should be covered by the > > >> linear mapping. The linear mapping is read-write-non-exec, for > > >> instance, and we may prefer to use a read-only mapping and/or > > >> executable mapping. > > > > > > Ok, I am going to fix try_ram_remap(). I revisited the code and it is working well already since: e7cd190385d1 arm64: mark reserved memblock regions explicitly in iomem Now, try_ram_remap() is only called if the region to be mapped is entirely in IORESOURCE_SYSTEM_RAM. This is only true for normal mem ranges and not NOMAP mem. region_intersects() then returns REGION_INTERSECTS and calls try_ram_remap(). For the NOMAP memory case REGION_DISJOINT would be returned and thus arch_memremap_wb() being called directly. Before the e7cd190385d1 change try_ram_remap() was called also for nomap regions. So we can leave memremap() as it is and just apply this patch unmodified. What do you think? Please ack. I am going to prepare the pfn_is_ram() change in addition to this patch, but that should not be required for this fix to work correcly. Thanks, -Robert