Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754834AbbHXOfp (ORCPT ); Mon, 24 Aug 2015 10:35:45 -0400 Received: from mga02.intel.com ([134.134.136.20]:20456 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754798AbbHXOfh (ORCPT ); Mon, 24 Aug 2015 10:35:37 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,738,1432623600"; d="scan'208";a="789910999" From: Alexander Shishkin To: Peter Zijlstra , Ingo Molnar Cc: linux-kernel@vger.kernel.org, adrian.hunter@intel.com, Arnaldo Carvalho de Melo , Vince Weaver , Stephane Eranian , Johannes Berg , Alexander Shishkin Subject: [PATCH v2 4/6] perf/x86: Annotate some of the error codes with perf_err() Date: Mon, 24 Aug 2015 17:32:58 +0300 Message-Id: <1440426780-27227-5-git-send-email-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1440426780-27227-1-git-send-email-alexander.shishkin@linux.intel.com> References: <1440426780-27227-1-git-send-email-alexander.shishkin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1991 Lines: 59 This patch annotates a few x86-specific error paths with perf's extended error reporting facility. Signed-off-by: Alexander Shishkin --- arch/x86/kernel/cpu/perf_event.c | 8 ++++++-- arch/x86/kernel/cpu/perf_event_intel_lbr.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index f56cf074d0..b3b531beee 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -12,6 +12,8 @@ * For licencing details see kernel-base/COPYING */ +#define PERF_MODNAME "perf/x86" + #include #include #include @@ -426,11 +428,13 @@ int x86_setup_perfctr(struct perf_event *event) /* BTS is currently only allowed for user-mode. */ if (!attr->exclude_kernel) - return -EOPNOTSUPP; + return perf_err(-EOPNOTSUPP, + "BTS sampling not allowed for kernel space"); /* disallow bts if conflicting events are present */ if (x86_add_exclusive(x86_lbr_exclusive_lbr)) - return -EBUSY; + return perf_err(-EBUSY, + "LBR conflicts with active events"); event->destroy = hw_perf_lbr_event_destroy; } diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c index b2c9475b7f..222b259c5e 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c +++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c @@ -607,7 +607,7 @@ int intel_pmu_setup_lbr_filter(struct perf_event *event) * no LBR on this PMU */ if (!x86_pmu.lbr_nr) - return -EOPNOTSUPP; + return perf_err(-EOPNOTSUPP, "LBR is not supported by this cpu"); /* * setup SW LBR filter -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/