From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34150C3815B for ; Mon, 20 Apr 2020 08:44:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0907820A8B for ; Mon, 20 Apr 2020 08:44:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="D77KsTEE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726445AbgDTIoC (ORCPT ); Mon, 20 Apr 2020 04:44:02 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:41227 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725775AbgDTIoB (ORCPT ); Mon, 20 Apr 2020 04:44:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587372240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KEfwhizf7BkYqGUzu6WkakHWV0slETFdQNjsonsJYcs=; b=D77KsTEEGXkZ6zmtg8bM9CyNaBhZ/X0RwOFkdYdPkmqz5ibDFWuVrVbNwAEnMOvpxGB8dI xZmD75CORHgT44wJrYJjiYkrHzdfsfbmIhEgojycH+UshzgkF8zl7SIteqdEmYIeFF1Ehs hVVOfckFNnbtfooHRSf1TyZOOssTkDM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-290-gzt6m-QpPCagvY6lkupELg-1; Mon, 20 Apr 2020 04:43:58 -0400 X-MC-Unique: gzt6m-QpPCagvY6lkupELg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B14FE1005513; Mon, 20 Apr 2020 08:43:56 +0000 (UTC) Received: from krava (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5D0D11A1F7; Mon, 20 Apr 2020 08:43:41 +0000 (UTC) Date: Mon, 20 Apr 2020 10:43:39 +0200 From: Jiri Olsa To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Kan Liang , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH] perf record: add dummy event during system wide synthesis Message-ID: <20200420083720.GB718574@krava> References: <20200416004713.192740-1-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200416004713.192740-1-irogers@google.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 15, 2020 at 05:47:13PM -0700, Ian Rogers wrote: > During the processing of /proc during event synthesis new processes may > start. Add a dummy event if /proc is to be processed, to capture mmaps > for starting processes. This reuses the existing logic for > initial-delay. > > Suggested-by: Stephane Eranian > Signed-off-by: Ian Rogers > --- > tools/perf/builtin-record.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c > index 1ab349abe904..bab4fc8568d1 100644 > --- a/tools/perf/builtin-record.c > +++ b/tools/perf/builtin-record.c > @@ -805,16 +805,18 @@ static int record__open(struct record *rec) > int rc = 0; > > /* > - * For initial_delay we need to add a dummy event so that we can track > - * PERF_RECORD_MMAP while we wait for the initial delay to enable the > - * real events, the ones asked by the user. > + * For initial_delay or system wide, we need to add a dummy event so > + * that we can track PERF_RECORD_MMAP to cover the delay (of waiting or > + * synthesis) prior to the real user events being enabled. > */ > - if (opts->initial_delay) { > + if (opts->initial_delay || target__has_cpu(&opts->target)) { hum, how this works for system wide? IIRC the delay works for monitoring tasks by setting dummy with enable_on_exec, and enabling the rest by ioctl after the delay.. so without the monitored task there's no enable_on_exec effect jirka > if (perf_evlist__add_dummy(evlist)) > return -ENOMEM; > > + /* Disable tracking of mmaps on lead event. */ > pos = evlist__first(evlist); > pos->tracking = 0; > + /* Activate dummy event immediately. */ > pos = evlist__last(evlist); > pos->tracking = 1; > pos->core.attr.enable_on_exec = 1; > -- > 2.26.0.110.g2183baf09c-goog >