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=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 730DCC56202 for ; Fri, 13 Nov 2020 11:03:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AB892224F for ; Fri, 13 Nov 2020 11:03:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PH3LGmGs" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726491AbgKMLDB (ORCPT ); Fri, 13 Nov 2020 06:03:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23180 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726406AbgKMLCC (ORCPT ); Fri, 13 Nov 2020 06:02:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605265294; 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=UVE4VAhfFASKDQr/1v00W+jjf/yyMEehnVZpEYjNa+8=; b=PH3LGmGs41gXNdDGUZphIfogLSkEp4KNeAHuo7qVz/xNdKua7OY1xO+16bM5/lxhvWEfwt 1I6R1OdoNlfc66ZciE3g2+UM6S6Sui7XEZOl9B9c8P5oQlHUlKuRfiT2ZHcisbNl1EcyXF iT5Qv69MRIBn9r3TMhLNVhagtFyY2zE= 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-499-6yUCoA48NmOa_rKiChn_-Q-1; Fri, 13 Nov 2020 06:01:32 -0500 X-MC-Unique: 6yUCoA48NmOa_rKiChn_-Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9571D1084D6C; Fri, 13 Nov 2020 11:01:29 +0000 (UTC) Received: from krava (unknown [10.40.195.79]) by smtp.corp.redhat.com (Postfix) with SMTP id 638E473660; Fri, 13 Nov 2020 11:01:26 +0000 (UTC) Date: Fri, 13 Nov 2020 12:01:25 +0100 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 , Ian Rogers , Stephane Eranian , Alexey Budankov , Andi Kleen , Adrian Hunter Subject: Re: [PATCH 03/24] perf: Add build id data in mmap2 event Message-ID: <20201113110125.GD753418@krava> References: <20201109215415.400153-1-jolsa@kernel.org> <20201109215415.400153-4-jolsa@kernel.org> <20201113042935.GA167797@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201113042935.GA167797@google.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 13, 2020 at 01:29:35PM +0900, Namhyung Kim wrote: SNIP > > > > struct { > > struct perf_event_header header; > > @@ -7997,13 +8003,23 @@ static void perf_event_mmap_output(struct perf_event *event, > > mmap_event->event_id.pid = perf_event_pid(event, current); > > mmap_event->event_id.tid = perf_event_tid(event, current); > > > > + if (event->attr.mmap2 && event->attr.build_id) > > + mmap_event->event_id.header.misc |= PERF_RECORD_MISC_BUILD_ID; > > + > > perf_output_put(&handle, mmap_event->event_id); > > > > if (event->attr.mmap2) { > > - perf_output_put(&handle, mmap_event->maj); > > - perf_output_put(&handle, mmap_event->min); > > - perf_output_put(&handle, mmap_event->ino); > > - perf_output_put(&handle, mmap_event->ino_generation); > > + if (event->attr.build_id) { > > + u8 size[4] = { (u8) mmap_event->build_id_size, 0, 0, 0 }; > > + > > + __output_copy(&handle, mmap_event->build_id, BUILD_ID_SIZE); > > + __output_copy(&handle, size, 4); > > + } else { > > + perf_output_put(&handle, mmap_event->maj); > > + perf_output_put(&handle, mmap_event->min); > > + perf_output_put(&handle, mmap_event->ino); > > + perf_output_put(&handle, mmap_event->ino_generation); > > + } > > perf_output_put(&handle, mmap_event->prot); > > perf_output_put(&handle, mmap_event->flags); > > } > > @@ -8132,6 +8148,11 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) > > > > mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size; > > > > + if (atomic_read(&nr_build_id_events)) { > > + build_id_parse_size(vma, mmap_event->build_id, > > + &mmap_event->build_id_size); > > This can fail, right? Then we need to fallback to use dev/ino.. right, I did not implemented fallback in here, but I think you are right.. we should try to do the best in fail, I'll add it thanks, jirka