Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp3861578ima; Tue, 23 Oct 2018 12:28:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV62wAm3QPZNO3+J3eUrNKVZkHDxKR4EpEFuuIbghGC2akYpVeg6lVFvJ/hliqo5SmWq4JzVC X-Received: by 2002:a17:902:bc8a:: with SMTP id bb10-v6mr18279975plb.99.1540322922389; Tue, 23 Oct 2018 12:28:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540322922; cv=none; d=google.com; s=arc-20160816; b=QQTLFvvPjTwuVoapfjYw/SGDXCOXldoSqAOv/cR/B1VHnYMyCIqeC+CAcwFjiWmq7Y Q2/vKX2W0CAP/Utq2qFbi7P1NirGuB3nDNEJoQklhLpRuUDfDnW2RCJVSo8QL2tzZyWC O2OqjItjcOXg/2Qv1hZUuJEvPdlUgPxxbBBE76T4zeh5+rq9YKOref9yRqWqwAqg6im/ 3CxY8Ovrmw/zB8JkjIYlQpj8ToqBrZT04xuvgCT8kbHvQVEc3sM1AvZnkrAl+mtcH1B6 qkKpmVpg/XeNOij0NJNVoPOthMISaFvnVCX4Fq8/cwD3W8WY9xazrqhDrPKiKJaZ7nj2 r0Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=v3/WuE3qj8wmSV/h5oTWPkycuyzld/rM8UELeDgwoiI=; b=VyBUvdPwiBPJ9h0Q2WPbbE4TyEpBrYHm4I7TWQU1mCDrK22YiLLZM1Kj2ZWpT2ai9a xP4nDZB6PLoRIu28h1gN09PS32s+m66ZvX+Xlt6FCyzjlg4GwUrucHAfF0yNFLFhTaEp 7+LQdntQaIBj9HyGznGlwHz3Mf5zustfGjRr41UO+qR9qeiAEfk+dexeHBHr3UY1E7gw 03vNVU9XymJUWWDa1o6KMi14mFtVtGEWiUlaSVM4ClgRZrctFmgaKjK5LI2HpBCejn8o r99rWqiKBf0GVd5xRYC9m+B0wyLuC2+PcqVsUgBOEd+MI7kW0ss4lsz+VTEHE4pA41Sp LoKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Qm0KLMMq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11-v6si2178510plg.125.2018.10.23.12.28.23; Tue, 23 Oct 2018 12:28:42 -0700 (PDT) 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=@kernel.org header.s=default header.b=Qm0KLMMq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728760AbeJXDwi (ORCPT + 99 others); Tue, 23 Oct 2018 23:52:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:55194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727758AbeJXDwi (ORCPT ); Tue, 23 Oct 2018 23:52:38 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA13120651; Tue, 23 Oct 2018 19:27:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540322872; bh=CO5Wozb6bKk7bN3jfhKDCP2in90zXgHtCEmYScyJPzA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Qm0KLMMqV/tZhDicztLSpe9DrTs5ts12Mx/q7+q0odocxw1jdMkFnxGGOJDK38bnb AbJnfwFdGPUGERwKQ0h7uhJbNSfTF9fvpVMcLoaeZ7iqg1qhLxdSijuimcRvWvShwL ZBzu+TYWnUhbu4+rbSezFBaCkg5OP8w8mmOSSuCA= Received: by jouet.infradead.org (Postfix, from userid 1000) id 268A1142C5E; Tue, 23 Oct 2018 16:27:50 -0300 (-03) Date: Tue, 23 Oct 2018 16:27:50 -0300 From: Arnaldo Carvalho de Melo To: David Miller Cc: jolsa@redhat.com, dzickus@redhat.com, linux-kernel@vger.kernel.org Subject: Re: perf overlapping maps... Message-ID: <20181023192750.GC6114@kernel.org> References: <20181023063452.GB20075@krava> <20181023.105405.364015687995752826.davem@davemloft.net> <20181023180503.GA6114@kernel.org> <20181023.111503.1978409398989251135.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181023.111503.1978409398989251135.davem@davemloft.net> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Oct 23, 2018 at 11:15:03AM -0700, David Miller escreveu: > From: Arnaldo Carvalho de Melo > Date: Tue, 23 Oct 2018 15:05:03 -0300 > > IIRC this was first done for 'perf record', where we have to stash those > > events in the perf.data file, to then, later, 'perf report' to process > > those, so when working on 'perf top', it just reuses that machinery. > > Sure, with some love and care 'perf top' could do better and update all > > the data structures directly :-) > Thanks for the history, it is useful information :) > > Anyway, have you guys considered tweaking using event->header.misc |= > > PERF_RECORD_MISC_USER? The kernel leaves that as zero for the > > PERF_RECORD_FORK it emits: > I really would like to steer the approach away from using UAPI > perf_event fields in an internal way. > I am really very sorry for suggesting such a scheme myself in the > first place. It really was a bad idea upon much consideration. > The synthetic fork is not really a fork, it's more like a "create". > And this fundamental semantic difference is why we have all of these > issues wrt. handling COMM and parent map inheritance. > There is also a bunch of non-trivial code to deal with whether we > synthetically create the child or the parent first, wrt. finding > thread leaders and parent threads. > What I'm trying to say is that there is a clean design based solution > hiding somewhere in here and I'd like to find it :-) So, this is all because we're trying to recreate things that happened in the past, for threads we're interested in but couldn't catch the PERF_RECORD_{FORK,COMM,MMAP} when they originally take place. Ideally we would recreate them in the exact same order and with the exact same details, which was kinda what was intended, but as you're seeing is failing at that in various cases. Also if we keep using this abstraction, i.e. synthesize in userspace what the kernel does, generating PERF_RECORD__{FORK,COMM,MMAP}, then older tools will continue working with perf.data files generated by a new, fixed up 'perf record'. And nowadays there are other tools that read perf.data files: http://code.qt.io/cgit/qt-creator/perfparser.git/ https://doc.qt.io/qtcreator/creator-cpu-usage-analyzer.html Or do you think we should introduce new record types that deal better with pre-existing threads/maps? - Arnaldo