Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1102120ima; Wed, 24 Oct 2018 14:31:23 -0700 (PDT) X-Google-Smtp-Source: AJdET5f72QV6Etp6I1ljA9tY7lPdjqgZbQwzqaFA28uL++igFpuhV/zI7/plqWmbk7xONAoIR01L X-Received: by 2002:a62:2606:: with SMTP id m6-v6mr4203156pfm.104.1540416683154; Wed, 24 Oct 2018 14:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540416683; cv=none; d=google.com; s=arc-20160816; b=N5JG21S5gLplgkCNeHPolvvibT4ASoe62i+QLyzltp1QWOVBS/e1f/xRaiBbQHGgMH 3H/LMZhHJgOYHX12h65WYxFot0sZuWK0NZE379T7F50zK1ZeePyO8Paav2uix0knTEFA Cf/SYOTn26SAY+lMwzgaxK7TGVWP8kQBzB8xkxNWqFNrrX60ZtybW/Da+PH9jB+CmfJq 8VOLu5uUGoTU0J/6yPdEfhsIhZPMUlivUYRz16SSVao4Gq5r14XjIHmGWXWdchJKCkZm uqmPCLenDt3JL14oKwD66AXAVq4mGYZjmb49VUGTFim2Z79KfiPK1LF27HFFzMRJM3I3 zg7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=DZckZ17DPFV7XNA6MEeZg/rwNiIg0ROU4dyN1hwsdgY=; b=rGufD4ur1AUYHO8OA6fbckxafYBEizxh53JbibAQw8RUd/XSzXgcEjIkuAvcBgpsnq 2OfqlWzNhm/MImrBA2BlVZNrODVI6ANA2TaaBtPlE6XNcD67bHZWonBJKw+5HlaaBpYB 7SHYl2NG7DqtCaT77lN0lQtJil/dya72Ps88zfTrTRytTUBWKMc0fKo0hFEj+N+1rSh8 UxI293Pta6R+7h4BjMnnLKWkPNXhMgYqGWs9tjiz8BUjddJ81+AyJRIkZDWDDMl8g8I8 lyV/lPF9GoC0ppqb0r9EhkFDm/LPZ1nHl9m03xH2bgTchnZVgVT7d6QccZDCjDm5wQ8Z fabw== ARC-Authentication-Results: i=1; mx.google.com; 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 b9-v6si5874915pgh.440.2018.10.24.14.31.07; Wed, 24 Oct 2018 14:31:23 -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; 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 S1726678AbeJYGA3 (ORCPT + 99 others); Thu, 25 Oct 2018 02:00:29 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:41690 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726207AbeJYGA3 (ORCPT ); Thu, 25 Oct 2018 02:00:29 -0400 Received: from localhost (c-67-183-62-245.hsd1.wa.comcast.net [67.183.62.245]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id AC5BC1454A8DA; Wed, 24 Oct 2018 14:30:45 -0700 (PDT) Date: Wed, 24 Oct 2018 14:30:45 -0700 (PDT) Message-Id: <20181024.143045.1124161066942465584.davem@davemloft.net> To: jolsa@redhat.com Cc: acme@kernel.org, dzickus@redhat.com, linux-kernel@vger.kernel.org Subject: Re: perf overlapping maps... From: David Miller In-Reply-To: <20181024113416.GA26027@krava> References: <20181023180503.GA6114@kernel.org> <20181023.111503.1978409398989251135.davem@davemloft.net> <20181024113416.GA26027@krava> X-Mailer: Mew version 6.7 on Emacs 26 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 24 Oct 2018 14:30:45 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Olsa Date: Wed, 24 Oct 2018 13:34:16 +0200 > On Tue, Oct 23, 2018 at 11:15:03AM -0700, David Miller wrote: >> 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 :-) > > how about adding a data file marker/event when the synthesized > portion of data is over > > attached patch adds an 'SYNTHESIZE_END' event and prevents > parent's maps cloning on fork until that event is found > > we would need more code to stay backward compatible, which > I did not include.. just to cleanly outline the solution I appreciate everyone reiterating the ABI issue. Wherein, perf record stashes these events into a file and later analysis tools need to interpret them. Considering this specifically, it is very tempting to make a new event representing this thread "CREATE" operation. But, if we make a new event then existing tools will break because they will see this unrecognizable event and not create the threads. From this perspective setting a misc flag in the FORK event might in fact be the best compromise. Existing tools will still create the thread, in exactly the same existing way. This keeps things working as well as they do currently. So my vote returns to emitting FORK with the special COMM flag set in the misc flags. And we document this properly of course. Any objections? I'll cook up a formal patch meanwhile in case we do agree.