Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933262AbcDYSto (ORCPT ); Mon, 25 Apr 2016 14:49:44 -0400 Received: from mail-bn1on0061.outbound.protection.outlook.com ([157.56.110.61]:32864 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932487AbcDYStl (ORCPT ); Mon, 25 Apr 2016 14:49:41 -0400 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; Date: Mon, 25 Apr 2016 21:47:40 +0300 From: Yury Norov To: Catalin Marinas CC: , , , , , , , , , , , , , Andrew Pinski , , Andrew Pinski , , , , Subject: Re: [PATCH 20/25] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Message-ID: <20160425184740.GA2559@yury-N73SV> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <1459894127-17698-21-git-send-email-ynorov@caviumnetworks.com> <20160425172656.GI9614@e104818-lin.cambridge.arm.com> <20160425181913.GA30125@yury-N73SV> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20160425181913.GA30125@yury-N73SV> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM4PR01CA0004.eurprd01.prod.exchangelabs.com (10.164.74.142) To CY1PR07MB2230.namprd07.prod.outlook.com (10.164.112.144) X-MS-Office365-Filtering-Correlation-Id: a454b481-96d5-45d9-fe9f-08d36d3a5a2d X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2230;2:Ya3ZT+cJvVlDHm/xipEVtC881tYS1PHGGf0sbCsKbk3dAOgi4tGIK5A/edB/Qb2T4Kkufjqu8zmWCEzIg8Ok7IMXMLJeGuHJT3Q4NsdUxeCVETlLQD/441vRMqs82i2pWYgNi4pyIGvNcsm8vMPBlCIqyZx6doaFp+9Z7fuRckBabyMNCB1ukVNJQM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ujzj4nkj3gp2yhuElGXsNVWvGs6n7vLq7F2ZoDeTjZfTH+SgqxSW8ZO0tPh4Wc1dDnrtGH/jSeRSCUCNsnApW4Ulb5f3ZCqhhIPVRMV2ZXsGImRUuZE00ZVNwpxywSCbrOGvLhXFEHqHM58vDWCo4a8Vn6l3W8SfhaCZEXeFuCB6J6QSmNoCJL76QZprLdt2oWXPGcz0y01Qbdjlpd+zFtAhHccFgnbSaE4VNLCrvvZk218TT2tlRZNRFwxuMTdZeoVEJNu+uP/6/fbH2z3fwpKNwAMSSWPDnzHoh1t+ydQEC4UV/JF/9LQ8cUlApaeSRikvR4iyhNdv4wqZjdFnvbNHTV3yI6LpfQhGQHUXENY2Loy4vpD5Y4Ua+405M8VjPXwq1Jzh3e7TaN20ICYhufEmTgQOFLE9/ePQrIVsgGgNNBkYY4ntP1+R9bafqZTHDzPSGsT5ULjE0Jc+Mscw3j890UYUAhT4t+h6YWg4ZyeRQsT8LueViq3FYhj1RJ/oa5R6A= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521072)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:CY1PR07MB2230;BCL:0;PCL:0;RULEID:;SRVR:CY1PR07MB2230; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2230;4:t0RWkCR19ZblEXxfveksjEYcboEiQgG7HsLPVchxu5aygltVAEckJo+uxgOtJwgnGdPPgGQvNYP6C2D0Lzsk0TtDL6ngF/ZQWNGoISl7ZgCBtsZaO2uxQlLyD3aRGKc6r/slj93Mu9nUs0CUiC9cFWa0PoI4XBe6tosA46/agQ5pPL7muMp5e2/TrRZj2PXI2GdTxqI1hIwpx8t+B/rHnWHqX5q5QFI8hdGbqWgsmRIapTeYUJTSQk5TPZUbDL1rAlmJ6lp6XFf+UYwJRZCx5YngwcCKpBIQpAIgXHRXkPraS+CP81xvJ5B74l/I9QZoZcB5qM9kIuoy17LHIJuFEk4PwTYEsUwD+HCJLyBUesbRXt+MakVTscrDoNHNzbQZgKwHPCoKj1zp5N+V8U8SmA== X-Forefront-PRVS: 0923977CCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6069001)(24454002)(83506001)(33656002)(81166005)(4326007)(66066001)(1096002)(5008740100001)(47776003)(76506005)(93886004)(3846002)(42186005)(54356999)(33716001)(46406003)(6116002)(50986999)(76176999)(77096005)(5004730100002)(1076002)(92566002)(23726003)(110136002)(586003)(97756001)(9686002)(189998001)(2906002)(2950100001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2230;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2230;23:K2t5K+ibS8heonwgttEZZrCfloiUT+DVMAEbdiIUZekzkRLPzui7AArLwbXtgfLOHHgrGyQAOKGzBOq+P3hFjcK1WqZk0upBdMDxg2aF3IL1QAorg7P2OBS4khASNNYJN4p30DbPrr6gNxSuFEyI8G71pHarJkutoZmq8LVqGdnVLmifZJZdP3a6/iNqDb2nsbzsIibn49YFjjSJWcuKmmzQ0lCO0WI9p/3EJHVykj4KkdJV+Rnxl+tuhzl3YaL0cjb7dxGVitRT8PmkYc8XMt4ElAhM9rpiNz2hiZks+eZtX2RW0kNq+g918jb6KnZ5aZ1xS5f1fpPTTIGwRKRdsSgPKe8H/lPqbRR5IiFZlclzOpbMWJZKn2/GxcSxdVJ4KzFq7ET/vAiAXhw6/bhE5vdcnQk4H3oR7rOHQdft2VJiMTohHxsJwddKNbEed+bmAoGIw7JSTPovzYdzeiI5BMlxyLQO8j5ybOjL72Msk0hRLXZ5eXXUe4dy5tNtjVeY4SOxttajSVGEICdQgKCNAnHYUBsrGL1LdcUnMCXZ/ko0sEqWmpjNsGShqv72fDk5Hg4eIl14r8qYm1hkCJb4o2ic0iGxEuhvB6AsyzXue2sVUfGn51baw8XATZQiXPLquRfPaIsgtbE5sGGdUDisLV4d3Ql0lbmxq5fJzj9ePfb9TTq45R24oolyWJQ+nkWkq9gBOMHCKPs+63/igQ42S+D2CFjAWfNiOCNRvAwhy1qZzdToBfVnWq7wYF26zQBXB1kSIHDQH9vEC+a6TUCJ6/ZCxRRvh4tv4nn+Rn8tNgN+IpNUy3rpn4OOqqAAK6S8hEjgoCUmhf28/WG44lbKczXFKSmE8NF8Pg8aMp6uf4hsRt1eXpLqQP8QcXEUjk5JRVYFbkwaxgjcU9vylkbxMA== X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2230;5:70makZ5Ss/HP+3JYxQfUC73dBq7r8LW6Yi0O8FVcSRz7nc1WkvzxgHlwpBfw9LTI4FguPnovTdGL3HfhmmxYSQeRqXgd/fokbnxt4skQcLF+4gogveo7bvLD7Fo0al+th76jtfMfJcTnejIoovUo4lMifetr1un3+QyPSai6RqaktW12OagoiLovPR72kuHj;24:DCvrzit8hLyWR6WG6SDYmeGKAiJMRR+Cre+mu1ms+V2DVdCqbN7o+tnXyWaNqqIybGvbF5pt0+73w6VROx+5yxKIze9FGDhzd8POVIMsAyk=;7:2Xqj1kKFwIjV8DrSE3a4BGwUCSY7Y5eU0LnypWQaPfXQ1oVpdJaMRZt/MF7vTdizQ3UxAQz/ueAL/RXinkUaCyaR2tup6Lhv5i+3xS+hTqSEbpeqm0498tOQb0ErXydnKzgNm8KXq1qfHmJz+nzXmAE1ClDd3JDFQHlCQgh08vjw/VMP79TzpmSj4tG/qvYBWLbWBgaWalwgbHX+AL7cFpkSxk4VdpCSEvjWOHZrl9o= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2016 18:49:37.3803 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2230 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2111 Lines: 58 On Mon, Apr 25, 2016 at 09:19:13PM +0300, Yury Norov wrote: > On Mon, Apr 25, 2016 at 06:26:56PM +0100, Catalin Marinas wrote: > > On Wed, Apr 06, 2016 at 01:08:42AM +0300, Yury Norov wrote: > > > --- a/arch/arm64/kernel/entry.S > > > +++ b/arch/arm64/kernel/entry.S > > > @@ -715,9 +715,13 @@ ENDPROC(ret_from_fork) > > > */ > > > .align 6 > > > el0_svc: > > > - adrp stbl, sys_call_table // load syscall table pointer > > > uxtw scno, w8 // syscall number in w8 > > > mov sc_nr, #__NR_syscalls > > > +#ifdef CONFIG_ARM64_ILP32 > > > + ldr x16, [tsk, #TI_FLAGS] > > > + tbnz x16, #TIF_32BIT_AARCH64, el0_ilp32_svc // We are using ILP32 > > > +#endif > > > > There is another ldr x16, [tsk, #TI_FLAGS] load further down in the > > el0_svc_naked block. We should rework these a bit to avoid loading the > > same location twice unnecessarily. E.g. move the ldr x16 just before > > el0_svc_naked and branch one line after in case of the ILP32 syscall. > > > > Yes, I thiks we can refactor it. Thanks for a catch. Now it's better, I think diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index cf4d1ae..21312bb 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -715,16 +715,22 @@ ENDPROC(ret_from_fork) */ .align 6 el0_svc: - adrp stbl, sys_call_table // load syscall table pointer uxtw scno, w8 // syscall number in w8 mov sc_nr, #__NR_syscalls + ldr x16, [tsk, #TI_FLAGS] +#ifdef CONFIG_ARM64_ILP32 + tbz x16, #TIF_32BIT_AARCH64, el0_lp64_svc // We are using ILP32 + adrp stbl, sys_call_ilp32_table // load ilp32 syscall table pointer + b el0_svc_naked +el0_lp64_svc: +#endif + adrp stbl, sys_call_table // load syscall table pointer 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, #TI_FLAGS] // check for syscall hooks - 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