Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3845241ybv; Mon, 10 Feb 2020 07:26:31 -0800 (PST) X-Google-Smtp-Source: APXvYqy/EOtAaTk6G9QL+86CICWoODVb0Xi/bZ68w7qGhll1wB0cJHGdtcWkfBk8R3gthf1T63HI X-Received: by 2002:aca:1c09:: with SMTP id c9mr1191663oic.85.1581348391472; Mon, 10 Feb 2020 07:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581348391; cv=none; d=google.com; s=arc-20160816; b=dF36z7YeDLW5Yc9+PzLsfbfNytNH3+OpHQXLV8CSufT/EZrL7SLuYLYsJF7guUTZH1 eF40/doWoTkJEelVDLQh0T/3SlIPL/YOaNZfVRNnvljzEDaIpYffpib21Y6DIY46l2KK JE+bpMviuHVyMTcEBC3Nd6gMVt7LryObWr0H0sjOMwcaf7uwaVxU1Rj6MmF59CpL3+87 STveVoNFuxtP65sBh741Z7EG35QpwInfX/4rzjq4DGgRATObLea1rJ9HO6UpS8RGYiqU gi0BKjWs71AV2ZmW69OK+E/bXvsCgy/EyrEYyhCfna7ganasby9PJQeZV0hUV9v720w+ IepA== 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=qNp6vQy5x2EVOfpL+WRRgMWjTTljcT3l8LtZST/yKsQ=; b=VE5wCKajfAY8QsDUtgBDNbxgRp6y0s3/TTBa9005naHyXAEOnYpBPZI5MwAramIbpU 0jco8GIqlh7lBe2P0ub74RS8t7UqTsARbbOFQsvN6d8jHs80ydSbpHvDas87ojKETvw+ 1dWT03E4bJZNiByXul5G1uQTzjByAckJgBVJxJBXUv3YPvKtsKcyvhrv5EhoC00YMdL5 OpY27bsoyEFSkYg/m5o67fYcT4awyYtKYDmCYsnpoFb27aD/XPOIBL4HmAwFLRvmTYto K1vvFM1CfOWrQQI/gXTeZsQAa38TS3VBHsjBZ3l8YLJsugyf1hiXLJUVA79koB70B7m4 Walw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XK+RKBY3; 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 x16si343699otk.13.2020.02.10.07.26.18; Mon, 10 Feb 2020 07:26:31 -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=XK+RKBY3; 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 S1727548AbgBJP0K (ORCPT + 99 others); Mon, 10 Feb 2020 10:26:10 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:49561 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727363AbgBJP0K (ORCPT ); Mon, 10 Feb 2020 10:26:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581348368; 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=qNp6vQy5x2EVOfpL+WRRgMWjTTljcT3l8LtZST/yKsQ=; b=XK+RKBY34Rrr1we655BTGlILXrtpnaub5eHX5Pj+3piyEXTi0adnDPe+XkX7snDmdMZRCx DmwwMsOx2nq2ugX7YYC1tHkwJ3TlHaGgs36nzl8GwN6xw5GWuSjYZnB1TQ+Sg84DWEsW1B ddTM18vZOmMyYlVrV55btbF4QmzjERg= 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-384-CDF6RXG6OuaDZCW4gLABOw-1; Mon, 10 Feb 2020 10:25:49 -0500 X-MC-Unique: CDF6RXG6OuaDZCW4gLABOw-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 3B55B8010FA; Mon, 10 Feb 2020 15:25:41 +0000 (UTC) Received: from krava (unknown [10.43.17.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 62D8460BF1; Mon, 10 Feb 2020 15:25:39 +0000 (UTC) Date: Mon, 10 Feb 2020 16:25:37 +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: <20200210152537.GA28110@krava> References: <20200210143218.24948-1-jolsa@kernel.org> <20200210143218.24948-3-jolsa@kernel.org> <20200210151759.GB25639@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200210151759.GB25639@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 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 thanks, jirka > > > - Arnaldo > > > return -ENOMEM; > > > > map->start = event->ksymbol.addr; > > -- > > 2.24.1 > > > > -- > > - Arnaldo >