From nobody Wed Feb 5 15:54:22 2025 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D48B41DD520 for ; Wed, 15 Jan 2025 22:50:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736981448; cv=none; b=QfjaF3yX/BwJy2ymiI7OtVwZTp1HRRC2GbO48RUxlut6/FOftH/AQ1T3bO/znbWZNWxA6zIy/1iUI7hG2B46SGAH18zZCdLiLgIZfcMjLK0U1v3uvNH67GJqbOvNMvIdpeuPTPeSEja4ptU106hQlygy0adrSIR5zA2VqNlUTqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736981448; c=relaxed/simple; bh=buhY3GoC0LGY1HUaDu1bTWqVjA42DPm4i5qlmE4s1Nc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=adbtjY9RysR0YI6zSkFlWPq+J680lh3BDQULjqQFXXvxY4WDa7n8ubA2RpDkXmMC41eSRo2HzW6ZYmQZ/8PlTSw56Zu++MyyI4W0alygYSMqey7xcjTxgMZWY5g6PqGz84lNeL6UAS0+lAPg4ekNKtICYFj28dMb1tBMgo/tZ4Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4YYLct50S8z9sSq; Wed, 15 Jan 2025 23:43:26 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kzmB7gqQMCTP; Wed, 15 Jan 2025 23:43:26 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4YYLct3ptxz9sSn; Wed, 15 Jan 2025 23:43:26 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6F3AF8B77A; Wed, 15 Jan 2025 23:43:26 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id xL4HBP5zkE8F; Wed, 15 Jan 2025 23:43:26 +0100 (CET) Received: from PO20335.idsi0.si.c-s.fr (unknown [192.168.202.221]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 08F088B774; Wed, 15 Jan 2025 23:43:23 +0100 (CET) From: Christophe Leroy To: Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Julien Thierry , Miroslav Benes , Raphael Gault , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Madhavan Srinivasan Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, llvm@lists.linux.dev Subject: [PATCH v5 14/15] powerpc/bug: Annotate reachable after warning trap Date: Wed, 15 Jan 2025 23:42:54 +0100 Message-ID: <25e776852c18471a78dca172c6253e16e8d28c51.1736955567.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1736980964; l=2325; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=buhY3GoC0LGY1HUaDu1bTWqVjA42DPm4i5qlmE4s1Nc=; b=Zzx0LN7CaVkiZJDwdxeV+ibCLDFY96znMCMxLBDAlvwLJ2kQLdeuupSEGG4ZBBiXYwNYUUDFV Q5UGbSOaXY1D8KkUN/X3yxxwGstc0o5rsND8gM0oXshr0I9HPzvQNOo X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit is copied from commit bfb1a7c91fb7 ("x86/bug: Merge annotate_reachable() into _BUG_FLAGS() asm") 'twi 31,0,0' is a BUG instruction, which is by default a dead end. But the same instruction is used for WARNINGs and the execution resumes with the following instruction. Mark it reachable so that objtool knows that it is not a dead end in that case. Also change the unreachable() annotation by __builtin_unreachable() since objtool already knows that a BUG instruction is a dead end. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/bug.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index 1db485aacbd9..c41e9f903b5b 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -4,6 +4,7 @@ #ifdef __KERNEL__ =20 #include +#include =20 #ifdef CONFIG_BUG =20 @@ -51,10 +52,11 @@ ".previous\n" #endif =20 -#define BUG_ENTRY(insn, flags, ...) \ +#define BUG_ENTRY(insn, flags, extra, ...) \ __asm__ __volatile__( \ "1: " insn "\n" \ _EMIT_BUG_ENTRY \ + extra \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (flags), \ "i" (sizeof(struct bug_entry)), \ @@ -67,12 +69,12 @@ */ =20 #define BUG() do { \ - BUG_ENTRY("twi 31, 0, 0", 0); \ - unreachable(); \ + BUG_ENTRY("twi 31, 0, 0", 0, ""); \ + __builtin_unreachable(); \ } while (0) #define HAVE_ARCH_BUG =20 -#define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (f= lags)) +#define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (f= lags), ANNOTATE_REACHABLE(1b)) =20 #ifdef CONFIG_PPC64 #define BUG_ON(x) do { \ @@ -80,7 +82,7 @@ if (x) \ BUG(); \ } else { \ - BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x))); \ + BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "", "r" ((__force long)(x))); \ } \ } while (0) =20 @@ -92,7 +94,7 @@ } else { \ BUG_ENTRY(PPC_TLNEI " %4, 0", \ BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \ - "r" (__ret_warn_on)); \ + "", "r" (__ret_warn_on)); \ } \ unlikely(__ret_warn_on); \ }) --=20 2.47.0