Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751765AbdFIHGi (ORCPT ); Fri, 9 Jun 2017 03:06:38 -0400 Received: from mail-bl2nam02on0062.outbound.protection.outlook.com ([104.47.38.62]:23616 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751519AbdFIHGf (ORCPT ); Fri, 9 Jun 2017 03:06:35 -0400 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; Date: Fri, 9 Jun 2017 10:06:17 +0300 From: Yury Norov To: James Morse Cc: Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Arnd Bergmann , Andrew Pinski , Andrew Pinski , Adam Borowski , Chris Metcalf , Steve Ellcey , Maxim Kuvyrkov , Ramana Radhakrishnan , Florian Weimer , Bamvor Zhangjian , Andreas Schwab , Chris Metcalf , Heiko Carstens , schwidefsky@de.ibm.com, broonie@kernel.org, Joseph Myers , christoph.muellner@theobroma-systems.com, szabolcs.nagy@arm.com, klimov.linux@gmail.com, Nathan_Lynch@mentor.com, agraf@suse.de, Prasun.Kapoor@caviumnetworks.com, geert@linux-m68k.org, philipp.tomsich@theobroma-systems.com, manuel.montezelo@gmail.com, linyongting@huawei.com, davem@davemloft.net, zhouchengming1@huawei.com, Andrew Pinski , Bamvor Jian Zhang Subject: Re: [PATCH 14/20] arm64: ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Message-ID: <20170609070617.74bimhscmzeykx6d@yury-thinkpad> References: <20170604120009.342-1-ynorov@caviumnetworks.com> <20170604120009.342-15-ynorov@caviumnetworks.com> <593967C0.4030904@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <593967C0.4030904@arm.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [31.204.170.137] X-ClientProxiedBy: AM4PR05CA0032.eurprd05.prod.outlook.com (10.171.184.173) To BN3PR0701MB1268.namprd07.prod.outlook.com (10.160.118.142) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PR0701MB1268: X-MS-Office365-Filtering-Correlation-Id: f2c396ea-2344-4ea3-2423-08d4af060cbd X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:BN3PR0701MB1268; X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1268;3:NhBaSArj00ApzN7SNmwl8QmxNlOGSll3wzGCe1+sK+XiNaiHAQIL5Lp15s5hd+nDMsjiOmPh9WGSCDmmPOumGqZQA61inGNvIvkf1G0ySkgvgoZL9+9ukmY15cyFrNwj1s7m0GTZdxxq80ve4/ED/bvJwoXPvT1I/8OqkoX5FXNorqgd2E9moEdR9qpYqoZQ1DlQZr+yCdgz0o8a+s2wzXMyTPcrtPy2YSU/ejp6a9CC2DVynTP64gCkTape9KsYSYhIU9Ok24hKXxUp1n+Qk5JY/pvz3gVIQUbKGZQZkMQGwScYgRHnUS3F5sH0w4A7AUs/Ad9iGDNaSciXb6CtrQ==;25:ZUAwei0A2YNVIdq0SvoOdeME/ioPX6dHEAbezMt+6UfUEM1kBzjV1o57GTf28vQn5PSCmkIDF/fAJPy3oyLIVD5YBgEjbOTQbfIrSUbbzE2+atA6htWdlbkZClTOGGoOXK4j7DD7xIRWWJBEq02aWgIo5OqzhJhYAc6wNX5leFMIHx4n7CO3wncwgtfq0SqyoM1mtojMh/A0w12ABOfAt54J5VjY2u3ODrz2/osUpLJysjAblMQ0HqLJ5u/cY/1X8XdeBreGCqhegDx2FddbMDbV2MR3TnVHw13hUZSF06/5i80GaX/J7EriCVYnMVhBCS3yG14bPcXYqSeH1d2IY8/emMhnV61qqMTGfLlwfydMNm/rHEQXpdbYY9veK5KOTImJnuC+KElFrDf5HSXyJ7czoDxfVa+UqkWogxyMLBUiTqswGF5b7eYhacoaRuLerbwg+E/8jPlek1z68tdKcByozLDPjRzPZUQwFt43obs= X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1268;31:1kXurJvzrgEHsZsbAkxN0lVHik4XQQC0fUyvYSCC1JW5IgSL+PXR2dbKvEwhs6CvT0oQC3jXfqRDjO7Guek56nKhAy7pGL/aBXDf1YMhuuiqNJ45nm3GR5pGncQw8WpQQU7SHxqZ1Magg65T0oe5WaPT4lIpPhJJjvtCZafDXECirf8gpr4ruOSg0AMLqVikzbMkCXafcrOF1O5XZeUgZuDAkgtlxNrla8EWV7TsOiA=;20:wXDpfiL+0QBxcp1kOmQiwqEOg6ruYKcsa1kKrxZJ6h79e/EdmzJkbv87lY9OULp8v+tV3toWpGU8aK8VMAkpD2QCM8spEnRdAZBsRFPcJNRpiO8XzeTKvUmLxc9dLZdewvgEJRmW2ZR5hqLs7RWNcTw2DFzkQ8Fy9MIEah4hkFpsEnAE3anjewmio2pnfqzaoKrfRjO/mBLa1VkkewiLjSLFkdSoey13CtfvoSCE0Suenas92nskifj8c8k4NoCA7DbU3NMagoFS6iShOGG4uWFFG4kfhGWfiAW3VovB/DVWov2CUO2ZVz/cLXXw/RoRzQID9DzgZ4uGB+ldaQ5AoRqKjmhuvsQgLGgMgKHZ1H5GG0EOSeMsu6AaI8gjhNcX1TrB7sl6fXEz4w8oBEfYG5RTDTfdfikAfMAJ7KZlxzY/B483+qeubCex4tnqAyitVBzMLR1J3djMJeHeZVIymq/WordkbGjzV78BOVieITNlK2+X4uuy7VaPsNlEUkxBWYVWuM9kbENVCMGexo3Q3bvd6BpWfYeP4JaENPqKJ1x2ip4nkBVDciYqCUL4VlAoAmhuLQpWtAHJcf5X0KY+19QuN0wLjExyfIIg+IXYwM4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BN3PR0701MB1268;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BN3PR0701MB1268; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3PR0701MB1268;4:Gxjnjv7Gq5nNnaiCXwmWNlosnEb94hKlR32fFkpt?= =?us-ascii?Q?v9BlA/4jgI/gxcaxePTSAfQz/3eN+ukkdMoZslsgHAWJWCJiKPS6GpC5iF56?= =?us-ascii?Q?E2qEB6XXOR2PYKTmK8bdlnqAzsFuZrfuLqziu6V8F57L6wNaPzLnTUMMVml7?= =?us-ascii?Q?2YMfQ24DG4Y2XFSOV4AB2GLbTBAmrkR48rTDDGUmYPWDrecNTP8iQkIvZ6xa?= =?us-ascii?Q?TsCy+33UFvTALYB03bMUMd/TLRb0xHqXLyx5oRq/8riuNe2aBH45d4F/JTmj?= =?us-ascii?Q?fs8tyCQ0c725HrpsFF8EKLvLPz842qKgxOMs7draAYE20eaFkmUloesSbsyk?= =?us-ascii?Q?0hmC7+T+wKlXqM2vncI7tnQLvwWQb9+gzwkqiGhJr0f+VbZphOqZ8pLkkgmA?= =?us-ascii?Q?hv6DmW1mZptOej8fmUNL3goJrBFJaTHcmUtSKsnCTGLnHRbvJM1ztJpOOnnk?= =?us-ascii?Q?XGcTCRuJSgQTWtdXN0N68URe3+6pzak/p58d8N71XVcNuVmRz4gjkr51sFQV?= =?us-ascii?Q?KAg6k02Kkwk7aZHgxpLE8iieE2/IgqwKQRa7uK2/LmTIyF5rH2ES2MefC6sx?= =?us-ascii?Q?BZXbuS8JP9wZ2VOP3lJO/qk1/1rxFEC9r9Ik6plz9VI1YPOFwC9KmrtrJU9e?= =?us-ascii?Q?ddjy+QS03Ak6hGQpBEBzqy0znxZArG5Agt3mf07su8j9LVMRzqiFtaO17O3b?= =?us-ascii?Q?/Heq1mtcRz3/B0p1jEuvzegD2ed0I+3UNs25LdH+4Z6hW0LHT0diMxu545+H?= =?us-ascii?Q?HaGaf1uXtmH9eXU2DsMAiwfthM5gmuhkVbb5U/KMhwpg92E4QCq4Oqh3UNTF?= =?us-ascii?Q?GrTPdIrjCL+QdZ7ptTR5PgOOLw9u+vnweeMwzUoJ35y87YqHSYCAjbYQC12G?= =?us-ascii?Q?UUd/XNm+1eSQwoUYs9ggaNI2sgwYeUi2HIqeLFvfrQVn+vqPfosMSF35Vo/A?= =?us-ascii?Q?IIQBFLA8LoAlANmnrY2ciauF547/MJeHvS84CI9CPS0OWsN4/6h8RZ/OfCaU?= =?us-ascii?Q?i75sgjWRtqhvaisgnJvA2QpbUQbmOVSxgGThaNxXQqaGFhXTQqrP31rAx18g?= =?us-ascii?Q?uJeOIA9vI+xZWtPBNs0EpIUESHpw9x63ZigXbOOO/CCDZofmfdwChhxyYxgz?= =?us-ascii?Q?10WIaWTiOjg=3D?= X-Forefront-PRVS: 03333C607F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(39850400002)(39400400002)(39410400002)(39840400002)(39450400003)(51914003)(24454002)(478600001)(25786009)(72206003)(2906002)(8676002)(76176999)(66066001)(54356999)(4326008)(33646002)(50986999)(53546009)(47776003)(6916009)(2950100002)(1076002)(305945005)(42882006)(81166006)(9686003)(7416002)(229853002)(5660300001)(3846002)(76506005)(42186005)(110136004)(7406005)(6666003)(53936002)(54906002)(6486002)(189998001)(38730400002)(6496005)(23726003)(33716001)(7736002)(6246003);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR0701MB1268;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3PR0701MB1268;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?us-ascii?Q?ZByIUKlPsl15MUu4uEgc/rrjuwcevXA3OrbQk0lLPNbTIlUHm/3Er+o+E0Oh?= =?us-ascii?Q?OXEGHJie9gzImWk/m5PhHw76nmLIN6Ru46BUaYfDgH9crt5wLOmEcjmzK8u+?= =?us-ascii?Q?mtnNOx8fbdWYkZm3yD4oEXK3VDMMSINnagbIlMlGiXjtGl8a158o1otzilfv?= =?us-ascii?Q?eDBS2hWsT3SBks4Yu+HtOswCtPYd3cqszyirjY/sp5vAj1/ZPhbfrQJ5ZxH+?= =?us-ascii?Q?mhtl/RibMxiK5+cuDC00zMIE6aS5C+GS/AE6RelQ68AOx5GAeLCKGyTvrpk9?= =?us-ascii?Q?PsJ0c6fYRjiu9nQs5Slpn+4l5dDSiRN8XHB5A?= X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1268;6:Ct7xEwvEMA9dhASiQKhwoUgJ0mmYrJuCKYSkOqDB5/wmzMwIBHym9MBoNb4vC8GM3uXXabHexE1D8YrwwuI7HX0DHQ8vre35hBs9xIFs/3SBbFFjWbxNVuJGImOEatjd4LMy5HXjVwsPsIDD70uSwVKUdhncJCWS17s6k6S67T6uFy2l8W6t2cnCcbpCkitFNUXLETlNoCeKGMLk4elwjLv5F+qnnaiLalERgqFKWG1sWvRq4Vk+zOtgjaem6RWgDyDzRa71sY3NnaE0H5f4KtRRJkR6bV9Zm+V3WEej6e+IEP/zDivoWQuT/gGPOnceac9JNKnfVxMHvBOF59rUK4sWRvmkFf4oA1qVenujNq+fSPnoY+pwrWlllZtNbZnNEhGLJP2b15AOF1VQBonCxsDjaoB191sIZHNjI+eSUgVvZnihkLevv351pP/YPhwNgfHx+xc35kxdmDWTraFsPzH3ShqdZM9DiMwHEiLFqNPsKd+Ixywk9l+txVOJPbjnuZEErnuGzXSOSkroR694eQ== X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1268;5:G/fWEccPFOASgJYgBhKiOp+fRUSo8fo3VXse5R1Dzk0j3ef1aVb3XkEyseIRJ5d6OsvQI73HPmW87jYduy8gYnIezBSDwskNvBqOezfbYVhZR4Q1l9xXsoRE/Svl9YCWWg8jp7p58q3mbqpPNu78eaFYpAXVqV9odlb6EgxlXrUh/Aggm7oaag2U6Wbv7DoMS7UovIPY2db3Pnyrr6LFyLA7dmNShm8+JDGiQDpRgZCnmeQpXsm3gWCKZJ/6vq/WxcOCAFdxiHGM3JjWnnMODSdvsrobT2UQp5r4LU49MzvaRlwNJuelX81D2VPBiXdGng6S3wGJLLCSZViRl+LsWfL8/Cq252R5AtpGl33gT8NZdwalhBWzgyi0hwtXCGTxzn/E8UUmu2BxjdnQ0q7qJ22J5Cxiu3ZgCrnVcMlrZ2m0Ky9/sy2FktpsThcnS1XTeYtdhiFLz//gUc+6GBjFvcykuKwoa59fFkt4RUhFQMU8bxMosAWvRgkZzbOixCyl;24:3eDER4YPWQtxPfB/X88n+AfaTkaNJHm1S0ZHBl3ih5kiXGssOK4smwjRJi56TBHzd1iY9rjUJqhIRiIuc5rhlNxNM57JjUKcusQzUCGQjLI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN3PR0701MB1268;7:tf11ZRbOwctXFb7REJVKI+MKU5vM/pGkfnqwEKsCeEVBq3gMl0seE2XAMDWPNVeAbuTNxjiXicrKRIhPQYXp+i5pt8JHHueCOUcb1qquU0Pipxcfhdx0iXu3Hl4fhy0iw2nUSwUlln1I4HN/grOUuNFp0zDpEiVs09f1LPN64Ed2hxY/UrzvAnBWhwHy/ATC8ktybx/5JI6uoDeQXOK5rwIiMdUvpQVGVgvNevjilMO6elXIEonHSC04M5iMi7WH8dno8tsk2rNpWFi536FKIds1xWCJQoQeOpVt2O0Z1PJ7Sza1+Ge29Y0X1N4tgQe4WdTlDWAsK7Nf9Rxc+mdGoA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2017 07:06:27.9625 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1268 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2117 Lines: 61 On Thu, Jun 08, 2017 at 04:05:36PM +0100, James Morse wrote: > Hi Yury, > > On 04/06/17 13:00, Yury Norov wrote: > > From: Andrew Pinski > > > > Add a separate syscall-table for ILP32, which dispatches either to native > > LP64 system call implementation or to compat-syscalls, as appropriate. > > (I'm still reading through this series trying to understand it, but spotted this: ) > > > diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S > > index 279bc2ab10c3..7d52fe1ec6bd 100644 > > --- a/arch/arm64/kernel/entry.S > > +++ b/arch/arm64/kernel/entry.S > > @@ -577,6 +594,7 @@ el0_svc_compat: > > * AArch32 syscall handling > > */ > > adrp stbl, compat_sys_call_table // load compat syscall table pointer > > + ldr x16, [tsk, #TSK_TI_FLAGS] > > uxtw scno, w7 // syscall number in w7 (r7) > > mov sc_nr, #__NR_compat_syscalls > > b el0_svc_naked > > @@ -798,15 +816,21 @@ ENDPROC(ret_from_fork) > > .align 6 > > el0_svc: > > adrp stbl, sys_call_table // load syscall table pointer > > + ldr x16, [tsk, #TSK_TI_FLAGS] > > uxtw scno, w8 // syscall number in w8 > > mov sc_nr, #__NR_syscalls > > +#ifdef CONFIG_ARM64_ILP32 > > + tst x16, #_TIF_32BIT_AARCH64 > > + b.eq el0_svc_naked // We are using LP64 syscall table > > + adrp stbl, sys_call_ilp32_table // load ilp32 syscall table pointer > > + delouse_input_regs > > +#endif > > el0_svc_naked: // compat entry point > > stp x0, scno, [sp, #S_ORIG_X0] // save the original x0 and syscall number > > enable_dbg_and_irq > > ct_user_exit 1 > > > > > - ldr x16, [tsk, #TSK_TI_FLAGS] // check for syscall hooks > > If built with CONFIG_CONTEXT_TRACKING, ct_user_exit will call > context_tracking_user_exit(), this will clobber x16 which you depend on not > changing below: > > > > - tst x16, #_TIF_SYSCALL_WORK > > + tst x16, #_TIF_SYSCALL_WORK // check for syscall hooks > > > b.ne __sys_trace > > cmp scno, sc_nr // check upper syscall limit > > b.hs ni_sys Hi James, Thanks for the catch. I'll use x19 insteas - it's callee-saved. Yury