From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7B8F522F18; Mon, 21 Sep 2026 22:31:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790029904; cv=none; b=lHybC4YmQAIErcE14/XsN4mjrLo9Nzt0r8TfM4obFi7C8yLwDTuCqlM6z0pMqcwVtRjJa4kp3kpIH1O5brhBt7TK3hl0zNA+gO2FctDlWstC1P2C/+plY/PI/bI9F/s9lNSjgv89W5rc3ywymeAObodaAgFCgh5CNxgHyyNdo00= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790029904; c=relaxed/simple; bh=qWztlRwzMp0eC2vV1a7ZtSRKJ/oNH+JGaEQpizwVGGM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FtuUhXg5mkk/YUiGay0rNv1h5KKV+FCxont4EsC3UKNYc/ufi9boeLoGLXzmYOkQjdRN7DdRKrk5IogSmrK82RqSBnHdqRm1SAJO3ofPSxs10MZtDBp5iDGTFIHi32X9wOPaFWE3XZ416zEYh1Y4Ja6PJxpiVDZMGR1+UKY9gQw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lLPzrkID; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lLPzrkID" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43AD71F00898; Mon, 21 Sep 2026 22:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790029902; bh=vNjsHB30KZpNjM4w2L4yDqFztf6tF3EEy9YfZGXC5gU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lLPzrkIDVy6wOojemL2trLkqY7YJFs4LCojDskXqd4KaML++0Lgh2Hm6xDCaJrFao jwvYYmhcvAI8N8BexStXgHXdNb1Ep5DMrKyuz+ynVeWybih3N7zacRF1UHv2tziJBa TQaUdAQdnwibk3bQK7boEBAho39fnu81jB7Y7qFQZq7sNqiLnyn/e5D+CjBS/gQ7iS 5mYWWCnbR6KuSLbdSJn3sfkntQ6dE2n+4E71F4G0Z6iAA6nKQtNlB6PcZ6hy6nyccL GdV0q94kGDliYL/mb3cSoIw5PD6n+CisWhuf2Pw0oLvKOBgJyOmeE3wSP+GeCCPyf5 LAYSuylzqazvA== From: Josh Poimboeuf To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Gary Guo , rust-for-linux@vger.kernel.org, Ard Biesheuvel , Miguel Ojeda , Nathan Chancellor , Nicolas Schier , linux-kbuild@vger.kernel.org, Huacai Chen Subject: [PATCH v3 11/28] LoongArch: Annotate reboot and kexec paths as returnable Date: Mon, 21 Sep 2026 15:31:12 -0700 Message-ID: X-Mailer: git-send-email 2.55.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 Content-Transfer-Encoding: 8bit Running objtool on LoongArch vmlinux.o shows the following warnings: vmlinux.o: warning: objtool: __do_sys_reboot+0x188: kernel_restart() is missing __noreturn in .c/.h vmlinux.o: warning: objtool: hw_failure_emergency_action_func+0x74: kernel_restart() is missing __noreturn in .c/.h vmlinux.o: warning: objtool: hibernate+0x3cc: kernel_halt() is missing __noreturn in .c/.h vmlinux.o: warning: objtool: kernel_kexec+0xbc: machine_kexec() is missing __noreturn in .c/.h vmlinux.o: warning: objtool: restart_poweroff_do_poweroff+0x1c: machine_restart() is missing __noreturn in .c/.h The problem is that the generic declarations of the above functions are not declared noreturn. But marking them __noreturn wouldn't be straightforward given the inconsistent behaviors they have across the arches: - In many cases they don't return, but the compiler doesn't have visibility to that for various reasons including inline asm and indirect calls to noreturn functions (which objtool is currently not equipped to deal with). - In some cases they even *do* return, e.g. x86 machine_exec(), arm64 machine_power_off(), and hexagon machine_restart(). In lieu of undertaking such a large cleanup, fix the above warnings with a few annotations so objtool doesn't consider them noreturn, consistent with their call sites. Signed-off-by: Josh Poimboeuf --- arch/loongarch/kernel/machine_kexec.c | 2 ++ arch/loongarch/kernel/reset.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/arch/loongarch/kernel/machine_kexec.c b/arch/loongarch/kernel/machine_kexec.c index 1883cae93bc31..e40b6767df24e 100644 --- a/arch/loongarch/kernel/machine_kexec.c +++ b/arch/loongarch/kernel/machine_kexec.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -296,3 +297,4 @@ void machine_kexec(struct kimage *image) kexec_reboot(); } +ANNOTATE_IGNORE_NORETURN(machine_kexec); diff --git a/arch/loongarch/kernel/reset.c b/arch/loongarch/kernel/reset.c index de8fa5a8a825c..89ee0edcf58d2 100644 --- a/arch/loongarch/kernel/reset.c +++ b/arch/loongarch/kernel/reset.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,7 @@ void machine_halt(void) __asm__ __volatile__("idle 0" : : : "memory"); } } +ANNOTATE_IGNORE_NORETURN(machine_halt); void machine_power_off(void) { @@ -56,6 +58,7 @@ void machine_power_off(void) __asm__ __volatile__("idle 0" : : : "memory"); } } +ANNOTATE_IGNORE_NORETURN(machine_power_off); void machine_restart(char *command) { @@ -77,3 +80,4 @@ void machine_restart(char *command) __asm__ __volatile__("idle 0" : : : "memory"); } } +ANNOTATE_IGNORE_NORETURN(machine_restart); -- 2.55.0