Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp43799ybj; Fri, 8 May 2020 06:11:13 -0700 (PDT) X-Google-Smtp-Source: APiQypLQE8keGpdfOE1dvzlA5I2vMvbKXZ+QGq3O+QknBdMtqSqr+UcMnrvyZ2JxxJ5EDSBMo0sZ X-Received: by 2002:a17:906:ef2:: with SMTP id x18mr1755507eji.234.1588943473351; Fri, 08 May 2020 06:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588943473; cv=none; d=google.com; s=arc-20160816; b=pZiXz+gvEIUST4/Xv03ma/ekwN2vyLVwUH3hfZCch5kRBz3yS2Rt/iwSSg5fi85IT+ HUL5yDSL3o/xPQlHBZOAgWiX/8AyDkcUO0xnk0HpDK66LhXkMqetQmrkqW4/gPRD6cA1 if2D7USk25dqXm96eIlREdbKLc5dRDU35bqGQOG96fQTtLSfcUb0Rs3A9P1Y5zIriWhE WPti+MMTcfxZc6WcoD8ivy6R75AfWhqVkfwT7jvPxQbGsHQG7Ac7WGHVe+cvZhL6RHA3 3zqCrV2oeBjHqY4/IGTNAQvi8zC/So+NCNJXcPzDMO9yqKgTitMX0705Mb2hrfI0DnTt Zjuw== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=QNMlqz9J/ktXivrun6myvobHKmEtuIjFOYpq0t279bc=; b=vcJuHWrax6jGhCnY3h9LtLY6ZsoBYsn891fQTNe5Dbih2ktpiPvAv8q0vrTd+5iAV/ nQjvu3WGKfNyzzmyQBrF4WcCh9EJ8zB2B3/o1PRYOfnD/qic9+xRELwJPdfG9q+wFzwm WvE3IZBUpz91nzs5cLXKpCM7jgRIehkRLoZ/C/qBKwwuEk+uUZS12S4/AEG8ocp2/16b o8q+U+v5k6eRRuiyjqCExnls+Rz0Qj+f5qklbmB/Nn0fs8EphW1jpc9KP5hv36KxV2Xt W6CnepTCD67y5Qtfe2+Fnr7IvN4hUjKfxzymbVpU47LO2nkuiJ2xPw1jFV3d+tBHDu2E hBLg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc18si953830ejb.497.2020.05.08.06.10.48; Fri, 08 May 2020 06:11:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729108AbgEHNFu (ORCPT + 99 others); Fri, 8 May 2020 09:05:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730507AbgEHNF0 (ORCPT ); Fri, 8 May 2020 09:05:26 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CEA5C05BD43; Fri, 8 May 2020 06:05:26 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jX2gr-0007e1-34; Fri, 08 May 2020 15:05:21 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 7E6671C085A; Fri, 8 May 2020 15:05:03 +0200 (CEST) Date: Fri, 08 May 2020 13:05:03 -0000 From: "tip-bot2 for Arnaldo Carvalho de Melo" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf record: Move side band evlist setup to separate routine Cc: Jiri Olsa , Adrian Hunter , Namhyung Kim , Song Liu , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200429131106.27974-9-acme@kernel.org> References: <20200429131106.27974-9-acme@kernel.org> MIME-Version: 1.0 Message-ID: <158894310346.8414.8485365390466335042.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 23cbb41c939a09a4b51eabacdb1f68af210c084d Gitweb: https://git.kernel.org/tip/23cbb41c939a09a4b51eabacdb1f68af210c084d Author: Arnaldo Carvalho de Melo AuthorDate: Tue, 28 Apr 2020 14:58:29 -03:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Tue, 05 May 2020 16:35:29 -03:00 perf record: Move side band evlist setup to separate routine It is quite big by now, move that code to a separate record__setup_sb_evlist() routine. Suggested-by: Jiri Olsa Acked-by: Jiri Olsa Cc: Adrian Hunter Cc: Namhyung Kim Cc: Song Liu Link: http://lore.kernel.org/lkml/20200429131106.27974-9-acme@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-record.c | 71 ++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index bb5b4d2..cfb9a69 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -1446,6 +1446,44 @@ static int record__process_signal_event(union perf_event *event __maybe_unused, return 0; } +static int record__setup_sb_evlist(struct record *rec) +{ + struct record_opts *opts = &rec->opts; + + if (rec->sb_evlist != NULL) { + /* + * We get here if --switch-output-event populated the + * sb_evlist, so associate a callback that will send a SIGUSR2 + * to the main thread. + */ + evlist__set_cb(rec->sb_evlist, record__process_signal_event, rec); + rec->thread_id = pthread_self(); + } + + if (!opts->no_bpf_event) { + if (rec->sb_evlist == NULL) { + rec->sb_evlist = evlist__new(); + + if (rec->sb_evlist == NULL) { + pr_err("Couldn't create side band evlist.\n."); + return -1; + } + } + + if (evlist__add_bpf_sb_event(rec->sb_evlist, &rec->session->header.env)) { + pr_err("Couldn't ask for PERF_RECORD_BPF_EVENT side band events.\n."); + return -1; + } + } + + if (perf_evlist__start_sb_thread(rec->sb_evlist, &rec->opts.target)) { + pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n"); + opts->no_bpf_event = true; + } + + return 0; +} + static int __cmd_record(struct record *rec, int argc, const char **argv) { int err; @@ -1590,36 +1628,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) goto out_child; } - if (rec->sb_evlist != NULL) { - /* - * We get here if --switch-output-event populated the - * sb_evlist, so associate a callback that will send a SIGUSR2 - * to the main thread. - */ - evlist__set_cb(rec->sb_evlist, record__process_signal_event, rec); - rec->thread_id = pthread_self(); - } - - if (!opts->no_bpf_event) { - if (rec->sb_evlist == NULL) { - rec->sb_evlist = evlist__new(); - - if (rec->sb_evlist == NULL) { - pr_err("Couldn't create side band evlist.\n."); - goto out_child; - } - } - - if (evlist__add_bpf_sb_event(rec->sb_evlist, &session->header.env)) { - pr_err("Couldn't ask for PERF_RECORD_BPF_EVENT side band events.\n."); - goto out_child; - } - } - - if (perf_evlist__start_sb_thread(rec->sb_evlist, &rec->opts.target)) { - pr_debug("Couldn't start the BPF side band thread:\nBPF programs starting from now on won't be annotatable\n"); - opts->no_bpf_event = true; - } + err = record__setup_sb_evlist(rec); + if (err) + goto out_child; err = record__synthesize(rec, false); if (err < 0)