Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4478239ybx; Mon, 4 Nov 2019 14:06:01 -0800 (PST) X-Google-Smtp-Source: APXvYqwhroVF+wiYV1umbg1UxhcMbeAuicy4dPGBOllQq1coX9L6d/kXUBxirgP1XAXmfBIE8kNN X-Received: by 2002:a05:6402:54a:: with SMTP id i10mr8894137edx.230.1572905161805; Mon, 04 Nov 2019 14:06:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905161; cv=none; d=google.com; s=arc-20160816; b=oDn5plDtV8HSlWDfznNKIErDxqGb4dcNkwH/glaX49VYbPFP1+6USyhmJIhnQVOv8J HxCmVDA1vTZ2vwb9anyIv/CP1IxZ0KWWHh6ChcV21z4ZVbCAsgdDSF0DWoxPQvMPjS3k yC3UHRH56HUYGHCVNOyncde6j8W2dFE4BeSeV7KwpB/UQP/bzBsDVdmQKdZzltBKE1Hw VF0r4fbrRfdPeMQmfOcF6HiheiEuzLxIyu3qHn7TiaJtiGC3H9+ImhFEKO3D9ir3IfIl 3l/YaeRVK0k+8qHluhHXelsU18RDCDHSs75qTdjcMr723L9JWGx4afQ1a0vN0whi8e/B fDeA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TxfUZxSgIQwYqmGmdxwqYJbozGNPGiaEjX21ZXv8gKo=; b=Fx4dj0ewiYoHO1iZYpsQWGZ2yATrbYX8j2dMAZT2GQv8OhuEPt6kNZEgoK1bF1AS+8 HssrFTw/VO/NgNBPSTCHwUJYdHEmdhV0+0YLyncGoy02HHQoBs/7kdtx4VypZgrgdy4r K/Wl8solM2FHE/f9svDIi2mC99uU9frS4bfTbruwhgqdP5K+OEIUxU4p8Oo6f2nXzYkH rFBzxa8I1Edt6+v/h5xmhpi1rw0hnjBIP04s6Zsv5RsC80gssC6ALKflcSN57gKTKc22 Z4DQFoSgkWH7+2cOnkFUO1OK9l3vNOkAAV5koXO05BRhyN6f1FcYx7k0GcwqPKNmik8U oM6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CuvLcdLi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si8491777edb.57.2019.11.04.14.05.38; Mon, 04 Nov 2019 14:06:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CuvLcdLi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389660AbfKDWE1 (ORCPT + 99 others); Mon, 4 Nov 2019 17:04:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:35118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388315AbfKDWE0 (ORCPT ); Mon, 4 Nov 2019 17:04:26 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C8AD222C1; Mon, 4 Nov 2019 22:04:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905065; bh=+UnMfg+m4swdchYKP2ODwEcQQQuDupu3pI/pxiofxoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CuvLcdLiGCP+JFFQ7FKVGFuvEG8Yz0YOD8vVhu2oZOHiKZIw+TMr5eS7b2ASw4TZd +v6Pz6IeSuIqeKLtpOlUWJQS68GUsvXC3HD0A8CCZFyXfonarPdnh5/034cwZI88/F RpO5+5WZ/Ys60ZhIXG9X/EWRzpdzsxRakYlUdpro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King - ARM Linux admin , Adrian Hunter , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Will Deacon , Arnaldo Carvalho de Melo , Sasha Levin , Peter Zijlstra Subject: [PATCH 5.3 017/163] perf annotate: Fix arch specific ->init() failure errors Date: Mon, 4 Nov 2019 22:43:27 +0100 Message-Id: <20191104212141.665821076@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo [ Upstream commit 42d7a9107d83223a5fcecc6732d626a6c074cbc2 ] They are called from symbol__annotate() and to propagate errors that can help understand the problem make them return what symbol__strerror_disassemble() known, i.e. errno codes and other annotation specific errors in a special, out of errnos, range. Reported-by: Russell King - ARM Linux admin Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra , Cc: Will Deacon Link: https://lkml.kernel.org/n/tip-pqx7srcv7tixgid251aeboj6@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/arch/arm/annotate/instructions.c | 4 ++-- tools/perf/arch/arm64/annotate/instructions.c | 4 ++-- tools/perf/arch/s390/annotate/instructions.c | 6 ++++-- tools/perf/arch/x86/annotate/instructions.c | 6 ++++-- tools/perf/util/annotate.c | 6 ++++++ tools/perf/util/annotate.h | 2 ++ 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/tools/perf/arch/arm/annotate/instructions.c b/tools/perf/arch/arm/annotate/instructions.c index c7d1a69b894fe..19ac54758c713 100644 --- a/tools/perf/arch/arm/annotate/instructions.c +++ b/tools/perf/arch/arm/annotate/instructions.c @@ -36,7 +36,7 @@ static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arm = zalloc(sizeof(*arm)); if (!arm) - return -1; + return ENOMEM; #define ARM_CONDS "(cc|cs|eq|ge|gt|hi|le|ls|lt|mi|ne|pl|vc|vs)" err = regcomp(&arm->call_insn, "^blx?" ARM_CONDS "?$", REG_EXTENDED); @@ -58,5 +58,5 @@ out_free_call: regfree(&arm->call_insn); out_free_arm: free(arm); - return -1; + return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP; } diff --git a/tools/perf/arch/arm64/annotate/instructions.c b/tools/perf/arch/arm64/annotate/instructions.c index 8f70a1b282dfb..223e2f161f414 100644 --- a/tools/perf/arch/arm64/annotate/instructions.c +++ b/tools/perf/arch/arm64/annotate/instructions.c @@ -94,7 +94,7 @@ static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arm = zalloc(sizeof(*arm)); if (!arm) - return -1; + return ENOMEM; /* bl, blr */ err = regcomp(&arm->call_insn, "^blr?$", REG_EXTENDED); @@ -117,5 +117,5 @@ out_free_call: regfree(&arm->call_insn); out_free_arm: free(arm); - return -1; + return SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP; } diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c index 89bb8f2c54cee..a50e70baf9183 100644 --- a/tools/perf/arch/s390/annotate/instructions.c +++ b/tools/perf/arch/s390/annotate/instructions.c @@ -164,8 +164,10 @@ static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused) if (!arch->initialized) { arch->initialized = true; arch->associate_instruction_ops = s390__associate_ins_ops; - if (cpuid) - err = s390__cpuid_parse(arch, cpuid); + if (cpuid) { + if (s390__cpuid_parse(arch, cpuid)) + err = SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; + } } return err; diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/x86/annotate/instructions.c index 44f5aba78210e..7eb5621c021d8 100644 --- a/tools/perf/arch/x86/annotate/instructions.c +++ b/tools/perf/arch/x86/annotate/instructions.c @@ -196,8 +196,10 @@ static int x86__annotate_init(struct arch *arch, char *cpuid) if (arch->initialized) return 0; - if (cpuid) - err = x86__cpuid_parse(arch, cpuid); + if (cpuid) { + if (x86__cpuid_parse(arch, cpuid)) + err = SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; + } arch->initialized = true; return err; diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index ca8b517e38fa8..b475449f955ef 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1625,6 +1625,12 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map * case SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF: scnprintf(buf, buflen, "Please link with binutils's libopcode to enable BPF annotation"); break; + case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP: + scnprintf(buf, buflen, "Problems with arch specific instruction name regular expressions."); + break; + case SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING: + scnprintf(buf, buflen, "Problems while parsing the CPUID in the arch specific initialization."); + break; default: scnprintf(buf, buflen, "Internal error: Invalid %d error code\n", errnum); break; diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h index 5bc0cf655d377..a1191995fe77e 100644 --- a/tools/perf/util/annotate.h +++ b/tools/perf/util/annotate.h @@ -370,6 +370,8 @@ enum symbol_disassemble_errno { SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX = __SYMBOL_ANNOTATE_ERRNO__START, SYMBOL_ANNOTATE_ERRNO__NO_LIBOPCODES_FOR_BPF, + SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING, + SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_REGEXP, __SYMBOL_ANNOTATE_ERRNO__END, }; -- 2.20.1