From patchwork Tue Jan 24 11:02:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13113814 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09E2AC54EAA for ; Tue, 24 Jan 2023 11:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=00mG59mp2O468gN7AGFeGZOeGE18Tm0Q41pxPl26W5M=; b=MQxE36bDcOK/UC akP1r1jHD6EN99t0JPJtrTNUSJvNvpFVNwiyAwYBgCE2QbsR9akE9G89GTBfUgQzMRYyaIDDHBLS9 3VnwzEiIV3po1yBnEXo7hpmwiz7RdnC+u8CblSBvZTPipsHTQZX90LnAZwugeN1f8rAV3K1yNCXvH Ra0J7r8MzdSgLK1No/WDNm7tlXclebwPE3zPzYsJeQWXx1dxeo1qpN5N3eguB4R4tONzifzWiS5pf des+kQY8nlqfJw95ptyCo4OtdTeJQC0RSvYuhjC2ulBk9eppZ8rkWTGugR2Dmd1TokcVzNaGkOGkw HXY2T6pofuJIxyQUy/vg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKH63-003Jmy-Hv; Tue, 24 Jan 2023 11:04:11 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKH5w-003Jin-NC for linux-arm-kernel@lists.infradead.org; Tue, 24 Jan 2023 11:04:06 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 32CF41FB; Tue, 24 Jan 2023 03:04:40 -0800 (PST) Received: from e126815.warwick.arm.com (e126815.arm.com [10.32.32.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 14DA53F64C; Tue, 24 Jan 2023 03:03:55 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org, acme@kernel.org, suzuki.poulose@arm.com Cc: linux-kernel@vger.kernel.org, James Clark , Mathieu Poirier , Mike Leach , Leo Yan , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] perf: cs-etm: Improve missing sink warning message Date: Tue, 24 Jan 2023 11:02:20 +0000 Message-Id: <20230124110220.460551-1-james.clark@arm.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230124_030404_842170_F9C91C43 X-CRM114-Status: GOOD ( 11.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make the sink error message more similar to the event error message that reminds about missing kernel support. The available sinks are also determined by the hardware so mention that too. Also, usually it's not necessary to specify the sink, so add that as a hint. Now the error for a made up sink looks like this: $ perf record -e cs_etm/@abc/ Couldn't find sink "abc" on event cs_etm/@abc/. Missing kernel or device support? Hint: An appropriate sink will be picked automatically if one isn't is specified. For any error other than ENOENT, the same message as before is displayed. Signed-off-by: James Clark Acked-by: Suzuki K Poulose --- V1 -> V2: Keep old error message unless it's ENOENT tools/perf/arch/arm/util/cs-etm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) base-commit: 5670ebf54bd26482f57a094c53bdc562c106e0a9 diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index 481e170cd3f1..7f71c8a237ff 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -283,9 +283,15 @@ static int cs_etm_set_sink_attr(struct perf_pmu *pmu, ret = perf_pmu__scan_file(pmu, path, "%x", &hash); if (ret != 1) { - pr_err("failed to set sink \"%s\" on event %s with %d (%s)\n", - sink, evsel__name(evsel), errno, - str_error_r(errno, msg, sizeof(msg))); + if (errno == ENOENT) + pr_err("Couldn't find sink \"%s\" on event %s\n" + "Missing kernel or device support?\n\n" + "Hint: An appropriate sink will be picked automatically if one isn't specified.\n", + sink, evsel__name(evsel)); + else + pr_err("Failed to set sink \"%s\" on event %s with %d (%s)\n", + sink, evsel__name(evsel), errno, + str_error_r(errno, msg, sizeof(msg))); return ret; }