Received: by 10.223.164.202 with SMTP id h10csp196181wrb; Thu, 16 Nov 2017 22:12:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMbTNmKTGkj20minGKOK63ntuJlaklIcBPRz4BUtUgxTjKp68W5pjLRAZI/kO6WuwcyRUfPN X-Received: by 10.84.130.67 with SMTP id 61mr4113948plc.368.1510899134536; Thu, 16 Nov 2017 22:12:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510899134; cv=none; d=google.com; s=arc-20160816; b=loy9DG1YBcBWe3fhH/haOy7UkrJr4S5XEPX8r0/3IGEYDEgClreyNahniCYtOQDred wlalD6Wu41pYw7Fde/jrtFWQo6hSLJByI6OH2Mh4mzRAua+cj/BWvO9+bxInNgAK+VdG fBntFOVz+tJ/oWdy3T3tu5KoRmsOEWy/gwgdN6sWi9ZpOafa3HtfqqzWBklou+lalK6V adHzryYl/gDD6rTMRL5/AgwzsZ8cYV2PAIF0r3lpPhQ6Vjvoa5RCa36oG+1cW4plunaG aedRVEogV9cVQNqLmsekQxbtGPeQC5dfFQ5bpC9zQtfcWZJdm0yaKgvvP789GTA9hL5h gMXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=MkKHcC49FvGmNZLyn/Wd3Xa6mJGC7Hv6w3mjUGOV5cg=; b=g08txhh2lBzWlSNq+HbfreQvdlan8UE+Wr/kIKDUWuoPvxAVrQESwCjkDeqRZhT+N+ DBTyW+aqeolUr18LzTWtsWnIaJDR3EC+pDLUPotOoq2moM8SQBcyGeSib7imkxYesh9A E6mBiwublubwYFBHfJNlivUeyxNSxl+V4JzZ9FnGPyGRXH2Hge5JFszahP/LvuHYMsmh WOe3cas8XglCylrxGLo1gRV+MwuwqZp9Tnkp432vISE9IbpH22JLUHUuf2zfpdB419Cn 0EYKjJUQ8aXFcev0ZV8XEf0rlHNZ2zDiEQkg3LtuRWsF78N5Jz/GqVxMYJWCHQvp7dHV 14WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=jppzKmF5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11si2252525pll.429.2017.11.16.22.12.01; Thu, 16 Nov 2017 22:12:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=jppzKmF5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934219AbdKPV3v (ORCPT + 92 others); Thu, 16 Nov 2017 16:29:51 -0500 Received: from mail-bl2nam02on0049.outbound.protection.outlook.com ([104.47.38.49]:55552 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934084AbdKPV3m (ORCPT ); Thu, 16 Nov 2017 16:29:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MkKHcC49FvGmNZLyn/Wd3Xa6mJGC7Hv6w3mjUGOV5cg=; b=jppzKmF5wgJVoQO5hFYuWfoYDqcaH2skUy8WN9q+dvrB9UvlRT523OOEj9r6ZZk3t1RFMaukuJm866cKzNuDnnIJ6O5J0+i+My6j3evqi/9LfP7zor14iW50qEBW8Hb+5cKuSTdUcofwhFwgQP4g75BznIpB+jIhPpxKpgxgWX0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (50.233.148.156) by DM5PR0701MB3830.namprd07.prod.outlook.com (2603:10b6:4:7f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Thu, 16 Nov 2017 21:29:35 +0000 Date: Fri, 17 Nov 2017 00:29:20 +0300 From: Yury Norov To: Robin Murphy Cc: Will Deacon , Mark Rutland , Andi Kleen , Kees Cook , Ard Biesheuvel , linux-kbuild@vger.kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, Greg Hackmann , Masahiro Yamada , Michal Marek , Sami Tolvanen , Alex Matveev , Matthias Kaehlcke , linux-arm-kernel@lists.infradead.org, Maxim Kuvyrkov Subject: Re: [PATCH v2 11/18] arm64: make mrs_s and msr_s macros work with LTO Message-ID: <20171116212920.wixsxoccznyef4aq@yury-thinkpad> References: <20171115213428.22559-1-samitolvanen@google.com> <20171115213428.22559-12-samitolvanen@google.com> <20171116115433.GG9361@arm.com> <20171116130742.wijnukjetoupi4hc@yury-thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: VI1PR08CA0126.eurprd08.prod.outlook.com (2603:10a6:800:d4::28) To DM5PR0701MB3830.namprd07.prod.outlook.com (2603:10b6:4:7f::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07007ead-f774-4eaa-450f-08d52d392392 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258);SRVR:DM5PR0701MB3830; X-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sglvbCPPf8yiGe/Omzv19/YNR6foU04h8cazj0CY5bZzEzwOkEyE+X/A9HqgFtQqWwY1oe4exEpyOUaMbZ608kCGOouRb26i0PqYJDJietGoqB0N4AfS9+BeN8DayojgeoltUrKiUQF6eAcAKvss9+KEG6f8ik7Z3wcgMfy2GVG+JTFjfAgT6cwgzIzGUwqyOR5xrxMinAt3/47t+F9/n+UdLSJMJ8KVRGv8FdugzdsUytacdkGwuV8mDmZ4s6HMI7/aZyp0bs2dglR5O8RMrNdi8zVu3vB8/mEWaG1G47cx4MciLNyUSo7UX/MUeimc6cHMrGIWiW6Agal3j2VOKCVGkzG912JyIFRetvAik1WuBeHQDIVvb1xPUEnRi1JZ1eiVHpMlZ289lDGf0Rv5Yr30bBnx0lBxrHORUrdXUvGYt4vvf9XT9TWJEqFDrB6zg5GkW5giB3HhNagfUtiAQyZDsBD5mwdXEej8GBArXgC/Js= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(166708455590820)(262104967686372); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3231022)(10201501046)(93006095)(3002001)(100000703101)(100105400095)(6041248)(20161123562025)(20161123560025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR0701MB3830;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR0701MB3830; X-Microsoft-Exchange-Diagnostics: 1;DM5PR0701MB3830;4:a8l0SHan0tMWBXmnT6BAFHyosy8165DVoNBw5GwgQyoEUXYV0jqowxwdu5IPxiRq0Puu6RAQXBBmzYbrJct0b7LV8fkHb5+l/xge857kbe8WMnfwXupw1eehNs+tKvV7KKapu5RtgcrTU9/A1wbXTfC2ckjN2CWQKs3BjAklreizglL5vuAZuKMbe7aJDByK+g01lyXSX1RuVODYbLXeE+1GmL4axhGeKFCLKSEezPMBiNDAWDwsWte+syEtSgXcYdCvm9YxwLaEkH/Zxh8P+xA5kkV2reQ4sSVQbqHGgjlveiYGu8W/rR495RJF68xUOp9Dxpn3h87BQNZFMCwNWW1sceQDl1XDfUHm6Ygrp0g= X-Forefront-PRVS: 0493852DA9 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(6009001)(7916004)(376002)(346002)(189002)(51444003)(199003)(52314003)(24454002)(23726003)(81166006)(93886005)(2906002)(97736004)(72206003)(83506002)(25786009)(39060400002)(16526018)(478600001)(33716001)(8676002)(5660300001)(1076002)(8936002)(189998001)(6486002)(9686003)(966005)(6246003)(66066001)(7416002)(6496005)(54906003)(81156014)(53936002)(58126008)(106356001)(76506005)(101416001)(68736007)(105586002)(7736002)(33646002)(305945005)(229853002)(4326008)(53546010)(50466002)(6306002)(6916009)(2950100002)(16586007)(6666003)(6116002)(47776003)(316002)(54356999)(3846002)(42882006)(76176999)(50986999);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR0701MB3830;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM5PR0701MB3830;23:MnZeVn1iLLXeHxiyEdExM6pRtDJt9/5FpZXic7u?= =?us-ascii?Q?kQKUrd8owUo3wY2gf1UXeibMUqJP3SakD7dAea6fR58SM+9pZb2my5scvc2j?= =?us-ascii?Q?KJwsQAxB+rgebJ3jZT6kFVoUEYU59W5JUoE3/9ZsxUwB6wsGQd0HyLAcfHHX?= =?us-ascii?Q?08bVfRG+bCn9x/J8/AxV3JdAxnfzYSvcR8lejdRIstrNKIS+JUgWPzsULper?= =?us-ascii?Q?PJKh0krALUomQ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UDUGhATMFjhY0=;7:zYXDWQYutnhKKtGP7eXd9caFhFLliWDp8SIm0JGFkdE9v5/vRScGivw8NCWY9x8OVgwjuzQVfOqOWDNEIwcSsYx4OpF+EsAcfrMoBHiTj9mqOvl4gWIzzvkDGeVt/o94IzhwkvQvwyO3Dok95mNjh//bg/UEmYLlWgAuqbl93wBZPzfJmq2/Nrlp4sD3nK2ViRWEk/w3ZfYYuC02rWt6ita5ibLP6TzxZQkQpKPPKJyzEz0l5SJv2Dnc3LQj/ls/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2017 21:29:35.0967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07007ead-f774-4eaa-450f-08d52d392392 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0701MB3830 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 16, 2017 at 01:55:31PM +0000, Robin Murphy wrote: > On 16/11/17 13:07, Yury Norov wrote: > > On Thu, Nov 16, 2017 at 11:54:33AM +0000, Will Deacon wrote: > > > On Wed, Nov 15, 2017 at 01:34:21PM -0800, Sami Tolvanen wrote: > > > > From: Alex Matveev > > > > > > > > Use UNDEFINE_MRS_S and UNDEFINE_MSR_S to define corresponding macros > > > > in-place and workaround gcc and clang limitations on redefining macros > > > > across different assembler blocks. > > > > > > What limitations? Can you elaborate please? Is this a fix? > > > > Hi Will, > > > > Regarding GCC. > > > > When it joins preprocessed source files into single asm file, > > mrs_s/msr_s becomes either not declared or declared multiple times. > > > > ./ccuFb68h.s:33120: Error: Macro `mrs_s' was already defined > > ./ccuFb68h.s:33124: Error: Macro `msr_s' was already defined > > > > I'm not sure that GCC works correctly in this case, and I sent the > > email to Linaro toolchain group to clarify it. See below. > > > > Yury > > > > [...] > > > > Links: > > My unfinished branch: > > https://github.com/norov/linux/tree/lto > > Andi Kleen tree: > > https://github.com/andikleen/linux-misc/tree/lto-411-1 > > Sami Tolvanen's recent work for clang: > > https://lkml.org/lkml/2017/11/3/606 > > > > Question we have for now: > > There's mrs_s/msr_s macro that doesn't work with LTO - linker > > complains very loudly that macro is either not declared, or declared > > multiple times. (To reproduce - try to build my kernel branch w/o last > > patch). > > > > The same (?) problem is observed with clang, and people there > > considered it as feature, not a bug. > > > > https://bugs.llvm.org/show_bug.cgi?id=19749 > > > > We have the fix for both clang and gcc, but it looks hacky. Maybe it > > worth to fix mrs/msr issue on toolchain side? > > Given that this whole mrs_s infrastructure is a workaround for older > assemblers which don't support the "S____" syntax for > arbitrary unnamed system registers (which IIRC was a fairly late addition to > the architecture), the only way it could be "fixed" on the toolchain side is > by removing all those older toolchains from existence. Good luck with that > ;) > > In *theory*, it might be possible to do something similar to what we do with > CONFIG_BROKEN_GAS_INST to detect offending assemblers and only define and > use these macros when necessary (hopefully Clang and other LTO-capable > toolchains do accept the proper syntax), but I've no idea how invasive or > difficult that might turn out to be. Thank you Robin. The "S____" is the feature I was looking for. I'm not going to remove old toolchain from every user machine - I believe if I do, I'll be put into jail finally. :) But I think we should use this syntax for {read,write}_sysreg_s and other functions if assembler supports it. The existing mrs_s/msr_s machinery will be deprecated then, and it will be generally good. Sami told that LTO doesn't work with old toolchains, so I think that it would be OK to disable LTO for old assemblers that doesn't support all necessary features. Anyway, this is not blocking issue because we have patch that workarounds it (again). Yury From 1584268926033474186@xxx Thu Nov 16 23:56:25 +0000 2017 X-GM-THRID: 1584172678511586509 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread