Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp78233iog; Tue, 14 Jun 2022 19:40:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tiWyiNmLG53TcJcT/tMhkthvw6TE58U/mfBqi3uDdojcdlybXHrPqD8LBLzV4FtGmcKX8b X-Received: by 2002:a17:903:2312:b0:163:daf7:83a9 with SMTP id d18-20020a170903231200b00163daf783a9mr7093869plh.160.1655260859211; Tue, 14 Jun 2022 19:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655260859; cv=none; d=google.com; s=arc-20160816; b=oaFxBRA1vcfsKkaoV44NOL05kk1koKduQKKHwRsE7KDkexGby2gMPdG7BCEeSwu7Uy +DzWzuRRXQ9DAe658/qYvhnI5DJxDM204FHMRmhpPnNd8jaVULqv3ri7ApNCkz1XWYND c13ca8jUPlV3lTH+mLOTwWnb68u4/kfJ4G2ScIzArE0ZGPmuTWzNCVHf/Ix5h13OXzj5 n/wvyT3y0Sro8TwuGDtVeb4TLHIf3ENKGLHsBYbJfpn4rvtdgXvaa34xrRvaWDTs9rQV 3g7UkdyjF7Kycyv0lhijoxAyrt485sqo7LNIumOopNlL/nS8P8+OpboBGS4zk8fAiEbW /pQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=/BlYCiXQxVfrc+ZBqbEUEhX4VZkG1wzYh7/0b3sNOCc=; b=KwKn4uMmKOPWTwVBVwklguKWxLID9fUs/6DRZnoPjsCetOrj1mZtXoJa2g+fAcEZI1 TUddxso9x6Znv/qCFnYfdZl3gpG0AJu8k8d0BGh8bGlqjBaJeJE7aVDzyyxM5srgEaFX hXAmhN3PNbtHCsKW1prhw2UH8mh4qwBnzdzsHmwUyb+rMLWBd3xFa2Ly/ODS8rCKQwo0 7ZqnI6U9pFkPj9ABUYjPFtyPCdgmFoP7X9W1dl4JBy3eKLwxHGzIxd2PhQ+PFLiU2k9F gw6BTpmqUoestgjJiSy8MPdTjX1AiioER50+2qgywl44VbRh11Ln+BZNmGJEcB01ANj8 UNHw== 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-20020a170902aa8500b0015ecc946750si14550330plr.409.2022.06.14.19.40.44; Tue, 14 Jun 2022 19:40:59 -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 S244176AbiFOBj0 (ORCPT + 99 others); Tue, 14 Jun 2022 21:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238027AbiFOBjP (ORCPT ); Tue, 14 Jun 2022 21:39:15 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 055A633A25 for ; Tue, 14 Jun 2022 18:39:09 -0700 (PDT) Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxP046OKliBLNCAA--.5517S4; Wed, 15 Jun 2022 09:39:08 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui Cc: Xuefeng Li , Jianmin Lv , Jun Yi , linux-kernel@vger.kernel.org Subject: [RFC PATCH 2/2] LoongArch: No need to call RESTORE_ALL_AND_RET for all syscalls Date: Wed, 15 Jun 2022 09:39:05 +0800 Message-Id: <1655257145-24140-3-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1655257145-24140-1-git-send-email-yangtiezhu@loongson.cn> References: <1655257145-24140-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9DxP046OKliBLNCAA--.5517S4 X-Coremail-Antispam: 1UD129KBjvJXoW7CF1rXw4UCF47tr1xur4kJFb_yoW8WFW7p3 ZrZFn7tr40gr93A34ayryxurZFyanrGa129FsFkryruw1kXr98ZFyvva4DtF12yw48KrW0 ga4rGwnIgFyUXwUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBv14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jryl82xGYIkIc2 x26xkF7I0E14v26r4j6ryUM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UM2 8EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr1j6F4U JwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY02Avz4vE14v_KwCF04 k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18 MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr4 1lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1l IxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4 A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU7nYwUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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 In handle_syscall, it is unnecessary to call RESTORE_ALL_AND_RET for all syscalls, clone and clone3 should call RESTORE_STATIC_SOME_AND_RET, and the other syscalls should call RESTORE_SOME_AND_RET. Signed-off-by: Tiezhu Yang --- arch/loongarch/include/asm/stackframe.h | 10 ++++++++++ arch/loongarch/kernel/entry.S | 12 +++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/loongarch/include/asm/stackframe.h b/arch/loongarch/include/asm/stackframe.h index 4ca9530..9869b39 100644 --- a/arch/loongarch/include/asm/stackframe.h +++ b/arch/loongarch/include/asm/stackframe.h @@ -216,4 +216,14 @@ RESTORE_SP_AND_RET \docfi .endm + .macro RESTORE_STATIC_SOME_AND_RET docfi=0 + RESTORE_STATIC \docfi + RESTORE_SOME \docfi + RESTORE_SP_AND_RET \docfi + .endm + + .macro RESTORE_SOME_AND_RET docfi=0 + RESTORE_SOME \docfi + RESTORE_SP_AND_RET \docfi + .endm #endif /* _ASM_STACKFRAME_H */ diff --git a/arch/loongarch/kernel/entry.S b/arch/loongarch/kernel/entry.S index 551b6ec..8176094 100644 --- a/arch/loongarch/kernel/entry.S +++ b/arch/loongarch/kernel/entry.S @@ -78,7 +78,17 @@ SYM_FUNC_START(handle_syscall) move a0, sp bl do_syscall - RESTORE_ALL_AND_RET + /* + * Syscall number held in a7. + * If syscall number is __NR_clone and __NR_clone3, call RESTORE_STATIC_SOME_AND_RET. + */ + li.w t3, __NR_clone + beq a7, t3, 3f + li.w t3, __NR_clone3 + beq a7, t3, 3f + RESTORE_SOME_AND_RET +3: + RESTORE_STATIC_SOME_AND_RET SYM_FUNC_END(handle_syscall) SYM_CODE_START(ret_from_fork) -- 2.1.0