Message ID | 1593496449-24439-1-git-send-email-vincent.chen@sifive.com |
---|---|
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 18D2F385ED4C; Tue, 30 Jun 2020 05:54:26 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id E1DD13858D38 for <libc-alpha@sourceware.org>; Tue, 30 Jun 2020 05:54:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E1DD13858D38 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=vincent.chen@sifive.com Received: by mail-pj1-x102f.google.com with SMTP id i4so9022893pjd.0 for <libc-alpha@sourceware.org>; Mon, 29 Jun 2020 22:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id; bh=/2E/FMty7gv4SYmuAs87fXJsNnmOBeNwLedMdtA/YtQ=; b=VOIjlCGcQFD2VtXxxjaxI3Fz/8VHy6b8MfrSHK7Lf45CQSF8y+cgupz41DkBEJ881+ v3r/2rYwOozwyWFXhK8ecqPN5WgtUoSHcWjlb52S6xLrona5JhrSEdVgGzsKfOW95pNg 5pyju3t2UzGQIwqpXZmEsBJ4/62WzpguA/xPgGYfiOLvZ7USl0OvIK6o2VRkJMh55ljj gm3ojHEiqpl14n1d61037f89qTP5tt/HQLuVGkeOtnaojkzcNIF2lr/rST66EpXEK+pP 3qoTFuOpYAbQOm2gmOZux1J7RNgAb1vPqRQSN6dC9UywgSKgRGFphZu/I9TavPIGdoqk H8kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/2E/FMty7gv4SYmuAs87fXJsNnmOBeNwLedMdtA/YtQ=; b=oi4U5EV2qA5gVX5qR2FZv0O538zvLMGd7p+7kTL2NXfQiFlgB1nxmIIrmST063d52K Zb9m9r1qR6Wr2jAT8ZXozmHGKZlXcIspBZZH7OomN8BhyDTCWwbGtUoTlVPwFRjDmQSL k08fz31SPnzsiiG9qEN8UOgqQ3MY+uznHg1JxUkRo+gRu643x7pco+ChJeW5wCkRtxhr OPppIloHhXG+8nS98JBYqP3PXW3YLomDPjZHkIDlpa0Ilz7d6J0zNnuWWiCuNt58zStc ll8rMFC9jBiz0gNAL4QB5KobvR/5sjddIrvjs6dDaudwW5Z9jnmPI+BtrQuZXGIh6dTA SxOQ== X-Gm-Message-State: AOAM531J8E+CpqLnCXd6xialOXc53BHCHJMcFisv2RAN1b+3MWrKZf3P CJ09/ghY1JAKrk/eTBXlA/kPwUSPx4M= X-Google-Smtp-Source: ABdhPJwP3hBnu3FWmR1W9hGQlDr11RsLVCr4ShMvNjo/gQcIF56dkrD04zc1iiAKUFDkTTiPKIU9pA== X-Received: by 2002:a17:90a:778c:: with SMTP id v12mr20974389pjk.34.1593496461687; Mon, 29 Jun 2020 22:54:21 -0700 (PDT) Received: from VincentChen-ThinkPad-T480s.internal.sifive.com (114-34-229-221.HINET-IP.hinet.net. [114.34.229.221]) by smtp.gmail.com with ESMTPSA id gm11sm1125862pjb.9.2020.06.29.22.54.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Jun 2020 22:54:21 -0700 (PDT) From: Vincent Chen <vincent.chen@sifive.com> To: libc-alpha@sourceware.org, palmer@dabbelt.com Subject: [RFC PATCH] riscv: remove riscv-specific sigcontext.h Date: Tue, 30 Jun 2020 13:54:09 +0800 Message-Id: <1593496449-24439-1-git-send-email-vincent.chen@sifive.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: <http://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: <http://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Cc: vincent.chen@sifive.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
[RFC] riscv: remove riscv-specific sigcontext.h
|
|
Commit Message
Vincent Chen
June 30, 2020, 5:54 a.m. UTC
Many RISC-V extensions are under development, such as Vector extension, even though RISC-V allows vendors to customize their extension. A new extension may introduce new registers to the contents of the signal context. To align the contents of struct sigcontext between kernel and glibc, the developers need to perform the same modifications twice. This RFC patch attempts to use the Glibc generic sigcontext.h to reduce the modification from two to one. Because The element names of struct sigcontext in these two sigcontext.h are different, this change will cause some backward-incompatible issues. To evaluate the impact, I issued a discussion in the RISC-V software group https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/52cbGQCyy2s. I followed the suggestions to build the OpenEmbedded with this Glibc change, and all utility programs were passed. Therefore, I think that the backward-incompatible issue may not be serious at this moment. If everyone thinks this change is reasonable and feasible, I will discuss with compiler guys to come up with a solution to apply the new sigcontext.h to the GCC stack unwinding. --- sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h | 31 ------------------------- 1 file changed, 31 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h
Comments
On Mon, Jun 29, 2020 at 10:54 PM Vincent Chen <vincent.chen@sifive.com> wrote: > > Many RISC-V extensions are under development, such as Vector extension, > even though RISC-V allows vendors to customize their extension. A new > extension may introduce new registers to the contents of the signal > context. To align the contents of struct sigcontext between kernel and > glibc, the developers need to perform the same modifications twice. This > RFC patch attempts to use the Glibc generic sigcontext.h to reduce the > modification from two to one. Because The element names of struct > sigcontext in these two sigcontext.h are different, this change will cause > some backward-incompatible issues. To evaluate the impact, I issued a > discussion in the RISC-V software group > https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/52cbGQCyy2s. > I followed the suggestions to build the OpenEmbedded with this Glibc change, > and all utility programs were passed. Therefore, I think that the What did you build? Can you provide more details. Have you done any userspace testing as well? > backward-incompatible issue may not be serious at this moment. If everyone > thinks this change is reasonable and feasible, I will discuss with compiler > guys to come up with a solution to apply the new sigcontext.h to the GCC > stack unwinding. Will this affect LLVM as well? Alistair > --- > sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h | 31 ------------------------- > 1 file changed, 31 deletions(-) > delete mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h > > diff --git a/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h b/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h > deleted file mode 100644 > index 4b7c09e..0000000 > --- a/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h > +++ /dev/null > @@ -1,31 +0,0 @@ > -/* Machine-dependent signal context structure for Linux. RISC-V version. > - Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. > - > - The GNU C Library is free software; you can redistribute it and/or > - modify it under the terms of the GNU Lesser General Public > - License as published by the Free Software Foundation; either > - version 2.1 of the License, or (at your option) any later version. > - > - The GNU C Library is distributed in the hope that it will be useful, > - but WITHOUT ANY WARRANTY; without even the implied warranty of > - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > - Lesser General Public License for more details. > - > - You should have received a copy of the GNU Lesser General Public > - License along with the GNU C Library. If not, see > - <https://www.gnu.org/licenses/>. */ > - > -#ifndef _BITS_SIGCONTEXT_H > -#define _BITS_SIGCONTEXT_H 1 > - > -#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H > -# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." > -#endif > - > -struct sigcontext { > - /* gregs[0] holds the program counter. */ > - unsigned long int gregs[32]; > - unsigned long long int fpregs[66] __attribute__ ((__aligned__ (16))); > -}; > - > -#endif > -- > 2.7.4 >
On Fri, Jul 10, 2020 at 6:25 AM Alistair Francis <alistair23@gmail.com> wrote: > > On Mon, Jun 29, 2020 at 10:54 PM Vincent Chen <vincent.chen@sifive.com> wrote: > > > > Many RISC-V extensions are under development, such as Vector extension, > > even though RISC-V allows vendors to customize their extension. A new > > extension may introduce new registers to the contents of the signal > > context. To align the contents of struct sigcontext between kernel and > > glibc, the developers need to perform the same modifications twice. This > > RFC patch attempts to use the Glibc generic sigcontext.h to reduce the > > modification from two to one. Because The element names of struct > > sigcontext in these two sigcontext.h are different, this change will cause > > some backward-incompatible issues. To evaluate the impact, I issued a > > discussion in the RISC-V software group > > https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/52cbGQCyy2s. > > I followed the suggestions to build the OpenEmbedded with this Glibc change, > > and all utility programs were passed. Therefore, I think that the > > What did you build? Can you provide more details. Sure. I followed the README in https://github.com/riscv/meta-riscv to build the OpenEmbedded. To enable OpenEmbedded to include this change in Glibc sigcontext.h before executing the ". ./meta-riscv/setup.sh", I put this Glibc patch in openembedded-core/meta/recipes-core/glibc/glibc/ folder and an informal GCC patch for fixing the stack unwinding mechanism in openembedded-core/meta/recipes-devtools/gcc/gcc-10.1/ folder. Then, I modified Glibc's recipe, glibc_2.31.bb, and GCC's recipes, gcc-10.1.inc, to include these two patches. Based on the above modifications, I built multiple images, such as MACHINE=freedom-u540 core-image-base, MACHINE=freedom-u540 core-image-weston, MACHINE=qemuriscv64 core-image-full-cmdline and MACHINE=qemuriscv32 core-image-base. These images all can pass the compilation. Hence I think there are very few programs that uses struct sigcontext. If you find out what evaluations or experiments I am missing, please tell me. Thank you > Have you done any userspace testing as well? > Do you mean what userspace testing I have done for this Glibc patch? If yes, I used glibc test suite to test this Glibc patch + required modification in GCC stack unwinding, and it passes all the tests including unwinding tests (excluding some known failure cases). > > backward-incompatible issue may not be serious at this moment. If everyone > > thinks this change is reasonable and feasible, I will discuss with compiler > > guys to come up with a solution to apply the new sigcontext.h to the GCC > > stack unwinding. > > Will this affect LLVM as well? > As far as I knew, LLVM does not use struct sigcontext to access the signal context. Instead, it directly uses memory offset to access the signal context. Hence, I think this Glibc change will not affect LLVM. > Alistair > > > --- > > sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h | 31 ------------------------- > > 1 file changed, 31 deletions(-) > > delete mode 100644 sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h > > > > diff --git a/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h b/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h > > deleted file mode 100644 > > index 4b7c09e..0000000 > > --- a/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h > > +++ /dev/null > > @@ -1,31 +0,0 @@ > > -/* Machine-dependent signal context structure for Linux. RISC-V version. > > - Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. > > - > > - The GNU C Library is free software; you can redistribute it and/or > > - modify it under the terms of the GNU Lesser General Public > > - License as published by the Free Software Foundation; either > > - version 2.1 of the License, or (at your option) any later version. > > - > > - The GNU C Library is distributed in the hope that it will be useful, > > - but WITHOUT ANY WARRANTY; without even the implied warranty of > > - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > - Lesser General Public License for more details. > > - > > - You should have received a copy of the GNU Lesser General Public > > - License along with the GNU C Library. If not, see > > - <https://www.gnu.org/licenses/>. */ > > - > > -#ifndef _BITS_SIGCONTEXT_H > > -#define _BITS_SIGCONTEXT_H 1 > > - > > -#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H > > -# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." > > -#endif > > - > > -struct sigcontext { > > - /* gregs[0] holds the program counter. */ > > - unsigned long int gregs[32]; > > - unsigned long long int fpregs[66] __attribute__ ((__aligned__ (16))); > > -}; > > - > > -#endif > > -- > > 2.7.4 > >
diff --git a/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h b/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h deleted file mode 100644 index 4b7c09e..0000000 --- a/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Machine-dependent signal context structure for Linux. RISC-V version. - Copyright (C) 1996-2020 Free Software Foundation, Inc. This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - <https://www.gnu.org/licenses/>. */ - -#ifndef _BITS_SIGCONTEXT_H -#define _BITS_SIGCONTEXT_H 1 - -#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H -# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead." -#endif - -struct sigcontext { - /* gregs[0] holds the program counter. */ - unsigned long int gregs[32]; - unsigned long long int fpregs[66] __attribute__ ((__aligned__ (16))); -}; - -#endif