Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2506746pxk; Mon, 14 Sep 2020 15:40:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+hmMkHewBOG/keCS/ERlZ08Vj22CsHzXBlXUcRSJviZKnUhkMDm7uLwaIOc5Eo6nTp/7o X-Received: by 2002:a17:907:7206:: with SMTP id dr6mr17790236ejc.546.1600123207080; Mon, 14 Sep 2020 15:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600123207; cv=none; d=google.com; s=arc-20160816; b=jsIabiU+padIhOjP3ul0fP9A3VoDHejoqF4TyMOkC91Bigel47vDhjS33RiQqMT52f cNDBDfwJ3Y07l4SjXZA1LYpm2e8O6zpfpKrzMtqVJYOBK60odoxxoRRtur7N+lrM6z8E XmsA1qIJPAquT/7HVG4CUazuifHRM6E1b1X71/elsO5Km1RpIjOKEC5yOPhlnlJezcPm PCzKLYl+t0ySHubiBcXkXY0KEpgD0WCZbz8kyT4ihEORcZL5dHlgMHjuxDBNtna1QZdb Fgf+nzCKip9LNydOc6t3bPcPtYoFHD7t+ozTMeahnbzoufVa1/ntXAC9T6Ticlbwm685 TDbg== 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=95GgJFNc3t1pn019Q9w6OD+4Tco3Qz4FH/mqTTF1tt0=; b=i81QMfQuIQxa0Bl46sPFtUyxg95QiOmaNexhcjEYqhOGIHNVkG8fS7TYDYLE7SNlnV OFLvI0L3At/9yaR0omKICsLAFsvdF2FekdEKiRw72KpcKkqJyY5KS1uw3Gqn8BJmZbmh mn004J8kfUow/a9sinGJiFO609UB5vCA1ONHnS832kKXnEg95I3H1HI0rJ7LDlMqPnWK wbHEZrniUTZYE9radaiTogcqg7nfPriP21xH6fNwBVKZHFFaMAxmgfHToqqCJaBlnzT5 I/UmWqJeiAjQhUItdoD2yra3b1b9M5494+pQ52ubtZdZbcP6O8/+6696+VMcDWYUv7s5 lWMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="hKV6/GRm"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x90si8263739edc.81.2020.09.14.15.39.45; Mon, 14 Sep 2020 15:40:07 -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=@kernel.org header.s=default header.b="hKV6/GRm"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726034AbgINWjC (ORCPT + 99 others); Mon, 14 Sep 2020 18:39:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:57572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725986AbgINWjB (ORCPT ); Mon, 14 Sep 2020 18:39:01 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (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 4E1CE20732; Mon, 14 Sep 2020 22:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600123140; bh=wjmspuEMssYc9ED3xKlxbWHRGBVIKDlfpMgFfWNfVMI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hKV6/GRmmwf0SqxcwVp1e/npQy20IVHI/x4VgPzkSaWr6rSwLgRAnuQUvG1/wTjpT /hZMfUF86M8P/p/liRNXAOO0DFk/ed/f3ydUerQPu2wx7iCbCU+67CvYuWS8aqrv7q AICALaZZrtahJeyEz9Nqor9P6c/5HTFZJWo/DpqA= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 7088F40D3D; Mon, 14 Sep 2020 19:38:58 -0300 (-03) Date: Mon, 14 Sep 2020 19:38:58 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa 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: <20200914223858.GL166601@kernel.org> References: <20200913210313.1985612-1-jolsa@kernel.org> <20200913210313.1985612-3-jolsa@kernel.org> <20200914153134.GD160517@kernel.org> <20200914195045.GQ1714160@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200914195045.GQ1714160@krava> X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Sep 14, 2020 at 09:50:45PM +0200, Jiri Olsa escreveu: > 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 Yeah, so if -B is used, MMAP2, otherwise, the best available option, which is MMAP3, which by now means more how you tweak the misc bits and what you collect, buildids or just the maj/min/ino :) - Arnaldo > > > > > 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 > -- - Arnaldo