From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 0C2FC3858413 for ; Thu, 16 Sep 2021 23:56:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0C2FC3858413 Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-212-oUfoGCYdMmSdI_sOxhqG1A-1; Thu, 16 Sep 2021 19:56:28 -0400 X-MC-Unique: oUfoGCYdMmSdI_sOxhqG1A-1 Received: by mail-pj1-f72.google.com with SMTP id s13-20020a17090a760d00b001996da9681dso6185541pjk.9 for ; Thu, 16 Sep 2021 16:56:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=KsgfMSu4Z5Ub6BIthmOi9OVRTCYx/l2WsgynooFww18=; b=dyFAibbXQ8nrckXqpaRfiyWMav6RCpZx66gKNmuoexFCDIGAp9Vjt8GzrLJmZmTjtS w1Ft8LB54cdarTL9A9hgYqUzjTg0zaLPVYbhM66+EVpa6I8FxOFtdlNbyjnhZSfPbt1D TY9dLkznEpdFyjxX7uXmCKXVgjZnxKP0RvcEnV+ookj6fPEfPj0Bios1b5Kre+pcbWMm dElVPWK0AP4OzDyvt2Efmje8ucoKZ9F0iw/UlV0z99K3x3b9hH5g9XYrUpl9S4fzFCjV is8FVFt8fvSkuqFBNGpwziBuHSJEHnx/2xTOpF6GWx84Y0CutArkro7AY9bZ4BiFZUGq R8PA== X-Gm-Message-State: AOAM531ePPVpifiSXMwl/j8uMn/W1Fs4F0VsfoiAeQ5T3OLi/zBDMIv6 +bBCWztC6c0yPVHJN7pEW+d/TyULqDA+pVCiRSXYllKfFoMQA7laMOp/mwTf4YmhvuaCqxlwoEm nbQaEPrNMrTRN/8680p8qOOQq92MAL1ujtXHxVl8luEAE9TeFzI/OEk/zsBC96dyHgDZywRE= X-Received: by 2002:aa7:9f09:0:b0:440:e0d8:8cb4 with SMTP id g9-20020aa79f09000000b00440e0d88cb4mr5758285pfr.36.1631836587380; Thu, 16 Sep 2021 16:56:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1PP0PSe5/1yKcvFpE4p6K+yn6sa62Fvr7XSAR1IZ3HVHvHPzrYLkeJbIDToX/PcU2zZeceA== X-Received: by 2002:aa7:9f09:0:b0:440:e0d8:8cb4 with SMTP id g9-20020aa79f09000000b00440e0d88cb4mr5758246pfr.36.1631836586815; Thu, 16 Sep 2021 16:56:26 -0700 (PDT) Received: from smtpclient.apple ([23.81.176.110]) by smtp.gmail.com with ESMTPSA id c133sm4006235pfb.39.2021.09.16.16.56.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Sep 2021 16:56:26 -0700 (PDT) From: Ben Woodard Mime-Version: 1.0 (1.0) Subject: Re: [RFC patch 2/5] RISC-V: Reserve about 5K space in mcontext_t to support future ISA expansion. Date: Thu, 16 Sep 2021 16:56:25 -0700 Message-Id: <8AA117E9-6E7C-4D0F-894A-E63EBD40544B@redhat.com> References: Cc: Rich Felker , Florian Weimer , GNU C Library , Andrew Waterman In-Reply-To: To: Vincent Chen X-Mailer: iPad Mail (18H17) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2021 23:56:31 -0000 I know this patch set mostly deals with signal handling but don=E2=80=99t f= orget LD_AUDIT. It has a similar issue for the plt_enter and exit functions= . -ben > On Sep 16, 2021, at 1:03 AM, Vincent Chen wrote= : >=20 > =EF=BB=BFOn Mon, Sep 13, 2021 at 9:52 PM Rich Felker wr= ote: >>=20 >>> On Mon, Sep 13, 2021 at 03:44:09PM +0200, Florian Weimer via Libc-alpha= wrote: >>> * Vincent Chen: >>>=20 >>>> Following the changes of struct sigcontext in Linux to reserve about 5= K space >>>> to support future ISA expansion. >>>> --- >>>> sysdeps/unix/sysv/linux/riscv/sys/ucontext.h | 2 ++ >>>> 1 file changed, 2 insertions(+) >>>>=20 >>>> diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/un= ix/sysv/linux/riscv/sys/ucontext.h >>>> index cfafa44..80caf07 100644 >>>> --- a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h >>>> +++ b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h >>>> @@ -82,6 +82,8 @@ typedef struct mcontext_t >>>> { >>>> __riscv_mc_gp_state __gregs; >>>> union __riscv_mc_fp_state __fpregs; >>>> + /* 5K + 256 reserved for vector state and future expansion. */ >>>> + unsigned char __reserved[5376] __attribute__ ((__aligned__ (16)))= ; >>>> } mcontext_t; >>>=20 > Hi Florian and Rich, > Sorry for the late reply and thank you for reminding me the > modification will cause ABI break. >=20 >>> This changes the size of struct ucontext_t, which is an ABI break >>> (getcontext callers are supposed to provide their own object). >>>=20 >=20 > The riscv vector registers are all caller-saved registers except for > VCSR. Therefore, the struct mcontext_t needs to reserve a space for > it. In addition, RISCV ISA is growing, so I also hope the struct > mcontext_t has a space for future expansion. Based on the above ideas, > I reserved a 5K space here. >=20 >>> This shouldn't be necessary if the additional vector registers are >>> caller-saved. >=20 > Here I am a little confused about the usage of struct mcontext_t. As > far as I know, the struct mcontext_t is used to save the > machine-specific information in user context operation. Therefore, in > this case, the struct mcontext_t is allowed to reserve the space only > for saving caller-saved registers. However, in the signal handler, the > user seems to be allowed to use uc_mcontext whose data type is struct > mcontext_t to access the content of the signal context. In this case, > the struct mcontext_t may need to be the same as the struct sigcontext > defined at kernel. However, it will have a conflict with your > suggestion because the struct sigcontext cannot just reserve a space > for saving caller-saved registers. Could you help me point out my > misunderstanding? Thank you. >=20 >> Indeed, that was my first thought when I saw this too. Any late >> additions to the register file must be call-clobbered or else they are >> a new ABI. And mcontext_t does not need to represent any >> call-clobbered state. >>=20 >> Rich >=20