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 95F7A3858D3C for ; Thu, 16 Sep 2021 08:14:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 95F7A3858D3C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-574-myzWBV6ROBOPFOh2bATJ5w-1; Thu, 16 Sep 2021 04:14:23 -0400 X-MC-Unique: myzWBV6ROBOPFOh2bATJ5w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB38D8145E6; Thu, 16 Sep 2021 08:14:21 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.194]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5EAE31001281; Thu, 16 Sep 2021 08:14:20 +0000 (UTC) From: Florian Weimer To: Vincent Chen Cc: Rich Felker , GNU C Library , Andrew Waterman Subject: Re: [RFC patch 2/5] RISC-V: Reserve about 5K space in mcontext_t to support future ISA expansion. References: <1631497278-29829-1-git-send-email-vincent.chen@sifive.com> <1631497278-29829-3-git-send-email-vincent.chen@sifive.com> <871r5sd1zq.fsf@oldenburg.str.redhat.com> <20210913135247.GL13220@brightrain.aerifal.cx> Date: Thu, 16 Sep 2021 10:14:18 +0200 In-Reply-To: (Vincent Chen's message of "Thu, 16 Sep 2021 16:02:50 +0800") Message-ID: <87sfy5ndid.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 08:14:25 -0000 * Vincent Chen: >> > This changes the size of struct ucontext_t, which is an ABI break >> > (getcontext callers are supposed to provide their own object). >> > > > 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. You have reserved space in ucontext_t that you could use for this. >> > This shouldn't be necessary if the additional vector registers are >> > caller-saved. > > 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. struct sigcontext is allocated by the kernel, so you can have pointers in reserved fields to out-of-line start, or after struct sigcontext. I don't know how the kernel implements this, but there is considerable flexibility and extensibility. The main issues comes from small stacks which are incompatible with large register files. Thanks, Florian