Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760935AbbKTShh (ORCPT ); Fri, 20 Nov 2015 13:37:37 -0500 Received: from mail-bn1bn0108.outbound.protection.outlook.com ([157.56.110.108]:51234 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1760879AbbKTShX (ORCPT ); Fri, 20 Nov 2015 13:37:23 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brianrob@microsoft.com; Date: Fri, 20 Nov 2015 10:36:58 -0800 (PST) From: Brian Robbins X-X-Sender: brianrob@BRIANROB-ZB-1 To: Stephane Eranian cc: Brian Robbins , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] perf: Fallback to JIT support for mmap'd non-ELF binaries. In-Reply-To: Message-ID: References: <1447960147-2681-1-git-send-email-brianrob@microsoft.com> <20151119193101.GQ3816@twins.programming.kicks-ass.net> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Originating-IP: [131.107.147.53] X-ClientProxiedBy: BY1PR16CA0040.namprd16.prod.outlook.com (25.162.29.50) To BLUPR0301MB1586.namprd03.prod.outlook.com (25.162.214.20) X-Microsoft-Exchange-Diagnostics: 1;BLUPR0301MB1586;2:ktsa4BHZTKqMaEW9z1vw5QPD73n5MhY/GxcrN/wWGW9QE7ofk86E896OuIMVYfL3rqCAdkttbL5agmGYk00qCnjQ73rvcSNvk4tBHB1VNDG+d4N/0Z//rnAyGvu6GCmaY+Kho2/W5wxfc6358bRs1w==;3:v951e/JbmQypWpHWcyc8DThfiaFhZXxw74bD72cW9SeXIypu1BIajCXOIF4fVdE+GTHKc6Q4x2HwQWciHmF/YKzQMGt0J9VD2BOaXiVIFyoeB2DpCHo1Z5d7fMqmpmQ5;25:WUVGXxOs0LcVVCfhZlhVwmp1DbDt4CrIkIyr6mWsai8YVn5IxlTXwEuvMwPP/fPGZpJonO3nQ22ND7AkFK7cggUdgOdQwvM7WWYBwnZPkgYoTlMrdgT44vy1qr/03GrYXjjPwgoNj538UgupmmsjmowydU+4M+X5hyfILd4Met0g1gEU6neZV0X43CuIE1ZXPdn6BFlfKwRFo8cXPqVmcJuBV/HE0dagOLCPNKZpLZ77k7ZEMz4Q4czNWVkoIKBeoHtR4MleDW7v4cCgwpknGQ== X-Exchange-Antispam-Report-Test: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB1586;UriScan:(108003899814671); X-O365EOP-Header: O365_EOP: Allow for Unauthenticated Relay X-O365ENT-EOP-Header: Message processed by - O365_ENT: Allow from ranges (Engineering ONLY) X-Microsoft-Exchange-Diagnostics: 1;BLUPR0301MB1586;20:0e/tLpRnD8w/Hrnni33jh3bGSU69aR/XQCfhkTYZZhuYyCcMwwotnqz0u5HtZ1EqaRmkjBX8aOYWbmpELOyQFdt0WBO3aBOLNc/ALkYOfad5wgVqXdKGHsgvunJnBFUQeEoD0RnlhW17Q5eye99GCiUKDgYdsz/7x/EiJQYKZjMUxf0UbhHoQh72tgfQZc7/gq8bojsJFef3twsQ49kh+bgDiMk2jxY2LKAc62BtW+E0gtX5IX0wXhA0TJlYlJ77rID5BIOEXGbWSgyGT3QKwaKxgauwyb6szu8rOQ18H1C5pGbX5qQpPT7Cm/8NarQoTf5jhyKvOnIvDp0V4zw0oTzdfSyWFoJ1EJwZWOdPwBM13FhBedX7sOxY5DgIkGZNlw2fc/oS6maR9R/csRZwtRoKWFoQUlICpsEmME6lAz9zvclJHQsUCEp6gpEeWh1SVwgKxrKJXKGAhalD41CeJIn5jmS7WTB5UNkfrJPVGw3KdYFo19MMy2eI3CzByewVHNKj1kfAVMzXmxLFXbPgRELAKcFnEZoHc7PykJGd6bLIPOmKdWOb+QS9QK1MgiIdt9nuhAmcZ3nu/epijElhjq4cafJ7JkNOYLoqAUJZiT0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(10201501046)(3002001);SRVR:BLUPR0301MB1586;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB1586; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0301MB1586;4:+WTqJNe3ZpSQsspOYGsh0xDKu6qNdvXqcGlrmavpmoI09bK3PMZUoBJ5m/N0gdlShyZ9gpsUPRaoUNFGLSO1eRNw/Zj8otWdKUYI3q9qUSFYpvM9JMVkxpnVRxAIHotY3M6e6wyze/IeFLLCv2tsCNuqLMdchwkl0/4ZNNJweWRaRBGdkAOTsLTgwE9Ig71NTxVq+RmBvCsZI/hCXx3/Y7HadZhfRB+UmVVKuwcEek1/xkMTfDVqF3s19M9AYpsreAzVHwbiAUg2SKp/Zsat1A4+ymapy+JgOApc3nynZqE1Xgr4IHS9/T+GpUYEVb/NYQTHGk/CxOmeOAWTi+siNUgDqfamlAwF0jPYlXrZIPRmlsCVDalY7mGZlmGmW+BSYcRPs1uChi3dlUeW+A4M7zAdLLXjR4qzQ4sShkMaXjkci1d6Gp6aR86fK0uMvcbu X-Forefront-PRVS: 07665BE9D1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(6049001)(199003)(189002)(24454002)(43784003)(377454003)(101416001)(106356001)(47776003)(97736004)(42186005)(5004730100002)(81156007)(5007970100001)(93886004)(6116002)(189998001)(3846002)(586003)(66066001)(110136002)(105586002)(5001960100002)(4001350100001)(33716001)(19580405001)(10090500001)(83506001)(86612001)(122386002)(5008740100001)(10290500002)(19580395003)(87976001)(76176999)(92566002)(50986999)(54356999)(2950100001)(5005710100001)(86362001)(40100003)(77096005)(23726003);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0301MB1586;H:[10.83.44.118];FPR:;SPF:None;PTR:InfoNoRecords;A:3;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR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4?= =?us-ascii?Q?0qlzocXwPC+reO5bZ1VC9+pQSMwGGOlivO+3YvGfNa3QrwcDHMn4BVO/1QiP?= =?us-ascii?Q?Da+HNxihht34SvvzNNCUXxGHK1RYUqvAgev3OmRpPh24ZzjAOAvH9larYQ8k?= =?us-ascii?Q?gMwVbek8TMxAPgebLR6uiagIsDy0DOq+hk9k4ed0syQH8CVIrTW8xNxVfZaN?= =?us-ascii?Q?KHb9vGRYGKLqj5s0y+3VHkbbkFb9SG/tjS/GLjz/bEpIuhUa4Y63UWQ5KlbG?= =?us-ascii?Q?3OoTxciq46dHQQhGZ+A4c2pK41l5OfwjRoeHgSa8Qf89fdCI+wWtJBatzOgS?= =?us-ascii?Q?TPAjfkeeVR7/tXrwSc3kZH6EJDmv3DaFPimlz?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR0301MB1586;5:7Vum75oY8txYFIuc9UzIJ+kYEf64F/dbeCFfBIYz/3lqw5K5vfjRnapX1C6ARYX32s/A/FFKIA4sfbWcu1Th2p4c3cj/Xs3vcV2k7LQuUaxnN/idjhAFhUp8jQJ61RdZePkSv7gvy9pIqyQEbMlsiw==;24:OXlS+r/CK+zBzrDzy9aIt1yCv1fq6IfoAuRiIlXCf2TR06JhjVYMxy0vJoTfyCXD+5hZ69d+syq5wSs767x/G4NKtCyFrgQPd3/aaLpcVwU= X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2015 18:37:20.1652 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB1586 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3558 Lines: 77 On Fri, 20 Nov 2015, Stephane Eranian wrote: > On Thu, Nov 19, 2015 at 3:45 PM, Brian Robbins wrote: > > > > From: Peter Zijlstra > > Sent: Thursday, November 19, 2015 11:31 AM > > To: Brian Robbins > > Cc: Ingo Molnar; Arnaldo Carvalho de Melo; linux-kernel@vger.kernel.org; Stephane Eranian > > Subject: Re: [PATCH] perf: Fallback to JIT support for mmap'd non-ELF binaries. > > > > > On Thu, Nov 19, 2015 at 11:09:07AM -0800, Brian Robbins wrote: > > > > Programs can execute code contained in files that don't conform > > > > to the ELF standard. This is common for cross-platform runtimes > > > > that support ahead-of-time compilation. In this case, perf is > > > > unable to resolve addresses to symbolic names, as the format of > > > > the mmap'd file is unknown to perf. > > > > > I'm assuming you're using PECOFF? Why not teach perf to read those? > > > > > Surely there's a library that can parse that stuff, it seems to me Wine > > > for one needs fairly decent support for this, also GDB (and other > > > toolchain bits) on Windows targets. > > > > > Its just that I was hoping we could move towards getting rid of those > > > /tmp files now that we have much better JIT support. > > > > Hi Peter, > > > > Thank you for the feedback. The file format is similar to PE, but is not identical. So, we would be implementing something very scoped, which doesn't feel right to me. > > > > I am interested in the new JIT support, however my understanding from the information that I've read is that it requires kernel support in 4.x, though I can't seem to find where I read that. I want to make sure that this works on older kernels (3.x) as well. > > > You need 4.1 if you have a situation where your JIT may recompile code > multiple times. The key difference is that > with 4.1 you can use the same timestamp clock source for both the JIT > runtime and the kernel perf_event subsystem. > That makes it possible to correlate samples from the JIT with samples > from the hardware. Without that, you may not > get correct symbolization if the code is re-jitted or moved. > Thanks Stephane. That's good to know. Unfortunately, because the scenario here is not actually a JIT, it requires a bit more control around when the data is generated. Specifically, the requirement is that the data be generated offline as opposed to when the process is running. Rather than using virtual addresses, we use offsets from the beginning of the file, and then update the data adding in the base address of the loaded file to get the full virtual address after the data has been collected. Thus, the scenario is a bit different than a JIT scenario, but can re-use some of the plumbing. Knowing this information, does this scenario sound OK? I'd be happy to look at seeing what it would take to make this a bit cleaner (and deprecate the tmp file), but am keen to enable the scenario sooner rather than later. Thanks again for your consideration. -Brian > > > > The reason I went with this approach is because it is simple for runtimes to implement and has no requirement that perf understand the file format. I am open to feedback if there is a preferred solution that would still work for older kernels as well. > > > > Thanks. > > -Brian > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/