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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 1675F1F8C8 for ; Sat, 18 Sep 2021 03:20:10 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5B539385AC2E for ; Sat, 18 Sep 2021 03:20:09 +0000 (GMT) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 73FE33858428 for ; Sat, 18 Sep 2021 03:19:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 73FE33858428 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pl1-x635.google.com with SMTP id j14so288672plx.4 for ; Fri, 17 Sep 2021 20:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zYR58gWHTa5Fe5QVbaG0UllUH/dH5DsN7y64UTnQ9Lo=; b=E7hKKriYatP+QWlaun3RPQae/IQ9EGbBNG6pqE8NkNlJW+PDTtx7Wia+qTYx8X//W+ Jx7bjRBwsBdNb+9nK8W5Qih2phE4hUG+xv/FKP25vJBbB86uDuOgW+azu1ktDCFixXUq xMzg1StCHuHE0/ORV0CDwOOrpHg+GG70V6myluiCko4B3SAbNqS8DtWMY2ITwyF/fvGE ZuL1Jo32pXXucJxyQWfaaqYzcNogfMVT1bc07TzXc27flu9+gOdbdCqAEOp7H4lCg6r8 wiO4YVkYolnSskaBAKORg3lnquGov58UC2XBYoGlyElv0sZDwHDQqyRSI8jm8f+yPcS4 a6PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zYR58gWHTa5Fe5QVbaG0UllUH/dH5DsN7y64UTnQ9Lo=; b=ntewOExPJe4sNkp0BOeN6uRdbjnfi6G/EQYw7esw2XKMitiT+gzXT4Q5G5Yl0MGJC3 A2c+aOSQJ1mn67/GYoKSdy5oiWAFNC+5R3I698H/cye1k1MXKy1VqGiwCiqNI/cg8Ixm A8TmyZ2TkpLxK7J1Qlng5Ici85UIeVlhkoMNLmjpWJAXdkohQMPOtvRbWQOO8SAcySl2 p+cvZrL67ISQiAkeukSv+snRrXdZhGBRPYPNg4NFwgMWqvgsfBen5jVmTl+7i+a5VQ5B iyWWtUqlYXptal1Jb/dVFiRYiK4RpFNEhMjRed7UQOYbx8TwkSvvoXV1jsfMMp2B8tx0 RvLg== X-Gm-Message-State: AOAM532ghRFkC3JOrZ+oxuMQPfKjSZrV6dkUBPrTp9saq9sNR2LudXAb x1iawrfZMjdr7X0qp/2vEzGlzRueYPn5gw3CbrN7sw== X-Google-Smtp-Source: ABdhPJzpRXYCegVWIFppsZz2sjq/pQy+Dh1vLTY8a3O+0sTbDUtuJgg1KpKPEL2m97FpaYi58Cvvh3PnXa5JJ9pTG+k= X-Received: by 2002:a17:902:e2d4:b0:13b:9402:fefc with SMTP id l20-20020a170902e2d400b0013b9402fefcmr12625875plc.40.1631935196373; Fri, 17 Sep 2021 20:19:56 -0700 (PDT) MIME-Version: 1.0 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> <20210917170314.GR13220@brightrain.aerifal.cx> In-Reply-To: <20210917170314.GR13220@brightrain.aerifal.cx> From: Vincent Chen Date: Sat, 18 Sep 2021 11:19:45 +0800 Message-ID: Subject: Re: [RFC patch 2/5] RISC-V: Reserve about 5K space in mcontext_t to support future ISA expansion. To: Rich Felker Content-Type: text/plain; charset="UTF-8" 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: , Cc: Florian Weimer , GNU C Library , Andrew Waterman Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On Sat, Sep 18, 2021 at 1:03 AM Rich Felker wrote: > > On Thu, Sep 16, 2021 at 04:02:50PM +0800, Vincent Chen wrote: > > On Mon, Sep 13, 2021 at 9:52 PM Rich Felker wrote: > > > > > > On Mon, Sep 13, 2021 at 03:44:09PM +0200, Florian Weimer via Libc-alpha wrote: > > > > * Vincent Chen: > > > > > > > > > Following the changes of struct sigcontext in Linux to reserve about 5K space > > > > > to support future ISA expansion. > > > > > --- > > > > > sysdeps/unix/sysv/linux/riscv/sys/ucontext.h | 2 ++ > > > > > 1 file changed, 2 insertions(+) > > > > > > > > > > diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/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; > > > > > > Hi Florian and Rich, > > Sorry for the late reply and thank you for reminding me the > > modification will cause ABI break. > > > > > > 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. > > VCSR is not call-saved (aka 'callee-saved' in alternate notation) > either. It's thread-local state that may be changed or left alone by > calls, and that sj/lj/ucontext functions can't touch, just like fenv. > Saving and restoring it here would be wrong. > You are right. Joseph pointed it out in my 3rd patch. I will remove it from my next version patch. Thank you.