Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1061383pxb; Fri, 13 Nov 2020 03:14:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIFcGGfdaJrLFv0G733nyj6KQnuk/s7w/NzB3fWb1ujEB1SMAI01qe0IgxEIhsMaPT6e2y X-Received: by 2002:a17:906:b20c:: with SMTP id p12mr1375558ejz.369.1605266045236; Fri, 13 Nov 2020 03:14:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605266045; cv=none; d=google.com; s=arc-20160816; b=eNlPvo1osTdwTCLC868+pqCf8YFMyLDWkIVP+zXFPuFVYntUpAoOIxRV5EaaJkBW/q uYj7xvlPJ/dAd7DUR7w9PIFg6UHDM/92+gnbtZCEJnBiHSannXfiuYKnUn47XvjGDkJf JV42fWkoLAIGBb0PYld1MoXwPlyNOjyXyoeRf4mVLu6AJugVM98v3a3DFL8FVkRxAjPq TOKkpzvZz3zMKHLV26nakbRSqv0ruSOhyuhoihiJt4ZN5zMFBejx3aAC6mLA2wH860sm wGxp3H/lCmCBHNFuVEs5rGWPXdBYZQtsuSGB7mAFxRUpYOHxKdbAcIOvTFBLiE70jcR3 +0nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=xk+V7EV4JI6HGoh34X7wSjp5h6BjQD40ushemGIgOxE=; b=0eQSNFkmU12libfXB1gS6jTMUqIQFyG2TJI4TzOX8Hst7Z6VARU6V7+CgCZyV3jzK+ VtpQjHLgd6v0Vx1PKY/JOff2RIECwd4tTnut5TGtRsytKz5tBu/JdWvZBVkzL+Sy0/3k QwlD9Z2rQt9zzmndp12c+FaFT5kbC+d60tjPWO4WXzDw2J/rTalp5+z/zBtOxaD4Bm6U 5BxSyue6DCfTQG8Mtt1V70ErhljOy8CqnQLrF+2xi9x8o2ElbGq3ls1G9x4pNffEHFhe tRjbSOQE26vKX5hOS0y5wdec3+S84Xw5eJnzMbKOPol8fqgeV5ZVj178fercbIB1Q46F lalw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f5VjDPjA; 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 pj7si5509553ejb.254.2020.11.13.03.13.41; Fri, 13 Nov 2020 03:14:05 -0800 (PST) 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=f5VjDPjA; 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 S1726509AbgKMLLj (ORCPT + 99 others); Fri, 13 Nov 2020 06:11:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:44347 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726629AbgKMLKX (ORCPT ); Fri, 13 Nov 2020 06:10:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605265822; 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=xk+V7EV4JI6HGoh34X7wSjp5h6BjQD40ushemGIgOxE=; b=f5VjDPjAoChlDuwirGX+P9Wk1WEKBdEUOAXbZpp+NMibzCTLIowU1YlAWih86YIZohU0ie ncocFY40qq5SJ7sLKynNlxwjApnKLwMyxBoWULmZVlVyGPLyjLA3Z3gnVuJ3bnejaD5URt +KQG77lwgjdSCcbn1vvti5rxCW+b2NQ= 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-280-TYjYoVW7N3SHNQzocCV3Xg-1; Fri, 13 Nov 2020 06:10:18 -0500 X-MC-Unique: TYjYoVW7N3SHNQzocCV3Xg-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 9C4AD18B9F36; Fri, 13 Nov 2020 11:10:15 +0000 (UTC) Received: from krava (unknown [10.40.195.79]) by smtp.corp.redhat.com (Postfix) with SMTP id B1E866EF66; Fri, 13 Nov 2020 11:10:12 +0000 (UTC) Date: Fri, 13 Nov 2020 12:10:11 +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 15/24] perf tools: Synthesize build id for kernel/modules/tasks Message-ID: <20201113111011.GF753418@krava> References: <20201109215415.400153-1-jolsa@kernel.org> <20201109215415.400153-16-jolsa@kernel.org> <20201113043222.GB167797@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201113043222.GB167797@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:32:22PM +0900, Namhyung Kim wrote: > On Mon, Nov 09, 2020 at 10:54:06PM +0100, Jiri Olsa wrote: > > Adding build id to synthesized mmap2 events for > > everything - kernel/modules/tasks. > > > > Signed-off-by: Jiri Olsa > > --- > > tools/perf/util/synthetic-events.c | 33 ++++++++++++++++++++++++++++++ > > 1 file changed, 33 insertions(+) > > > > diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c > > index a18ae502d765..a9d5d1ff2cad 100644 > > --- a/tools/perf/util/synthetic-events.c > > +++ b/tools/perf/util/synthetic-events.c > > @@ -347,6 +347,32 @@ static bool read_proc_maps_line(struct io *io, __u64 *start, __u64 *end, > > } > > } > > > > +static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event, > > + bool is_kernel) > > +{ > > + struct build_id bid; > > + int rc; > > + > > + if (is_kernel) > > + rc = sysfs__read_build_id("/sys/kernel/notes", &bid); > > + else > > + rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; > > + > > + if (rc == 0) { > > + memcpy(event->build_id, bid.data, sizeof(bid.data)); > > + event->build_id_size = (u8) bid.size; > > + } else { > > + if (event->filename[0] == '/') { > > + pr_debug2("Failed to read build ID for %s\n", > > + event->filename); > > + } > > + memset(event->build_id, 0x0, sizeof(event->build_id)); > > Likewise, we should not set the misc bit here IMHO. right, will implement the fallback jirka