Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5309434rwb; Mon, 31 Jul 2023 23:45:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlG34NV9eDpKOPnP35/BEJmH+4uqIcBs129H0g55HcgQR9VTY+ayBmTFkdRBO47pZJbEo3su X-Received: by 2002:a05:6358:418f:b0:135:4003:784a with SMTP id w15-20020a056358418f00b001354003784amr1819784rwc.19.1690872325696; Mon, 31 Jul 2023 23:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690872325; cv=none; d=google.com; s=arc-20160816; b=e9K8xPFP1bGqqwKAIcfjiffADXQaXWvPHS/ThCgTgnKrSBK872+kZKKFcNMrvzYrdD FBPuhTu7oGiFY1nFdd/yuGKhcZn5eeSRqC34fyMBpUW2vNtByxOt/VOw/8/PLCyJhHVg ToAdDv4MdEuINpCWHobtWOIYT6O1DfhA3cAiFIHUd5vy0O3zanUhzNqiG6cxE7tIy16w BhN0NJwUbJN/4L3qpg0EN25xCHFUK1p/uUgRK4yJoMBgMVND127ooHsFQbSSymwNzu1y 9ZvYjIti5Qqm3mejLXpeIZCTxVmvghJpHlDoRMqf78gCUgi0jzfAuBldNHTW7yEegDmW Mr6Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a63f245000000b0056336fb99aasi7645490pgk.850.2023.07.31.23.45.13; Mon, 31 Jul 2023 23:45:25 -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 S231516AbjHAGeK (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 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) -- 2.1.0