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=-8.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, 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 EF383C433E2 for ; Tue, 15 Sep 2020 02:55:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0616207EA for ; Tue, 15 Sep 2020 02:55:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600138500; bh=+Kychmtn1Qeu5Ym3vJlxDsjFfe2DlfGhJEOT/nrIvBo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=mLXvn0+PqoEdDz+gaKdpks7RbdMINUyWPoBNp08M8tFkLTVDbiAxa/Ljl8a5qf0CL HhZg95dFFGh2wZ6Xt7WW7ycQjWWeHF93T7r8NJfhJ6YTWGsaT8UKAH0HuMRqb204Yf LzXKFTsiQbImBYhx4lzS+0mD2IALWGSf8WW72slg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726117AbgIOCy7 (ORCPT ); Mon, 14 Sep 2020 22:54:59 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54968 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbgIOCy5 (ORCPT ); Mon, 14 Sep 2020 22:54:57 -0400 Received: by mail-wm1-f68.google.com with SMTP id s13so1817963wmh.4 for ; Mon, 14 Sep 2020 19:54:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0cfO0hHUv0ql0LZw8NdlMoLBWTLiyNGCr+tD4ousFFc=; b=Zp2ZlMT4WZpDt9rPs2XkTO5pHh+vNWUZwQTsHkRaAokulEAlaI5OXRuKDR1+pIaJio tY/nDAMI8oxSaV0nGxycfJxPprpUmyaRWrHaEh7HYwals9dQOym1UuMI7Bmm98IaRwRP DuqRdrfrLggMG6yXCU/FZA6gCOiN2zEjNPBLj7WVOU7y8+isFE/0m42p2sIXLFegJBrl PGdvwEJd4geL3ohPR9K50iEkWwfrjA8sG34X+1We9sDg5iC3f+zSHkHBC6+2oYEv17r/ f2D0mDDywLDdirLqjnFWyert3Cr8QKPYiXGl4jzs8AA6uSMMUOo+SqrXUh7M+wkKHOZ5 CKHg== X-Gm-Message-State: AOAM5319BAqNCKa4Mdqupjb+43cjXpxd/vPKyjNBODqx3ZivA4uwii0X rwkeB03UMV0hiuzqZoAp1H3ecXko3GYks047zsZ9m7BHDUM= X-Google-Smtp-Source: ABdhPJyMBRx9h2dd0F1ef2QfilyfH10YEwpQlta4uo7S9kqteJsgI/UonktLaY06SSf1ocFNzhEgqCFly2NxmhAzrPs= X-Received: by 2002:a05:600c:4142:: with SMTP id h2mr2210152wmm.128.1600138495527; Mon, 14 Sep 2020 19:54:55 -0700 (PDT) MIME-Version: 1.0 References: <20200913210313.1985612-1-jolsa@kernel.org> <20200913210313.1985612-3-jolsa@kernel.org> <20200914193841.GM1714160@krava> In-Reply-To: <20200914193841.GM1714160@krava> From: Namhyung Kim Date: Tue, 15 Sep 2020 11:54:44 +0900 Message-ID: Subject: Re: [PATCH 02/26] perf: Introduce mmap3 version of mmap event To: Jiri Olsa Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Michael Petlan , Song Liu , "Frank Ch. Eigler" , Ian Rogers , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jiri, On Tue, Sep 15, 2020 at 4:38 AM Jiri Olsa wrote: > > On Mon, Sep 14, 2020 at 02:38:27PM +0900, Namhyung Kim wrote: > > SNIP > > > > 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; > > > > > > union { > > > __u32 wakeup_events; /* wakeup every n events */ > > > @@ -1060,6 +1061,30 @@ enum perf_event_type { > > > */ > > > PERF_RECORD_TEXT_POKE = 20, > > > > > > + /* > > > + * The MMAP3 records are an augmented version of MMAP2, they add > > > + * build id value to identify the exact binary behind map > > > + * > > > + * struct { > > > + * struct perf_event_header header; > > > + * > > > + * u32 pid, tid; > > > + * u64 addr; > > > + * u64 len; > > > + * u64 pgoff; > > > + * u32 maj; > > > + * u32 min; > > > + * u64 ino; > > > + * u64 ino_generation; > > > + * u32 prot, flags; > > > + * u32 reserved; > > > + * u8 buildid[20]; > > > + * char filename[]; > > > + * struct sample_id sample_id; > > > + * }; > > > + */ > > > + PERF_RECORD_MMAP3 = 21, > > > + > > > PERF_RECORD_MAX, /* non-ABI */ > > > }; > > > > > [SNIP] > > > @@ -8098,6 +8116,9 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) > > > mmap_event->prot = prot; > > > mmap_event->flags = flags; > > > > > > + if (atomic_read(&nr_mmap3_events)) > > > + build_id_parse(vma, mmap_event->buildid); > > > > What about if it failed? We should zero out the build-id.. > > it is initialized to zero in perf_event_mmap > > mmap_event = (struct perf_mmap_event){ > .vma = vma, > ... > > I'll double check build_id_parse won't leave anything half > baked there, but I dont think so Oh, you're right. I missed that.. Thanks Namhyung