Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1166364ybk; Sun, 10 May 2020 08:09:30 -0700 (PDT) X-Google-Smtp-Source: APiQypKbhhlmNLMNA6DHP5/kCO2YhN9kDclGpgkcux2zFufCDGQ7Hf+T1uGSOvKPedEZobbj5lwl X-Received: by 2002:a17:907:2049:: with SMTP id pg9mr9962094ejb.248.1589123370115; Sun, 10 May 2020 08:09:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589123370; cv=none; d=google.com; s=arc-20160816; b=L75uX2SyycaV5NLnJSP2dwfNVPFpVEruvieli1ptjZveCXutFoYp6Ye93x0qgSPRac PQ3Ew2prlE9GFRHLUoO1seQ0KeeyV5sBrSLi33dldQDnduM77LcyIxTVVtJIUMn/WaKO 8BNT554RKYt2+IG3OQrvuQO1jIKwF1+bFn9fy98SP/CDtD5xmi2ycc6E4J5qnnewvfCW WS8SJ8jC7Bq5ehbwI0ik9KGY4PNyHYlHaZCM0HqXhHb0M4tFyxV9uFZTK2vHrmotisGf 02X86RR/HfOf523yg51rMLcnLbiDyKEHZJwhFp3fdDIACiCPIQ/UD5xRVGjGhljT8FPm oI1A== 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 :dkim-signature; bh=voUoOuTrRby1XQqqFE85VsqGFZ6h8QY4sBzJK51ntGg=; b=FBRl/u/5jX8Vv+rroie9R15ECqEl6fS8ET5K3zK8/EbWXOapUsFEEedY0tnydtr1Tv joAg2v0Z/IqJQiefrVJOqn3pn+I8p82tgg1UO2gH+Bnxks6ijyCxOYXDZoDyNeyacA/q W0BglRhhxIBEVE+KLw1EaGFaGAuB5K2faMX/duF1pdPBjLLKdtxKLBQ0t696J82Wdzib WUoPLzOy9Mdm/KeWYSl4wwlfJ1QoRSQVUoAG7GWvj1E3IXMZm/gQHjdUKfABrvdgCVye pTLx1ESvH0GmlTpzRalR278tyyBXJvqJkTWGI3BqVS8u630RN82Jf2Twlw0ljv+xZFbN /zEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XLjyyABU; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z15si3063214ede.558.2020.05.10.08.09.07; Sun, 10 May 2020 08:09:30 -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=@gmail.com header.s=20161025 header.b=XLjyyABU; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729142AbgEJPHF (ORCPT + 99 others); Sun, 10 May 2020 11:07:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726104AbgEJPHF (ORCPT ); Sun, 10 May 2020 11:07:05 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33C8EC061A0C for ; Sun, 10 May 2020 08:07:05 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id y9so224598plk.10 for ; Sun, 10 May 2020 08:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=voUoOuTrRby1XQqqFE85VsqGFZ6h8QY4sBzJK51ntGg=; b=XLjyyABULKU7EGO572c6H60m5i2icms/1MaPWdMnSLJAaKURluOV9sN4K5+uRUiofg 0P74uzlIaWZSTdbQJji6coIClS/dB0Mgcj9Eb69ZvE4dipumD0VHTJ0a75Dqa0+FuMMw kAZHOdqhbalo4YtyACbKi1JSPgpHmy22Q18x6ltPIUC5Y43zVrX5m8McgmSp7vyWqFYu 3nCnIZb2eYVVRYiPV4fAu7FsYn5PiSF86huvaM0tog2fdDigSyKirLYhlR/ey4ItVfo2 NY/mu0cTuikoGnMR0XspGpHRXPxd1e1SzxgvED9dvcLZ6Jv7wY61L2nQnSHCwGGWjfhV Hr8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=voUoOuTrRby1XQqqFE85VsqGFZ6h8QY4sBzJK51ntGg=; b=sPZbQ6IQGcgLoPKK0IA075RFtoJVNh0lRBfvwzZMCUy/EWFhemkWjRdEWdY1ovcra5 +uCKOc/CJOeGi2wEvhPbOnMGHyBRMr2lYMUoy1fcNRWgGeGUtqQrtooNjNAnAwcrlso7 nGhEr92Bzp21J5+EzrdZeIYSLqqJ5ld6zDeQYfFnWv6s2liKV7OgqtLuwawAcBR8otuj oz+sz6Ikr2tuUMqFLY39Qp+Lkh54Pi4bTVfqU8D3N6BsJi4E1Njj2qSSyXtDHrbJtYEH N5NdBjCfwV3ok2uP4SI+DsxFOUqyVMipyiauKRR2NieHKfrWSc4BI0hkpQBYmnJXKMU6 WjYA== X-Gm-Message-State: AGi0PuZbqftybPpqTMkRONzjoniYz/wvFQbMOkp/43a8Z99YkrEIzcJ5 nNUDG0bI/8kZwdqanXUg++E= X-Received: by 2002:a17:90a:7349:: with SMTP id j9mr17680939pjs.196.1589123224732; Sun, 10 May 2020 08:07:04 -0700 (PDT) Received: from vultr.guest ([149.248.10.52]) by smtp.gmail.com with ESMTPSA id v7sm6870909pfm.146.2020.05.10.08.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2020 08:07:04 -0700 (PDT) From: Changbin Du To: Jiri Olsa , Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Ingo Molnar , Namhyung Kim , Steven Rostedt , linux-kernel@vger.kernel.org, Changbin Du Subject: [PATCH 02/19] perf ftrace: detect workload failure Date: Sun, 10 May 2020 23:06:11 +0800 Message-Id: <20200510150628.16610-3-changbin.du@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200510150628.16610-1-changbin.du@gmail.com> References: <20200510150628.16610-1-changbin.du@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently there's no error message prompted if we failed to start workload. And we still get some trace which is confusing. Let's tell users what happened. Signed-off-by: Changbin Du --- tools/perf/builtin-ftrace.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 11fc02037899..5584f8dec25d 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -45,6 +45,7 @@ struct filter_entry { char name[]; }; +static volatile int workload_exec_errno; static bool done; static void sig_handler(int sig __maybe_unused) @@ -63,7 +64,7 @@ static void ftrace__workload_exec_failed_signal(int signo __maybe_unused, siginfo_t *info __maybe_unused, void *ucontext __maybe_unused) { - /* workload_exec_errno = info->si_value.sival_int; */ + workload_exec_errno = info->si_value.sival_int; done = true; } @@ -382,6 +383,14 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) write_tracing_file("tracing_on", "0"); + if (workload_exec_errno) { + const char *emsg = str_error_r(workload_exec_errno, buf, sizeof(buf)); + /* flush stdout first so below error msg appears at the end. */ + fflush(stdout); + pr_err("workload failed: %s\n", emsg); + goto out_close_fd; + } + /* read remaining buffer contents */ while (true) { int n = read(trace_fd, buf, sizeof(buf)); @@ -396,7 +405,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) out_reset: reset_tracing_files(ftrace); out: - return done ? 0 : -1; + return (done && !workload_exec_errno) ? 0 : -1; } static int perf_ftrace_config(const char *var, const char *value, void *cb) -- 2.25.1