From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id 1480F385703F for ; Thu, 22 Dec 2022 20:30:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1480F385703F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pj1-x1033.google.com with SMTP id o8-20020a17090a9f8800b00223de0364beso6852801pjp.4 for ; Thu, 22 Dec 2022 12:30:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=+QPNI8KTzJ0FXuAGtauWbwwpxzA1aX3xt2Azn1cq0is=; b=gqzuoDbKXPnYcA02Jiwf/W5HbCF7AcAidyUyuR1l0c6NUK7B2xbZJ9tSuIkhxd/PcC dw6cSCp6TVqgRVdyr/Qv+CfzoYkjurtc0mlPrdwJNXlPFKS4dkYXMxAJNLLFi/zgxmdU 7y93BTxfCAUtQKxeS1+ldkP5l06enEVMxEjUIamsR5fCRzKxYMp1Fc5wpo63xsTr19Y0 F64lKLd9ygI/GeQRNVqmAPjPZK81oAX0hQDeWvgaTZ0We62gxnzQZnShv95BoaFEIz5t LPa0m1WZNfkR41kqTyrVJbg7pObsRzKuCz/wINmFpKGHmx2nXuUA87WUieBACSdMLufO 4cyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+QPNI8KTzJ0FXuAGtauWbwwpxzA1aX3xt2Azn1cq0is=; b=CtGFyv/+U4Lw5x2ypufipm9Pa4VPlQi5l9CgO905vI69hjsqTHULjzzOregvdEY9PS zEiAEHW+ivce4EISdYFqAwn+J79y8Ik4+raM6CPM1dx7QMS6J4+lU/+8NO+9IwA7hJMl RHNK9ByaHiq0fGCz/DQKkPWbjLvBUBQVZN+aEsGH2TL/lUuXQsMdGY/nhvbeq2R8dgVs eSVHuct4eo03uBATxBSb6fOQ9n0BD7GRXszEXnmEIvJVPvLN9uSe1ftKZ49eUkVEuysV CkgznxqpixxYNvzzwZpfA2kdywldZdL8TKl6DIwmQCtCUGk9Q+hUjU7ZWi0TmQRgm/XU 5BAw== X-Gm-Message-State: AFqh2kpiFQgJ0bcbqXXsO4+2aKTu9SDSYFo2PZqPDprQPtr9oKaPgkPa DJctskUqfTYf+/gj2BYXpKbp6g== X-Google-Smtp-Source: AMrXdXu8PGdlTDxyMeEuyaIJcTQe40vQG/Nio7FueDP1bv+yJX1HxM7pKYh6OU8r4iNOk7WHK4BGIQ== X-Received: by 2002:a17:902:c9cc:b0:188:5b7d:738a with SMTP id q12-20020a170902c9cc00b001885b7d738amr6714490pld.29.1671741053144; Thu, 22 Dec 2022 12:30:53 -0800 (PST) Received: from [192.168.50.116] (c-24-4-73-83.hsd1.ca.comcast.net. [24.4.73.83]) by smtp.gmail.com with ESMTPSA id l2-20020a170903244200b001888cadf8f6sm964241pls.49.2022.12.22.12.30.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Dec 2022 12:30:52 -0800 (PST) Message-ID: <6b79d32c-2e59-09b6-2132-4b99e2a8923e@rivosinc.com> Date: Thu, 22 Dec 2022 12:30:51 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Adding V-ext regs to signal context w/o expanding kernel struct sigcontext to avoid glibc ABI break Content-Language: en-US To: Richard Henderson , Vincent Chen Cc: Florian Weimer , Rich Felker , Andrew Waterman , Palmer Dabbelt , Kito Cheng , =?UTF-8?Q?Christoph_M=c3=bcllner?= , davidlt@rivosinc.com, Arnd Bergmann , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Philipp Tomsich , Szabolcs Nagy , Andy Chiu , Greentime Hu , Aaron Durbin , Andrew de los Reyes , linux-riscv , GNU C Library 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> <87sfy5ndid.fsf@oldenburg.str.redhat.com> <73c0124c-4794-6e40-460c-b26df407f322@rivosinc.com> <50c598a6-e3b3-3062-abe7-23a406067533@rivosinc.com> <7430f494-9b43-5e03-c1e9-6b83e2611a11@rivosinc.com> From: Vineet Gupta In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/21/22 21:32, Richard Henderson wrote: > On 12/21/22 11:52, Vineet Gupta wrote: >> This is not an issue, if we don't change sigcontext (in kernel and >> glibc) - it is essentially the case of existing binaries. kernel >> still saves regs on user stack, in >> rt_sigframe, its just that userspace is not able to access them in >> SA_SIGINFO signal >> handers. aarch64 have this implemented this approach and it is likely >> they can't do >> that either for SVE regs. > > aarch64 can certainly access the SVE regs on the signal stack.  It > simply requires that you parse the chain of extensions within > __reserved to find it. > It's quite well designed, really. Yep I've been staring at it this week and really appreciate the extensible design. Indeed one can do thru the existing __reserved in sigcontext to access that from userspace. > > What you can't do is "only" declare a sigcontext_t and be able to > construct a new context, nor copy the entire context via structure > assignment. > > There is room within the risc-v context for a similar scheme, via > >     sigcontext.sc_fpregs.q.reserved[3] > > E.g. > >     reserved[0] -> magic >     reserved[1] -> displacement to "extension area" >     reserved[2] -> size of "extension area" > > Thus the area can be located anywhere within 4GB and expand to 4GB. > Not that I'd hope any signal frame would require 4GB.  :-) Looks like we almost missed this. Thx for the pointer Richard. -Vineet