Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4112929ybv; Mon, 10 Feb 2020 12:35:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxgqvhuPzl+ysas/k4ylT7JC81FVeeWv+Bqx3CX5bZ86DUE4d/O4vH794S0ArXOxMEBj8V5 X-Received: by 2002:aca:d4ca:: with SMTP id l193mr599750oig.133.1581366921757; Mon, 10 Feb 2020 12:35:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581366921; cv=none; d=google.com; s=arc-20160816; b=idMyKt4T+bbbOh7e2S/FgrfImCuJ9grkRAlh/UYp15fMEyW1o1wkyNUE/tWNrp9nGU d0dAdhhz8c0E4E3a/0UFmwtf5Ldg02I77PcJQPE8HQix865+qkQmm+UlAISGk/ko3/zt Vb2g78qPHn855V/BUSPhbYoG0aZA9GsEsN8TLWPLBpKAQhC0H3jIDjiTwH18Y84bq0y+ diPndF88dyfoP6HfenzquE/rDKmdET1EHMitdCAaMg+bvTAYTq2NGsvFLmf2oJ0tQYlp GTHqVSdsBWgZHVKkBvxseYg/qsexq850qNhjnyBMJqVCIlk1ifuEsH/iOxzqRc8dYN2e vGEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=LgH4nKWCUS1JavMhLTaldrPeEO/2vULRnpq1MpZg4QI=; b=X8C+OTD7/DzXanFzNmiW/5BU0QgYqszPzVAsbZOa9nfPgtj/JOe5aCueUfRfpMA+// cSQm8VHv9c78PFE456LWRULDas2UHQmvo6zBwFprLQPYa5VagY8cGMvkZNGA2cK1+0IT Wec7IgUIcwiRhNUViPJordeNvs0aWD0vLOKMGQDdD2+jpaZou1dCtvFwsFd+xYcSWBKE GlUcW0PN4Jo6HsLI2uW9H7HMGaZC0g8xuoGDPkgy9Fp2X1tDim7lXX6hJvNlzAyfm64Q 5hbJxEzdYY0ZllSlaihs539CUArxbYdGqVYLK3SSACVGz7444+k3ngGXADtbrcYeD8Ot Epqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="KPaPWd/P"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v25si724010otq.93.2020.02.10.12.35.09; Mon, 10 Feb 2020 12:35:21 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="KPaPWd/P"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727411AbgBJUe5 (ORCPT + 99 others); Mon, 10 Feb 2020 15:34:57 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59713 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727120AbgBJUe5 (ORCPT ); Mon, 10 Feb 2020 15:34:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581366896; 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=LgH4nKWCUS1JavMhLTaldrPeEO/2vULRnpq1MpZg4QI=; b=KPaPWd/PK6ZRzTE6EZPbJc9BXQuUIp96SZL0J/pXEotaLFMX1bpIw9KcmrwE7stL3SRL8T iKVSxCkpF3Vhxl3qX8rFcbWk0Mg6NXCyPaag4G574BzUCavBr/jzsMywWgVPdVWVtXKCnK atudS8kYJDXyPdPIFH29HskNxz6Rxkc= 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-364-OvzKEA7xOQy3Xc0Y0Pk9_g-1; Mon, 10 Feb 2020 15:34:52 -0500 X-MC-Unique: OvzKEA7xOQy3Xc0Y0Pk9_g-1 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 9A34B1088384; Mon, 10 Feb 2020 20:34:50 +0000 (UTC) Received: from krava (ovpn-204-37.brq.redhat.com [10.40.204.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0EE9D60BF3; Mon, 10 Feb 2020 20:34:47 +0000 (UTC) Date: Mon, 10 Feb 2020 21:34:45 +0100 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Ravi Bangoria , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: Re: [PATCH 2/4] perf tools: Mark ksymbol dsos with kernel type Message-ID: <20200210203445.GB36715@krava> References: <20200210143218.24948-1-jolsa@kernel.org> <20200210143218.24948-3-jolsa@kernel.org> <20200210151759.GB25639@kernel.org> <20200210152537.GA28110@krava> <20200210195801.GF3416@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200210195801.GF3416@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 10, 2020 at 04:58:01PM -0300, Arnaldo Carvalho de Melo wrote: > Em Mon, Feb 10, 2020 at 04:25:37PM +0100, Jiri Olsa escreveu: > > On Mon, Feb 10, 2020 at 12:17:59PM -0300, Arnaldo Carvalho de Melo wrote: > > > Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu: > > > > 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) > > > > > > We leak dso if map creation fails? > > > > yep :-\ will post v2 > > Please collect Kim's Tested-by then, oops, did not notice, I updated commits with them in the perf/top branch jirka > > - Arnaldo > > > thanks, > > jirka > > > > > > > > > > > - Arnaldo > > > > > > > return -ENOMEM; > > > > > > > > map->start = event->ksymbol.addr; > > > > -- > > > > 2.24.1 > > > > > > > > > > -- > > > > > > - Arnaldo > > > > > > > -- > > - Arnaldo >