Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2413775pxk; Mon, 14 Sep 2020 12:40:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzLIhfqukJNA5pu8cHYoSwAROzbcbabxfooCBaW/ZKBNTWUmspW3Mm/XNDtCpOuMyNY064 X-Received: by 2002:aa7:db85:: with SMTP id u5mr18193363edt.316.1600112408509; Mon, 14 Sep 2020 12:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600112408; cv=none; d=google.com; s=arc-20160816; b=TMY2S+bwNArwq46K5GgGVfHXVCO6ZHvyUo9AGZSTYj/6x4x+l7OLsPtWdB15ml15gw ytFE902HVgVvOx1Xdg+cW/QFa0qPl4m7eDRXAvRUa63SUYvXygRX60UA8vK4tsFC5VtC v1Gzx2LiyRHmi9a251kJJX5HBjPF5VIc8iLJFUW8GS/dw/cc5qwRqEDroAOLo03LTdZc 95cKxhRHKxD4PSqhIlYU8dbKQ2w8sShvpu+1PJ+HhknJZUnuuCpDyVlvBhwbpSeOB/6o 7eA1C2eN3VP8O69nanJ4TkbyUUdONu6wdJS1FMJEQBwp1NsWk+wY9UWu9UP370pnJAQh 2QGg== 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=vmY3KqhhGvzV+d5TP9N2N7K426wvJo+nZ3Drl42v3nI=; b=mwTQjxjzRDociD0r6ZgejFdasKkwq3E7XZh3pSUJCQSM+T6B2CkPr5QwRLBHKwlkGJ VQEHc4Ixq2QMNbQnbPWtiteHWH7mUFw4j7J9mS4jLCoarwPJjdYoE2iCE3hTbPwZqoZw H0Rho+RMkjsTCrVAg7yerEOeVhUQOTwI0tm7yipMtPApmL2quMQL1D5lQVZcebEUa/X6 atRSSDh8cSBZLJ+CnuFFmRJ/GClldiKR+5vI/6GkDGxacP2YKKgET4vz12FfbKRFu2KW EI27NunCGGjiVtUwJc3pRlQfB3GwQ0vgMlohJjf8KPj09FzUKuHD7bvh36tR6mZhCbil AL9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F6tVZrBa; 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 i26si7494399ejx.591.2020.09.14.12.39.46; Mon, 14 Sep 2020 12:40:08 -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=F6tVZrBa; 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 S1725961AbgINTiy (ORCPT + 99 others); Mon, 14 Sep 2020 15:38:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48001 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725914AbgINTiy (ORCPT ); Mon, 14 Sep 2020 15:38:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600112332; 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=vmY3KqhhGvzV+d5TP9N2N7K426wvJo+nZ3Drl42v3nI=; b=F6tVZrBa8P3bcstN1qylkOabQ8XOKORBDy147BtzE7UnExQlsmOWZM1Eq/r80HiIO0jJFb cXWPqg9GgSiXGBVkflJ5PTwRONYpBb8+gj34FGPxmIhTxtiu3Xp6JeS/T0Z1cbVnWEDUCi +uowVEvzyFXspcV8e/4pIIyB4Y5zIPs= 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-511-kSYcYa3PPQqkzgxPKq5kqg-1; Mon, 14 Sep 2020 15:38:50 -0400 X-MC-Unique: kSYcYa3PPQqkzgxPKq5kqg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CEC181882FBB; Mon, 14 Sep 2020 19:38:47 +0000 (UTC) Received: from krava (unknown [10.40.192.180]) by smtp.corp.redhat.com (Postfix) with SMTP id 4BDF95F9C1; Mon, 14 Sep 2020 19:38:42 +0000 (UTC) Date: Mon, 14 Sep 2020 21:38:41 +0200 From: Jiri Olsa To: Namhyung Kim 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 Subject: Re: [PATCH 02/26] perf: Introduce mmap3 version of mmap event Message-ID: <20200914193841.GM1714160@krava> References: <20200913210313.1985612-1-jolsa@kernel.org> <20200913210313.1985612-3-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 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 thanks, jirka