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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07133C4708C for ; Wed, 23 Nov 2022 13:46:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235953AbiKWNqm (ORCPT ); Wed, 23 Nov 2022 08:46:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238308AbiKWNqY (ORCPT ); Wed, 23 Nov 2022 08:46:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DFC1E1BF9; Wed, 23 Nov 2022 05:35:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D176B81FE2; Wed, 23 Nov 2022 13:35:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA1E3C433D7; Wed, 23 Nov 2022 13:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669210511; bh=eqQhB3JpwUD9N1JaSv+YIyRx7mv/TnGAZqN9bDQUYdM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NIefZlfTT8OgpJHFnIhhhXYooyAZkBLK10g1K2THsxX/tEFzwWUSuRxX+beX97nCS yLTfZbaJxy1ZwTF5P6BRSbJdlvSldo3IktNkfW82ysLHUD0g0W+QVYGYVDwqWvq8hl EfTr0PWMVUauhXX3b2tSYA54dWa/YuKcRv1g3rJch/cwlONnhwBPbZ9+h8+j0kz9C4 Fn3c+3+lHDJ3WMWUXiPfE9T7qmOxm8VjKCxdrcFYI47NR1tIEqDpFEDOhZCd9dWKlH h65gpcvv8ksMYggTocV4gFZNx54mNWpgiqbM+/yMrm9vxj47HEVAd/BbTBma4G5g0Z Nv7MyaTlyT81A== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id B4E514034E; Wed, 23 Nov 2022 10:35:09 -0300 (-03) Date: Wed, 23 Nov 2022 10:35:09 -0300 From: Arnaldo Carvalho de Melo To: Adrian Hunter Cc: Namhyung Kim , Jiri Olsa , Ingo Molnar , Peter Zijlstra , LKML , Ian Rogers , linux-perf-users@vger.kernel.org Subject: Re: [PATCH] perf inject: Set PERF_RECORD_MISC_BUILD_ID_SIZE Message-ID: References: <20221119002750.1568027-1-namhyung@kernel.org> <5e408880-3394-c943-6ed5-6ceb8d05fd07@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e408880-3394-c943-6ed5-6ceb8d05fd07@intel.com> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org Em Mon, Nov 21, 2022 at 10:45:14AM +0200, Adrian Hunter escreveu: > On 19/11/22 02:27, Namhyung Kim wrote: > > With perf inject -b, it synthesizes build-id event for DSOs. But it > > missed to set the size and resulted in having trailing zeros. > > > > As perf record sets the size in write_build_id(), let's set the size > > here as well. > > > > Signed-off-by: Namhyung Kim > > Acked-by: Adrian Hunter Thanks, applied. - Arnaldo > > --- > > tools/perf/util/synthetic-events.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c > > index cccd293b5312..0645795ff080 100644 > > --- a/tools/perf/util/synthetic-events.c > > +++ b/tools/perf/util/synthetic-events.c > > @@ -2218,8 +2218,9 @@ int perf_event__synthesize_build_id(struct perf_tool *tool, struct dso *pos, u16 > > len = pos->long_name_len + 1; > > len = PERF_ALIGN(len, NAME_ALIGN); > > memcpy(&ev.build_id.build_id, pos->bid.data, sizeof(pos->bid.data)); > > + ev.build_id.size = pos->bid.size; > > ev.build_id.header.type = PERF_RECORD_HEADER_BUILD_ID; > > - ev.build_id.header.misc = misc; > > + ev.build_id.header.misc = misc | PERF_RECORD_MISC_BUILD_ID_SIZE; > > ev.build_id.pid = machine->pid; > > ev.build_id.header.size = sizeof(ev.build_id) + len; > > memcpy(&ev.build_id.filename, pos->long_name, pos->long_name_len); -- - Arnaldo