From patchwork Tue Aug 1 06:33:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 129017 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2481635vqg; Mon, 31 Jul 2023 23:41:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlGWdRyGDChgqoQ70pvwyp/ox3RPW7BhBh6Xs1yObKgbvhqo3hf9phRZfT4Eg88bydybNm7x X-Received: by 2002:a17:90a:a88e:b0:268:273e:b75d with SMTP id h14-20020a17090aa88e00b00268273eb75dmr10180805pjq.20.1690872090104; Mon, 31 Jul 2023 23:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690872090; cv=none; d=google.com; s=arc-20160816; b=luAHElo1IwMKgwrlwYbnLI6lgK837NutCLf/Jo6hYOrGNZRapQRlgOc0NvFqmrG0+r f6/ACJeakFihXc9jVppr5Q9bL/SH+iZqNj2haQPzgHydY5l4tLufOHMgFLbFMWHsnIqH BQ+xbIi2lN/gLe1LGRLz7niU6ITwG/N9q47oVuc4BTeL56BMfmwN8mRfG7Q9JPLfpAQH oARPok1Zbho2lZ4R5moW8IzQ99z95SyoRCSxz0Z3tAwXnJYwSz2LqVt4lJdZeU4Jp1gl TrN7KukdZgJFskHzl78+ZDbqk8Fv7Jh4x/090P1MPC9UrjtCp8KZDIz+zRno0XA3LxdC 6fjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=qmPoofq7EwXDU52Hmb8/W9uusiNzncOKlDUoHllU30M=; fh=SZ39SBhiFik3r2Qby0lfj8dSyaj5PbEfEri4a6Oa5Uc=; b=lSGJwdHGnSrxB49ZZdKElwr9J3RnEIZ9Amnm8zhg3VuqEpqB7161O/JDyZlIrGPmgd yI2j/HCDSPC/eJfnxrVT7MzZ9gxMDOP8ZTJyjdOSakWEPb92qCIvHONOUtRqRZ1llySj BvBh36xifPNpqwTtvg83sxv8pGEf/kczWxnMQR+nmfhdm1XHcGBGCwp8x6P+aV4y6kKR Fr3rEGC6W4zpwcdtjdOHbI6CfSm/82Nq6ondB1UrA/l9SaHMlpGmgvd6vBaoPmjTbkRW ofCZ8sdIXXud/y44RJOqa7QJ4FNL9/7O8mPvWNdqCQXGSmeqKXYwSNKPxx5VZRclj8Gd Q/YQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nm4-20020a17090b19c400b00263e4949dbbsi1265324pjb.29.2023.07.31.23.41.17; Mon, 31 Jul 2023 23:41:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbjHAGeK (ORCPT + 99 others); Tue, 1 Aug 2023 02:34:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbjHAGeC (ORCPT ); Tue, 1 Aug 2023 02:34:02 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A13472102 for ; Mon, 31 Jul 2023 23:33:38 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8AxlPAfp8hkPOYNAA--.32889S3; Tue, 01 Aug 2023 14:33:03 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxHCMep8hknJZDAA--.26037S2; Tue, 01 Aug 2023 14:33:02 +0800 (CST) From: Tiezhu Yang To: Huacai Chen Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH] LoongArch: Remove noreturn attribute for die() Date: Tue, 1 Aug 2023 14:33:01 +0800 Message-Id: <1690871581-23944-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8BxHCMep8hknJZDAA--.26037S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7trW8ur1xtrWfJw45Zr43urX_yoW8KF13pF W7CasrWFWrCFs5WryDtF4kur15trZ5K3ya9w1q93WSkF4avw18Xr4kGFyqvF4rt34rWFy8 XFWFgw1ftFW3AabCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9Fb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU tVWrXwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v2 6r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17 CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF 0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIx AIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2 KfnxnUUI43ZEXa7IU8EeHDUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773007892435367107 X-GMAIL-MSGID: 1773007892435367107 If notify_die() returns NOTIFY_STOP, there is no need to call make_task_dead(), we can remove noreturn attribute for die(), this is similar with arm64, riscv and csky. While at it, modify the die() declaration in ptrace.h to fix the following checkpatch warnings: WARNING: function definition argument 'const char *' should also have an identifier name WARNING: function definition argument 'struct pt_regs *' should also have an identifier name Signed-off-by: Tiezhu Yang --- arch/loongarch/include/asm/ptrace.h | 2 +- arch/loongarch/kernel/traps.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/loongarch/include/asm/ptrace.h b/arch/loongarch/include/asm/ptrace.h index 35f0958..2101301 100644 --- a/arch/loongarch/include/asm/ptrace.h +++ b/arch/loongarch/include/asm/ptrace.h @@ -162,7 +162,7 @@ static inline void regs_set_return_value(struct pt_regs *regs, unsigned long val #define instruction_pointer(regs) ((regs)->csr_era) #define profile_pc(regs) instruction_pointer(regs) -extern void die(const char *, struct pt_regs *) __noreturn; +void die(const char *str, struct pt_regs *regs); static inline void die_if_kernel(const char *str, struct pt_regs *regs) { diff --git a/arch/loongarch/kernel/traps.c b/arch/loongarch/kernel/traps.c index 8fb5e7a..bbdfc5b 100644 --- a/arch/loongarch/kernel/traps.c +++ b/arch/loongarch/kernel/traps.c @@ -383,16 +383,15 @@ void show_registers(struct pt_regs *regs) static DEFINE_RAW_SPINLOCK(die_lock); -void __noreturn die(const char *str, struct pt_regs *regs) +void die(const char *str, struct pt_regs *regs) { static int die_counter; - int sig = SIGSEGV; + int ret; oops_enter(); - if (notify_die(DIE_OOPS, str, regs, 0, current->thread.trap_nr, - SIGSEGV) == NOTIFY_STOP) - sig = 0; + ret = notify_die(DIE_OOPS, str, regs, 0, + current->thread.trap_nr, SIGSEGV); console_verbose(); raw_spin_lock_irq(&die_lock); @@ -414,7 +413,8 @@ void __noreturn die(const char *str, struct pt_regs *regs) if (panic_on_oops) panic("Fatal exception"); - make_task_dead(sig); + if (ret != NOTIFY_STOP) + make_task_dead(SIGSEGV); } static inline void setup_vint_size(unsigned int size)