Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2420004pxk; Mon, 14 Sep 2020 12:52:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmqfC1kdccymlwfvvE77W61zH0a878KNMwkQUKAIx6/jmfHQdUe6l3bCCNW3K2uO2PB2R2 X-Received: by 2002:a17:906:5f8a:: with SMTP id a10mr15935568eju.502.1600113141747; Mon, 14 Sep 2020 12:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600113141; cv=none; d=google.com; s=arc-20160816; b=ekZXGFfO7ysj+Srter+4+vyL705iAKYvLK65nRpYB94+Wb37yUvqfP/x5gVgZ2a/pG xWF6iVt1Ii8cctxUOGp+93MbpiQBCgjc5c2S9bvhS4BsYLmcjav/pPS5+1xVFlbLgaGy NBODxoHtxdF1zfZ/Hb2FQ44g3JFdrkAIlBxZGTaRly4NJGV6ph1PT99a4Dg5C9RBNxua 8xEX95Bhf6CDpO0jhsOSjTE4R3mePNsYDTxV1LpCDTfiDqev+S+S1G3G2zHGHcBBHkks bfUfZO43YJyKZmS03/6HozU9E2YBLrJ325G5mpsLfPqlSITyWR1yOx0ffnI+VPzTNZ9R J0SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7Ckdhx/SwxbddCk/MqYKv07k5JNkmWooWLWGErO8zK0=; b=rqPpMTs45Fig2p373I7hKiVzMRjiA3iCK8jxvitWTe31D6vDJqIIg1GRO96AhNACup Jm9zt6aoz/bMXug1kQe0FWe7przf9zAJAQo8+TGcsiL4QsbBzUehelftnPTQ4yAeAuPf qSLJZAA4KuG2zLeiTu8QSx7quxmdaMvoIPgQfSzwhZZg/OLfi5Mr41Zyz8BcY/TOQX/H bZnKoP3uek9EaSlEw5bBi162hy2itufUOPo09G6zUYXJpoTnipf8cDScx+Tb+Xvlu4gg jFdSjPhaYxL9lJqTT913dj9ZMJIQuyN8K81gMRgwqjm2BZG7RQHFxrw2YXIyE/aNHPYt Zm9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UQ1QZCDH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si8490114ejw.227.2020.09.14.12.51.58; Mon, 14 Sep 2020 12:52:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UQ1QZCDH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726013AbgINTvC (ORCPT + 99 others); Mon, 14 Sep 2020 15:51:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21566 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbgINTu7 (ORCPT ); Mon, 14 Sep 2020 15:50:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600113057; 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=7Ckdhx/SwxbddCk/MqYKv07k5JNkmWooWLWGErO8zK0=; b=UQ1QZCDH/olmADVwXQCHHxhDIeHUASBlkaybuOcAYohQiPK/4IWqpUlOrmLd31lG4KnV7g tTKqTvCBwHHXY2onMwVE4kN0p/ET/uuEWX90UaE+uUBdk69AtbuQLq/kxOf0EAFQ01NI4x 76a79+RXraaAciBmvD5KhHjYrKKiPpo= 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-353-rM_tGDFKMBOwdYM7f-I-wA-1; Mon, 14 Sep 2020 15:50:53 -0400 X-MC-Unique: rM_tGDFKMBOwdYM7f-I-wA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5556A800C78; Mon, 14 Sep 2020 19:50:51 +0000 (UTC) Received: from krava (unknown [10.40.192.180]) by smtp.corp.redhat.com (Postfix) with SMTP id 06B6D5D994; Mon, 14 Sep 2020 19:50:46 +0000 (UTC) Date: Mon, 14 Sep 2020 21:50:45 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Stephane Eranian , Jiri Olsa , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Song Liu , "Frank Ch. Eigler" , Ian Rogers , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: Re: [PATCH 02/26] perf: Introduce mmap3 version of mmap event Message-ID: <20200914195045.GQ1714160@krava> References: <20200913210313.1985612-1-jolsa@kernel.org> <20200913210313.1985612-3-jolsa@kernel.org> <20200914153134.GD160517@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200914153134.GD160517@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2020 at 12:31:34PM -0300, Arnaldo Carvalho de Melo wrote: SNIP > > > --- > > > include/uapi/linux/perf_event.h | 27 ++++++++++++++++++++++- > > > kernel/events/core.c | 38 +++++++++++++++++++++++++++------ > > > 2 files changed, 57 insertions(+), 8 deletions(-) > > > > > > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > > > index 077e7ee69e3d..facfc3c673ed 100644 > > > --- a/include/uapi/linux/perf_event.h > > > +++ b/include/uapi/linux/perf_event.h > > > @@ -384,7 +384,8 @@ struct perf_event_attr { > > > aux_output : 1, /* generate AUX records instead of events */ > > > cgroup : 1, /* include cgroup events */ > > > text_poke : 1, /* include text poke events */ > > > - __reserved_1 : 30; > > > + mmap3 : 1, /* include bpf events */ > > > + __reserved_1 : 29; > > > > > what happens if I set mmap3 and mmap2? > > > > I think using mmap3 for every mmap may be overkill as you add useless > > 20 bytes to an mmap record. > > So use just PERF_RECORD_MMAP2. > > I think if the user says: I need buildids, then, in kernels with support > for getting the buildid in MMAP records, use it as its more accurate, > otherwise fall back to traversing all records at the end to go over lots > of files haversting those build-ids. ok, so special record option to enable this > > If the user says I don't want build-ids, nothing changes, no collection > at the end, perf continues using PERF_RECORD_MMAP2. and that's -B option in record > > > I am not sure if your code handles the case where mmap3 is not needed > > because there is no buildid, e.g, anonymous memory. > > It seems to me you've written the patch in such a way that if the user > > tool supports mmap3, then it supersedes mmap2, and thus > > you need all the fields of mmap2. But if could be more interesting to > > return either MMAP2 or MMAP3 depending on tool support > > and type of mmap, that would certainly save 20 bytes on any anon mmap. > > But maybe that logic is already in your patch and I missed it. > > Right, it should take into account if the user asked for build-ids or > not in addition to checking if the kernel supports MMAP3. right, thanks, jirka