Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752504AbdHDVtf (ORCPT ); Fri, 4 Aug 2017 17:49:35 -0400 Received: from mail-cys01nam02on0081.outbound.protection.outlook.com ([104.47.37.81]:45926 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752012AbdHDVtd (ORCPT ); Fri, 4 Aug 2017 17:49:33 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Date: Sat, 5 Aug 2017 00:49:19 +0300 From: Yury Norov To: Catalin Marinas Cc: Pratyush Anand , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH RFC] arm64: introduce mm_context_t flags Message-ID: <20170804214919.2ej6kj2mqmddfe3z@yury-thinkpad> References: <20170731144825.31322-1-ynorov@caviumnetworks.com> <20170802163900.66gnhogililb3uak@armageddon.cambridge.arm.com> <20170802172940.ejiyl4j2ywlwhbme@yury-thinkpad> <20170804173809.aviva53kccexghul@armageddon.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170804173809.aviva53kccexghul@armageddon.cambridge.arm.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [105.139.42.249] X-ClientProxiedBy: AM4PR05CA0026.eurprd05.prod.outlook.com (10.171.184.167) To BN4PR07MB2113.namprd07.prod.outlook.com (10.164.62.155) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 237e2643-ef20-41b4-357a-08d4db82af5d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:BN4PR07MB2113; X-Microsoft-Exchange-Diagnostics: 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0uqvtnyi8/m7pStudkDpzjCKBxYo3m1bEq2dy4KdRO9fO4NxzqZsuNuXIebqjT+t3JhwuXZfJtgz9y8Q9NOYNtVpWxMS+0bxOBVJ6IjG/TtfWYeB1JtpCZhygG9ZJS9LGS/j0m7gLh6XsBQjirMlwPxDoGGKLza6I0mECFfmjwjWFY0ltCnJ7EA0pE7Xdt4Rdgl8FRqGviiXATW4wG7eiHo795W8ZMtLEmYc/264jnNxAsjGS13XB5oGXSo5/S+E7pGkS7REJ3us+n5QOpd5V6yoBfBsOdBIC33fgYfnDLGAwaI7jg2CAAhYi0jNsYag98NDWQ44fIxsEwWSBRAsJ6Z4d1ECInW02/2UFSgHlghUfmhtOQV0dZoZhhtxjBsh7gkBShCVXXyhWWMfY+51kcr15OmrMOJQMPieua8DcYLSpvDqvlhqauycH/cxgNQkuFalisr61DvaBM=;4:SeUN79MwkhpRJCQvIKOvHD7qjTJbRZ1qN3B+JBpnjp3tOTouT0GTKBV87UAWv8xrgFjl50rb0jSCl4mQwuHZD5i2Z5goYsV/5GWx30ewlv5zs9wIdp5maTCkf1c0tHrUVYD3NopPQhZURtCsyl+/utPcMn/xPZFYxmjo+YRhC3ayKQb9wz3MUiyyRPDBnWyEJdEgVOV3oEj3u/WVIA8gxjE7JJQ1ADIj+ILth/FdFjY20lSiEeAiaRU9aSkbZb4zALo01LxoNhC3DTbMbQNfogazyD/kPuRkIn+kP0DOmjQ= X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123560025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BN4PR07MB2113;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BN4PR07MB2113; X-Forefront-PRVS: 0389EDA07F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(6069001)(39850400002)(39410400002)(39840400002)(39450400003)(39400400002)(24454002)(199003)(51444003)(189002)(1076002)(38730400002)(110136004)(189998001)(229853002)(97736004)(76506005)(93886004)(105586002)(47776003)(6916009)(5660300001)(106356001)(7350300001)(2950100002)(42882006)(6666003)(33716001)(66066001)(72206003)(76176999)(4326008)(6486002)(42186005)(4001350100001)(54356999)(9686003)(50986999)(81166006)(25786009)(83506001)(478600001)(81156014)(68736007)(6246003)(2906002)(3846002)(33646002)(305945005)(23726003)(6116002)(6496005)(101416001)(8676002)(50466002)(53936002)(7736002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN4PR07MB2113;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN4PR07MB2113;23:v+NzVkcN8GNzrbbATNjQ3Awuq0+al1drYluPVVKFG?= =?us-ascii?Q?VfrjOkqLK7DJAC6okFiIVHjyDCmWh1g/YRVadXeM4d5eBDDAwiz9pVyAsfyv?= =?us-ascii?Q?BjqAuqkBGj3z0tDYg3zTWbsFP2D4blXpYLm3ocjfsJUHkhULdRXwtQ285/eO?= =?us-ascii?Q?kq+7ZWZQpLQohee32XRVIqVgyzVLU9pm7fb+Gqk1O3+lLc8dLRGoY0+u/ZcE?= =?us-ascii?Q?ELt5ynXQGxHY/TrTvPQXx5moygIb/LyoUeFxo9C/s208DNEEAQPDu6UZQh4N?= =?us-ascii?Q?7ahNIjYs5sJs4PrwVmvUZ1YPqqc57EncnBNyrn1BfOr33GottsGuDOEA3bvk?= =?us-ascii?Q?iCgEuPjt5xPee+fzqJNpqascco8xib5D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B/V121eoX8udUE1vz3EzifCqhG/j9qlIvV+PBqsHLUKkw0ToCcCE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2017 21:49:29.4966 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR07MB2113 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4277 Lines: 86 On Fri, Aug 04, 2017 at 06:38:10PM +0100, Catalin Marinas wrote: > On Wed, Aug 02, 2017 at 08:29:40PM +0300, Yury Norov wrote: > > On Wed, Aug 02, 2017 at 05:39:01PM +0100, Catalin Marinas wrote: > > > On Mon, Jul 31, 2017 at 05:48:25PM +0300, Yury Norov wrote: > > > > In patch 06beb72fbe23e ("arm64: introduce mm context flag to keep 32 bit task > > > > information") you introduce the field flags but use it only for a single flag - > > > > TIF_32BIT. It looks hacky to me for three reasons: > > > > - The flag is introduced for the case where it's impossible to get the thread > > > > info structure for the thread associated with mm. So thread_info flags (TIF) > > > > may also be unavailable at place. This is not the case for the only existing > > > > user of if - uprobes, but in general this approach requires to include thread > > > > headers in mm code, which may become unwanted dependency. > > > > - New flag, if it uses TIF bits, for consistency should for example set/clear > > > > TIF_32BIT_AARCH64 for ILP32 tasks. And to be completely consistent, with > > > > current approach we'd mirror thread_info flags to mm_context flags. And keep > > > > it syncronized. > > > > - If we start using TIF flags here, we cannot easily add new mm_context > > > > specific bits because they may mess with TIF ones. > > > > > > > > I think that this is not what was intended when you added new field in > > > > mm_context_t. > > > > > > TIF_32BIT was handy at the time but it indeed denotes AArch32 user > > > task. For ILP32 we wouldn't need to set this bit since the instruction > > > set is A64 and uprobe should support it (though not sure anyone tried). > > > I noticed in your patch introducing binfmt_ilp32.c that SET_PERSONALITY > > > actually sets this flag in the mm context. > > > > Depending on what will be decided here, I'll change ilp32 patch > > accordingly. > > Since this was meant to keep track of AArch32 tasks, the ILP32 > personality macros need to clear it. I understand it. I meant that the exact fix will depend on what we will figure out here. I have also fixed small issue with headers in the patch "arm64: signal: share lp64 signal structures and routines to ilp32", so I think I will create rc4-based branch that will incorporate all changes. But if you need I can also update rc3-based branch. And 4.12 - do you need the updated version of it? > > > As with the TIF bits, the PERSONALITY macros become more complicated > > > with more bits to set/clear. Since we don't have any plans for other mm > > > context flags (independent of TIF), should we simply rename it to > > > thread_flags and just copy the thread_info flags: > > > > > > current->mm->context.thread_flags = current_thread_info()->flags; > > > > This will also work. But it may raise questions to one who reads the > > code. > > - if mm_context needs the threads flags, why you copy it? Why not to > > move flags to the mm_context_t? It is always available for > > thread_info users. > > - for multithreaded applications there might be different set of bits > > in the flags field in different theads. So what exactly will be in > > context.thread_flags is a matter of case, and you'd explain somehow > > which bits are reliable, and which are not. > > That's a valid argument. > > > - It doesn't sound convincing to me that there are no other candidates > > for mm_context.flags bits. 6 month ago we didn't need the flags at all. > > ARM64 is under intensive development, and it's highly probable that > > candidates may appear one day. > > I'm fine with changing the macro to MMCF_AARCH32, however, could move > the flag setting out of the SET_PERSONALITY macros, just to keep these > macros strictly to the TIF flags? We can probably add it to > arch_setup_new_exec(), something like: > > static inline void arch_setup_new_exec(void) > { > current->mm->context.flags = 0; > if (test_thread_flag(TIF_32BIT)) > current->mm->context.flags |= MMCF_AARCH32; > } > #define arch_setup_new_exec arch_setup_new_exec > > I would go for always initialising the flags to 0 rather than clearing > certain bits, just to make it clear that we don't inherit them. Looks even better. I will take it and send the patch soon. Yury