Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3794642ybv; Mon, 10 Feb 2020 06:33:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxk7934WMnEnR5yq0UFw3xJfWDk5SNoHCEdbkIfKlMtjitivMqOW4S3INYOfemWhilukDEE X-Received: by 2002:aca:2803:: with SMTP id 3mr960671oix.162.1581345181921; Mon, 10 Feb 2020 06:33:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581345181; cv=none; d=google.com; s=arc-20160816; b=MnHO+awzTgNRp91uVkwNJcJu1rHNSgoDVATUb88aTCUhuBSWBUdPPrD9B70fA6boxN IVMYc233FE6t0jG8x9v8FPERRRzu/V/OWJCpYY52HGbKXVfvNlDH4a28a12v5pX68vty S3A5X2MVOa4VsDhixH/sUDt54MjSkpHfx5W7Px057T87KcizzHblu2mFk2x0OeJGDHAd OLXY7ZwfQoqKuPf9tBU53PppKeRygSwC8GKh7mApBqafyDupLxHbJ0Xb9we8QU1knexm pzT6iqGDcr0ZjZiJ8+5JK+Ivc+15IH229V0OACsN9CIfokbqNPXoqo3sySh4TyRnu402 y1kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=OJ4nz9n2tis2Gi93bb4wJzfluN8b9T8zZs2UzSA8kbQ=; b=XPu+Wu23PxxsBwvvnsyn1B3og/1z46FpAweb7UKcD88Oww/TBQ0X27GInjgiD/6zST N0GcOU5ON23xoXiSuinJGVyrB2bCG0TqWEi53BGU8sNQPxpw79Dl5l72xk6HgNYBE0Db 0pe3pgKrnfjt1LSpkE/GChwTktrxEtHJHexsL2Mab7yYnpNxXW4MMwIU29XrrB4KAqve cW/YjMvX5Rrhx2meJE1/KDEPkRtFJAkzcFPD9FkmDY43RBQze+npiA17rp6pA5j/CbJR VAZe5MyTaWJk3FtMltmtdbkAjW8hOMpRAKiqtdMJ/1k7VlU+9OAcZNsCuvK471Wyb8vK KnOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h18si284322otj.114.2020.02.10.06.32.49; Mon, 10 Feb 2020 06:33:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728832AbgBJOce convert rfc822-to-8bit (ORCPT + 99 others); Mon, 10 Feb 2020 09:32:34 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:34155 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727120AbgBJOcb (ORCPT ); Mon, 10 Feb 2020 09:32:31 -0500 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-112-kTq16wSVObqdK8oP9EPmoQ-1; Mon, 10 Feb 2020 09:32:27 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C210F477; Mon, 10 Feb 2020 14:32:25 +0000 (UTC) Received: from krava.redhat.com (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0B1060BF1; Mon, 10 Feb 2020 14:32:23 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Ravi Bangoria , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 2/4] perf tools: Mark ksymbol dsos with kernel type Date: Mon, 10 Feb 2020 15:32:16 +0100 Message-Id: <20200210143218.24948-3-jolsa@kernel.org> In-Reply-To: <20200210143218.24948-1-jolsa@kernel.org> References: <20200210143218.24948-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: kTq16wSVObqdK8oP9EPmoQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We add ksymbol map into machine->kmaps, so it needs to be created as 'struct kmap', which is dependent on its dso having kernel type. Reported-by: Ravi Bangoria Tested-by: Ravi Bangoria Signed-off-by: Jiri Olsa --- tools/perf/util/machine.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index e3e5490f6de5..0a43dc83d7b2 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine, struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr); if (!map) { - map = dso__new_map(event->ksymbol.name); - if (!map) + struct dso *dso = dso__new(event->ksymbol.name); + + if (dso) { + dso->kernel = DSO_TYPE_KERNEL; + map = map__new2(0, dso); + } + + if (!dso || !map) return -ENOMEM; map->start = event->ksymbol.addr; -- 2.24.1