Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757880Ab2HVQJQ (ORCPT ); Wed, 22 Aug 2012 12:09:16 -0400 Received: from mail-vc0-f174.google.com ([209.85.220.174]:47033 "EHLO mail-vc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932164Ab2HVQJM (ORCPT ); Wed, 22 Aug 2012 12:09:12 -0400 MIME-Version: 1.0 In-Reply-To: <20120822072822.GA11042@gmail.com> References: <1345585940-6497-1-git-send-email-semenzato@chromium.org> <20120822072822.GA11042@gmail.com> Date: Wed, 22 Aug 2012 09:09:10 -0700 X-Google-Sender-Auth: YEt7HwmjjRK1ANNa6bzk38_OGUw Message-ID: Subject: Re: [PATCH] perf: do not flush maps on COMM for perf report From: Luigi Semenzato To: Ingo Molnar Cc: Alexander Viro , Peter Zijlstra , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo , Andrew Morton , Vasiliy Kulikov , Stephen Wilson , Oleg Nesterov , Tejun Heo , Paul Gortmaker , Andi Kleen , Lucas De Marchi , Greg Kroah-Hartman , "Eric W. Biederman" , "Rafael J. Wysocki" , Frederic Weisbecker , David Ahern , Namhyung Kim , Robert Richter , linux-kernel@vger.kernel.org, sonnyrao@chromium.org, olofj@chromium.org, eranian@google.com Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2467 Lines: 55 On Wed, Aug 22, 2012 at 12:28 AM, Ingo Molnar wrote: > > * Luigi Semenzato wrote: > >> This fixes a long-standing bug caused by the lack of separate >> COMM and EXEC record types, which makes "perf report" lose >> track of symbols when a process renames itself. >> >> With this fix (suggested by Stephane Eranian), a COMM (rename) >> no longer flushes the maps, which is the correct behavior. >> An EXEC also no longer flushes the maps, but this doesn't >> matter because as new mappings are created (for the executable >> and the libraries) the old mappings are automatically removed. >> This is not by accident: the functionality is necessary because >> DLLs can be explicitly loaded at any time with dlopen(), >> possibly on top of existing text, so "perf report" handles >> correctly the clobbering of new mappings on top of old ones. >> >> An alternative patch (which I proposed earlier) would be to >> introduce a separate PERF_RECORD_EXEC type, but it is a much >> larger change (about 300 lines) and is not necessary. > > It would be nice to add that too - we already have FORK/EXIT, > this seems like a natural extension. Yes. Adding PERF_RECORD_EXEC is/would be the right long-term solution. But there are two issues. 1. One nice aspect of perf is that perf.data files and "perf report" are compatible across a large number of versions. Adding PERF_RECORD_EXEC breaks compatibility in a somewhat unpleasant manner. New perf.data files won't work with old versions of perf and *might* fail poorly (segv) although this situation is difficult to analyze. 2. Adding a new record type is messy. It replicates a lot of boilerplate code, much of it in the kernel, and affects many parts of the system. It adds to size, complexity, and likelihood of new bugs. I would prioritize the "would be nice" category as follows. 1. Improve the handling of unknown record types for future better backward compatibility. (Small change.) 2. Refactor/cleanup code to improve readability and robustness. (Big change, but can be broken into many smaller pieces.) 3. Add PERF_RECORD_EXEC. If there is consensus, I might be able to give a shot to 1 and 2 (courtesy of Google). -- 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/