Message ID | 20201128081817.15463-4-huangpei@loongson.cn |
---|---|
State | Superseded |
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5F5BE3851C2F; Sat, 28 Nov 2020 08:19:38 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 7A8803851C2F for <libc-alpha@sourceware.org>; Sat, 28 Nov 2020 08:19:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7A8803851C2F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=huangpei@loongson.cn Received: from localhost.localdomain (unknown [182.149.161.68]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxetHVB8Jf7NEXAA--.15226S5; Sat, 28 Nov 2020 16:18:38 +0800 (CST) From: Huang Pei <huangpei@loongson.cn> To: Joseph Myers <joseph@codesourcery.com> Subject: [PATCH 3/3] mips: remove register spill Date: Sat, 28 Nov 2020 16:18:17 +0800 Message-Id: <20201128081817.15463-4-huangpei@loongson.cn> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201128081817.15463-1-huangpei@loongson.cn> References: <20201128081817.15463-1-huangpei@loongson.cn> X-CM-TRANSID: AQAAf9AxetHVB8Jf7NEXAA--.15226S5 X-Coremail-Antispam: 1UD129KBjvJXoW7Ar4fWw4rAr43tryUKF48JFb_yoW8WF17pr 1fu3WUGrWrJryrCrnxur1UG3Z5Jwn2yr15Zr9I9F4YkrW5ur1rK39IvFyfGFy3tryfGF48 ZF1vgrn0grW5Za7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBv14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JrWl82xGYIkIc2 x26xkF7I0E14v26r4j6ryUM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1l84 ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr0_Cr1U M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8ZwCF04 k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18 MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr4 1lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1l IxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4 A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUFXdbUUUUU= X-CM-SenderInfo: xkxd0whshlqz5rrqw2lrqou0/ X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Cc: Huacai Chen <chenhc@lemote.com>, Chenghua Xu <xuchenghua@loongson.cn>, libc-alpha <libc-alpha@sourceware.org> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
[1/3] mips: add hp-timing support for MIPS R2
|
|
Commit Message
Huang Pei
Nov. 28, 2020, 8:18 a.m. UTC
Before Linux/MIPS 2.6.36, kernel expected setting syscall number(aka
"li v0, #sys_number") right precedes "syscall", so the kernel syscall
restart sequence can use CP0 EPC - 4 to restart the syscall, because
kernel DID NOT save v0 during syscall handling. Linux 2.6.36 canceled
this restriction.
See sysdeps/unix/sysv/linux/mips/{mips32/sysdep.h,mips64/sysdep.h,sysdep.h}
Since glibc-2.24 the minimum kernel version is 3.2(much higer than
2.6.36), I think it is OK to remove the ugly register spill in
syscall.S just because of the old convention
Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
sysdeps/unix/sysv/linux/mips/mips64/syscall.S | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
Comments
On 28/11/2020 05:18, Huang Pei wrote: > Before Linux/MIPS 2.6.36, kernel expected setting syscall number(aka > "li v0, #sys_number") right precedes "syscall", so the kernel syscall > restart sequence can use CP0 EPC - 4 to restart the syscall, because > kernel DID NOT save v0 during syscall handling. Linux 2.6.36 canceled > this restriction. > > See sysdeps/unix/sysv/linux/mips/{mips32/sysdep.h,mips64/sysdep.h,sysdep.h} > > Since glibc-2.24 the minimum kernel version is 3.2(much higer than > 2.6.36), I think it is OK to remove the ugly register spill in > syscall.S just because of the old convention > > Signed-off-by: Huang Pei <huangpei@loongson.cn> We do not use SCO, but rather Copyright assignment. The rest of the patch looks ok. > --- > sysdeps/unix/sysv/linux/mips/mips64/syscall.S | 14 ++------------ > 1 file changed, 2 insertions(+), 12 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S > index aab1f389aa..089524a40b 100644 > --- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S > +++ b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S > @@ -27,14 +27,9 @@ > > .text > NESTED (syscall, SZREG, ra) > - .mask 0x00010000, -2 * SZREG > + .mask 0x00000000, 0 > .fmask 0x00000000, 0 > - PTR_ADDIU sp, -2 * SZREG > - cfi_adjust_cfa_offset (2 * SZREG) > - REG_S s0, (sp) > - cfi_rel_offset (s0, 0) > - > - move s0, a0 > + move v0, a0 > move a0, a1 /* shift arg1 - arg7. */ > move a1, a2 > move a2, a3 > @@ -43,13 +38,8 @@ NESTED (syscall, SZREG, ra) > move a5, a6 > move a6, a7 > > - move v0, s0 /* Syscall number -> v0 */ > syscall /* Do the system call. */ > > - REG_L s0, (sp) > - cfi_restore (s0) > - PTR_ADDIU sp, 2 * SZREG > - cfi_adjust_cfa_offset (-2 * 2 * SZREG) > bne a3, zero, L(error) > > ret >
hi, On Mon, Nov 30, 2020 at 11:22:03AM -0300, Adhemerval Zanella wrote: > > > On 28/11/2020 05:18, Huang Pei wrote: > > Before Linux/MIPS 2.6.36, kernel expected setting syscall number(aka > > "li v0, #sys_number") right precedes "syscall", so the kernel syscall > > restart sequence can use CP0 EPC - 4 to restart the syscall, because > > kernel DID NOT save v0 during syscall handling. Linux 2.6.36 canceled > > this restriction. > > > > See sysdeps/unix/sysv/linux/mips/{mips32/sysdep.h,mips64/sysdep.h,sysdep.h} > > > > Since glibc-2.24 the minimum kernel version is 3.2(much higer than > > 2.6.36), I think it is OK to remove the ugly register spill in > > syscall.S just because of the old convention > > > > Signed-off-by: Huang Pei <huangpei@loongson.cn> > > We do not use SCO, but rather Copyright assignment. > > The rest of the patch looks ok. > I would like to combine the Patch 2/3 and Patch 3/3 into one patch, since Patch 2/3 only fix sp alignment, but the key point is folllowing syscall restart convention, any advice? > > --- > > sysdeps/unix/sysv/linux/mips/mips64/syscall.S | 14 ++------------ > > 1 file changed, 2 insertions(+), 12 deletions(-) > > > > diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S > > index aab1f389aa..089524a40b 100644 > > --- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S > > +++ b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S > > @@ -27,14 +27,9 @@ > > > > .text > > NESTED (syscall, SZREG, ra) > > - .mask 0x00010000, -2 * SZREG > > + .mask 0x00000000, 0 > > .fmask 0x00000000, 0 > > - PTR_ADDIU sp, -2 * SZREG > > - cfi_adjust_cfa_offset (2 * SZREG) > > - REG_S s0, (sp) > > - cfi_rel_offset (s0, 0) > > - > > - move s0, a0 > > + move v0, a0 > > move a0, a1 /* shift arg1 - arg7. */ > > move a1, a2 > > move a2, a3 > > @@ -43,13 +38,8 @@ NESTED (syscall, SZREG, ra) > > move a5, a6 > > move a6, a7 > > > > - move v0, s0 /* Syscall number -> v0 */ > > syscall /* Do the system call. */ > > > > - REG_L s0, (sp) > > - cfi_restore (s0) > > - PTR_ADDIU sp, 2 * SZREG > > - cfi_adjust_cfa_offset (-2 * 2 * SZREG) > > bne a3, zero, L(error) > > > > ret > >
On 01/12/2020 06:39, Huang Pei wrote: > hi, > > On Mon, Nov 30, 2020 at 11:22:03AM -0300, Adhemerval Zanella wrote: >> >> >> On 28/11/2020 05:18, Huang Pei wrote: >>> Before Linux/MIPS 2.6.36, kernel expected setting syscall number(aka >>> "li v0, #sys_number") right precedes "syscall", so the kernel syscall >>> restart sequence can use CP0 EPC - 4 to restart the syscall, because >>> kernel DID NOT save v0 during syscall handling. Linux 2.6.36 canceled >>> this restriction. >>> >>> See sysdeps/unix/sysv/linux/mips/{mips32/sysdep.h,mips64/sysdep.h,sysdep.h} >>> >>> Since glibc-2.24 the minimum kernel version is 3.2(much higer than >>> 2.6.36), I think it is OK to remove the ugly register spill in >>> syscall.S just because of the old convention >>> >>> Signed-off-by: Huang Pei <huangpei@loongson.cn> >> >> We do not use SCO, but rather Copyright assignment. >> >> The rest of the patch looks ok. >> > > I would like to combine the Patch 2/3 and Patch 3/3 into one patch, > since Patch 2/3 only fix sp alignment, but the key point is folllowing syscall > restart convention, any advice? Send a v2 with the patches merged and the hp-inline fix.
On Tue, 1 Dec 2020, Adhemerval Zanella via Libc-alpha wrote: > > I would like to combine the Patch 2/3 and Patch 3/3 into one patch, > > since Patch 2/3 only fix sp alignment, but the key point is folllowing syscall > > restart convention, any advice? > > Send a v2 with the patches merged and the hp-inline fix. I would defer the removal of the old syscall restart convention in this single place only. I don't think we need to introduce such a mess. Instead an audit should be made and all the places adjusted with a single change. That would include at least MIPS16 wrappers, and IIRC some microMIPS support code, and then the comment I referred previously needs to be adjusted accordingly (maybe removed altogether even). Maciej
On 04/12/2020 08:03, Maciej W. Rozycki wrote: > On Tue, 1 Dec 2020, Adhemerval Zanella via Libc-alpha wrote: > >>> I would like to combine the Patch 2/3 and Patch 3/3 into one patch, >>> since Patch 2/3 only fix sp alignment, but the key point is folllowing syscall >>> restart convention, any advice? >> >> Send a v2 with the patches merged and the hp-inline fix. > > I would defer the removal of the old syscall restart convention in this > single place only. I don't think we need to introduce such a mess. > > Instead an audit should be made and all the places adjusted with a single > change. That would include at least MIPS16 wrappers, and IIRC some > microMIPS support code, and then the comment I referred previously needs > to be adjusted accordingly (maybe removed altogether even). > > Maciej Alright, it seems better indeed.
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S index aab1f389aa..089524a40b 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/syscall.S +++ b/sysdeps/unix/sysv/linux/mips/mips64/syscall.S @@ -27,14 +27,9 @@ .text NESTED (syscall, SZREG, ra) - .mask 0x00010000, -2 * SZREG + .mask 0x00000000, 0 .fmask 0x00000000, 0 - PTR_ADDIU sp, -2 * SZREG - cfi_adjust_cfa_offset (2 * SZREG) - REG_S s0, (sp) - cfi_rel_offset (s0, 0) - - move s0, a0 + move v0, a0 move a0, a1 /* shift arg1 - arg7. */ move a1, a2 move a2, a3 @@ -43,13 +38,8 @@ NESTED (syscall, SZREG, ra) move a5, a6 move a6, a7 - move v0, s0 /* Syscall number -> v0 */ syscall /* Do the system call. */ - REG_L s0, (sp) - cfi_restore (s0) - PTR_ADDIU sp, 2 * SZREG - cfi_adjust_cfa_offset (-2 * 2 * SZREG) bne a3, zero, L(error) ret