From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RDNS_DYNAMIC,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 48A561F8C8 for ; Thu, 16 Sep 2021 08:14:45 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2032E3858D3C for ; Thu, 16 Sep 2021 08:14:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2032E3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631780084; bh=azlHFytPEuaUXlU+v8KagSkfT2JkrdLeW/MQ7JjMPx4=; h=To:Subject:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=MRFpn8j3iy26lR7p/eOaXKTSShsD44Ld4uJovuWdRP/NhPHHSr6D4DgzfDnycP5Dm fsySMbK5Kqu7cEcAvi4sGgcNs0i+Wi6ReSBb5SDDXrFnMtVMLQN7kBCvxtsn1n+4I0 sImn2EBf3GqyI6zS+DYCPWW0sbnzWZ5S700cbJ8A= 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) To: Vincent Chen 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-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: , From: Florian Weimer via Libc-alpha Reply-To: Florian Weimer Cc: Rich Felker , GNU C Library , Andrew Waterman Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" * 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