Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1598956ybz; Thu, 30 Apr 2020 02:08:57 -0700 (PDT) X-Google-Smtp-Source: APiQypIJY1505R2Ha8HUf71LJESQdFJO+zJIJRYkql8HJf6iOGONogb+P33evyE1+pz5dRyiByj6 X-Received: by 2002:a50:9d42:: with SMTP id j2mr1644310edk.249.1588237737285; Thu, 30 Apr 2020 02:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588237737; cv=none; d=google.com; s=arc-20160816; b=gLGxy0FFOPr+BI7tsHQ7mY85YYaUp4x0vlY/Q6Tv2jJDnMaA3Qd87TDu0gXpD4YVyD u5WBnZTNlEn3OEthY+7I1ML54rseu1up/sqre6f1yNCzo/Yr8ayT1Ou8wZeAHbOj/9Qy f/1wBJmUSd0oq1y0/ZSydStrjKCAODaMzX0Qqu05458mA7ZcG/Fga3j3DL3ChiwvTTMj p39aGypdfrHZTR6Z3fl0Zuf1GFyUpn1JKizgYzR7jyVbBdHUrzst+gXnqSDL2X47uBg0 6+WRpQgIBR3/tFcFfoaex/xyOqNhImTkBOPesrH+DyOFroZ6E4pDAolitilzPID3+/gP 7OoQ== 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=K5VA5nptcg85tchI7teO0oY9ADEbHwiXdXDYuDNBW5A=; b=j9dy4/0gOq+dChMicj3gOnqUcBN0uVTBfIJ9Ckff4G4KcJ2bB+9YXLYbuB0zXksQcF fMtFwCOakTLE1IX+sEo1z4G/S/b0Tyv68rElY/6bpNhiGVIQXYYxF96yErGz1Bc+6Nq4 GrNZBul4L7i/ibEZJl5jj2VxKbEk/ZSoSaESx3lSBlKKWo5MWJJGX6NV4DDpOFie7hOA LkiGZgudbhgAPHErkWbTaOGerHh0CNmz4OYApIJRvo7efEjbHJyr/iwgN5JHyxgXTQvq ya5kY/ruF9gnJ3GAqfjgW74vj1HV2G52ovoEljMgnOrtN/Po0ET3NCkCWxSSZCAkGR5D mCpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gZvDzBMp; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g26si4873154edu.55.2020.04.30.02.08.33; Thu, 30 Apr 2020 02:08:57 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gZvDzBMp; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbgD3JEg (ORCPT + 99 others); Thu, 30 Apr 2020 05:04:36 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:42464 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726420AbgD3JEg (ORCPT ); Thu, 30 Apr 2020 05:04:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588237474; 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=K5VA5nptcg85tchI7teO0oY9ADEbHwiXdXDYuDNBW5A=; b=gZvDzBMptJfgQvNI63/AqAEm7KOjKtNvre910/TzX6MsDwXCHJa0ke+5GIrg0ycKomh0Eo uRBic7PiAsY7IufVdUT1nVVbW5KNj4VJfhRZFV6fM7z6SMdhy/a+5B9e3FsI9Voc2KwoiZ s/YZs4kACfJ2FFymOtcNhemuI39Ii9o= 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-399-u5POqqToMiujtPHEqmEwRw-1; Thu, 30 Apr 2020 05:04:30 -0400 X-MC-Unique: u5POqqToMiujtPHEqmEwRw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 364558014D5; Thu, 30 Apr 2020 09:04:29 +0000 (UTC) Received: from krava (unknown [10.40.192.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 979E610013BD; Thu, 30 Apr 2020 09:04:26 +0000 (UTC) Date: Thu, 30 Apr 2020 11:04:23 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Ingo Molnar , Thomas Gleixner , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter , Song Liu Subject: Re: [PATCH 3/8] perf bpf: Decouple creating the evlist from adding the SB event Message-ID: <20200430090423.GD1681583@krava> References: <20200429131106.27974-1-acme@kernel.org> <20200429131106.27974-4-acme@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200429131106.27974-4-acme@kernel.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 29, 2020 at 10:11:01AM -0300, Arnaldo Carvalho de Melo wrote: SNIP > -int perf_evlist__add_sb_event(struct evlist **evlist, > +int perf_evlist__add_sb_event(struct evlist *evlist, > struct perf_event_attr *attr, > perf_evsel__sb_cb_t cb, > void *data) > { > struct evsel *evsel; > - bool new_evlist = (*evlist) == NULL; > - > - if (*evlist == NULL) > - *evlist = evlist__new(); > - if (*evlist == NULL) > - return -1; > > if (!attr->sample_id_all) { > pr_warning("enabling sample_id_all for all side band events\n"); > attr->sample_id_all = 1; > } > > - evsel = perf_evsel__new_idx(attr, (*evlist)->core.nr_entries); > + evsel = perf_evsel__new_idx(attr, evlist->core.nr_entries); > if (!evsel) > goto out_err; we can return -1 right here jirka > > evsel->side_band.cb = cb; > evsel->side_band.data = data; > - evlist__add(*evlist, evsel); > + evlist__add(evlist, evsel); > return 0; > - > out_err: > - if (new_evlist) { > - evlist__delete(*evlist); > - *evlist = NULL; > - } > return -1; > } > > diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h > index f5bd5c386df1..0f02408fff3e 100644 > --- a/tools/perf/util/evlist.h > +++ b/tools/perf/util/evlist.h > @@ -107,7 +107,7 @@ int __perf_evlist__add_default_attrs(struct evlist *evlist, > > int perf_evlist__add_dummy(struct evlist *evlist); > > -int perf_evlist__add_sb_event(struct evlist **evlist, > +int perf_evlist__add_sb_event(struct evlist *evlist, > struct perf_event_attr *attr, > perf_evsel__sb_cb_t cb, > void *data); > -- > 2.21.1 >