Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp154673pxu; Tue, 13 Oct 2020 19:57:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaOKxfF1mClCiLssBD+GV98U0QiZyKpSm5dQ3fTgeQxfrUMisLfsoeRVHx79LLsNEH4yKD X-Received: by 2002:a50:abc3:: with SMTP id u61mr2856951edc.253.1602644229899; Tue, 13 Oct 2020 19:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602644229; cv=none; d=google.com; s=arc-20160816; b=KD38sr+1hNXDwfIm7Dhq9wPZGXYlLIMU4HwODdRizBF469s6Q5xDec/aEFko17ws2q u7k2+YOmXM4Lv7gpWOlTcJkaFFNC6VX1yl1bAeZanN0ubIsbrScvTdInyH4VyVSvFm09 tjPX/bvAzR3q8Cre115xuLPgPtaXmjVH/ADuFQGwQwncTk+kmbHbv9opzHpw8xEMg2Mh w0iNO15KFKiFTTnBmmwb+trfTmBehz6CZGIZAzVnNr+hp1MLJVejP5RzV5STJ7HAvqie vhE6fl6PWYPTc0MWlD5yjgaaPHis93Pf7ZZKExh/BdPmJ27a4kEY1aKUJI2DNlSFgotl 1ICA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=m9GEeroil5xRgM6k2O+peDL+Ik4YwJieqRbVucmB1PA=; b=xitKY0A5LzapXpHpqatRWD1/q0d250t8HHaZA93wwHyEfhT62e3pYZkoeVWYbX01HN suJ8e4SyJ0J3XdVpP6w9dNWbBJ49iUBf/psLWZd/QaDQU/LdRinzQ+9euOnx+hyznl1C /jR+G8WFWjOcyPIh7pr51y6eDb/LqE7gtM8WcNEiQk91DvvkXiEz5m2DjQtu1fBNMlZb fQgIccm08O/bTXEnIBJbY2fqOZZhs0lrCzhetZd5awItxaYFWJ9Rrw8qW6I9WP4krg2c GOk8y+6nakg9o5QcO7J4115dPbXEXsXApIQarFPo1lmnjBLsT5dW8sztLKTaUQ7ikqLh il1Q== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g19si1237658ejd.105.2020.10.13.19.56.45; Tue, 13 Oct 2020 19:57:09 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732591AbgJMTZR convert rfc822-to-8bit (ORCPT + 99 others); Tue, 13 Oct 2020 15:25:17 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:60460 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbgJMTZP (ORCPT ); Tue, 13 Oct 2020 15:25:15 -0400 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-455-lONjhXiKOVO4sCkXn96Yzw-1; Tue, 13 Oct 2020 15:25:10 -0400 X-MC-Unique: lONjhXiKOVO4sCkXn96Yzw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1468A18BE181; Tue, 13 Oct 2020 19:25:08 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.193.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54A175D9CD; Tue, 13 Oct 2020 19:25:02 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Ian Rogers , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Stephane Eranian Subject: [PATCH 5/9] perf tools: Pass build_id object to dso__set_build_id Date: Tue, 13 Oct 2020 21:24:37 +0200 Message-Id: <20201013192441.1299447-6-jolsa@kernel.org> In-Reply-To: <20201013192441.1299447-1-jolsa@kernel.org> References: <20201013192441.1299447-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Passing build_id object to dso__set_build_id, so it's easier to initialize dos's build id object. Acked-by: Ian Rogers Signed-off-by: Jiri Olsa --- tools/perf/util/dso.c | 4 ++-- tools/perf/util/dso.h | 2 +- tools/perf/util/header.c | 4 +++- tools/perf/util/symbol-minimal.c | 2 +- tools/perf/util/symbol.c | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 2f7f01ead9a1..4415ce83150b 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -1326,9 +1326,9 @@ void dso__put(struct dso *dso) dso__delete(dso); } -void dso__set_build_id(struct dso *dso, void *build_id) +void dso__set_build_id(struct dso *dso, struct build_id *bid) { - memcpy(dso->bid.data, build_id, sizeof(dso->bid.data)); + dso->bid = *bid; dso->has_build_id = 1; } diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index eac004210b47..5a5678dbdaa5 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -260,7 +260,7 @@ bool dso__sorted_by_name(const struct dso *dso); void dso__set_sorted_by_name(struct dso *dso); void dso__sort_by_name(struct dso *dso); -void dso__set_build_id(struct dso *dso, void *build_id); +void dso__set_build_id(struct dso *dso, struct build_id *bid); bool dso__build_id_equal(const struct dso *dso, u8 *build_id); void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine); diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index fe220f01fc94..21243adbb9fd 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -2082,8 +2082,10 @@ static int __event_process_build_id(struct perf_record_header_build_id *bev, dso = machine__findnew_dso(machine, filename); if (dso != NULL) { char sbuild_id[SBUILD_ID_SIZE]; + struct build_id bid; - dso__set_build_id(dso, &bev->build_id); + build_id__init(&bid, bev->build_id, BUILD_ID_SIZE); + dso__set_build_id(dso, &bid); if (dso_space != DSO_SPACE__USER) { struct kmod_path m = { .name = NULL, }; diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c index dba6b9e5d64e..f9eb0bee7f15 100644 --- a/tools/perf/util/symbol-minimal.c +++ b/tools/perf/util/symbol-minimal.c @@ -349,7 +349,7 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused, dso->is_64_bit = ret; if (filename__read_build_id(ss->name, &bid) > 0) - dso__set_build_id(dso, bid.data); + dso__set_build_id(dso, &bid); return 0; } diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 369cbad09f0d..976632d0baa0 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1818,7 +1818,7 @@ int dso__load(struct dso *dso, struct map *map) is_regular_file(dso->long_name)) { __symbol__join_symfs(name, PATH_MAX, dso->long_name); if (filename__read_build_id(name, &bid) > 0) - dso__set_build_id(dso, bid.data); + dso__set_build_id(dso, &bid); } /* -- 2.26.2