From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 6FD31385802A for ; Tue, 30 Mar 2021 20:20:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6FD31385802A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=amacapital.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=luto@amacapital.net Received: by mail-pg1-x536.google.com with SMTP id v10so12504823pgs.12 for ; Tue, 30 Mar 2021 13:20:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=+fvRCak5nT+7vsNsQ37FYFv5hB/hQM4I7Onizfja+Yk=; b=dyo9hBcc2uhiFNIDb0P+xc3bKZmmyInA4bas7pmqj5KCVLdG2TYPs1dPhOUYmJjRm2 L8OX3M1ux4vxu3HbgUbSgVEokkRlNJ+9i8fvotEGIs8JZInGNe+3WEjmExm7boqErQvm Dlj8mdvz3MpgGdFlVD7dpz/uwGarh6a43aGmosqomfy87p0D2V4h3r/g0fA8Tj1sYqbw LIsj0coVi3FX4C/H6UFMTPZtzJLsWO72OBZUCV8Hsl8RSip1p6gyK5V8XhdQPTu6Xwt6 6/k1qgIQiij81yo7yqzX3mvU1HFiHBRAfDy0ydobg9JP+aW/S1KP2cmzGH0EJKcxWuNo Zvew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=+fvRCak5nT+7vsNsQ37FYFv5hB/hQM4I7Onizfja+Yk=; b=gL+fyIexoVt95OmYHXdQ1O9eAj0d5FKP4rx4il/7pm4HPcgXcKGrQN0U5V9T+9qNd1 BqwqYf4aa7nHvUfPs4cf48au16UM2BEbR2r1yT92Wr7O+8FumqBx0LioI8aNGmgROu/1 3JrqkZro/ynPKCg/1/Wzo6f8B8p9e63HzIDplqLqgQU1npC1W5uKnjSsE1lgBngIfDUL x/oALXjs7afv14p9lTTsbP4+vekfWd+jVFYBNUGL7KZc7MhSbIOuL5OwJK0D/gFUbwZd etl7jSclQ34KEoaVnO1PqLlcuKTD2khJnXEMtnAa2fJD0syOQcJaGmO8lxc8DS4e+u8O sSZA== X-Gm-Message-State: AOAM530twR6YiSZ4f6wxWYMJdwdxUWUX4X8xyFydNa/Q+iL/S5i2P3JJ IwFgbU+xKf7UzRvuxi18HcIvrw== X-Google-Smtp-Source: ABdhPJwhMEkJzZ2fRP0OkCkDNZAazep5N/gSflrritdECzKkpf7jn2nsGX7tEg0YrqAN2rK4PvL83w== X-Received: by 2002:a63:545e:: with SMTP id e30mr30841258pgm.13.1617135629521; Tue, 30 Mar 2021 13:20:29 -0700 (PDT) Received: from ?IPv6:2601:646:c200:1ef2:30aa:f41a:f3f5:d36b? ([2601:646:c200:1ef2:30aa:f41a:f3f5:d36b]) by smtp.gmail.com with ESMTPSA id v25sm21757167pfn.51.2021.03.30.13.20.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Mar 2021 13:20:28 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Andy Lutomirski Mime-Version: 1.0 (1.0) Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features Date: Tue, 30 Mar 2021 13:20:27 -0700 Message-Id: References: Cc: Len Brown , Andy Lutomirski , Greg KH , "Bae, Chang Seok" , X86 ML , LKML , libc-alpha , Florian Weimer , Rich Felker , Kyle Huey , Keno Fischer , Linux API In-Reply-To: To: Dave Hansen X-Mailer: iPhone Mail (18D70) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Tue, 30 Mar 2021 20:20:32 -0000 > On Mar 30, 2021, at 12:12 PM, Dave Hansen wrote: >=20 > =EF=BB=BFOn 3/30/21 10:56 AM, Len Brown wrote: >> On Tue, Mar 30, 2021 at 1:06 PM Andy Lutomirski wro= te: >>>> On Mar 30, 2021, at 10:01 AM, Len Brown wrote: >>>> Is it required (by the "ABI") that a user program has everything >>>> on the stack for user-space XSAVE/XRESTOR to get back >>>> to the state of the program just before receiving the signal? >>> The current Linux signal frame format has XSTATE in uncompacted format, >>> so everything has to be there. >>> Maybe we could have an opt in new signal frame format, but the details w= ould need to be worked out. >>>=20 >>> It is certainly the case that a signal should be able to be delivered, r= un =E2=80=9Casync-signal-safe=E2=80=9D code, >>> and return, without corrupting register contents. >> And so an an acknowledgement: >>=20 >> We can't change the legacy signal stack format without breaking >> existing programs. The legacy is uncompressed XSTATE. It is a >> complete set of architectural state -- everything necessary to >> XRESTOR. Further, the sigreturn flow allows the signal handler to >> *change* any of that state, so that it becomes active upon return from >> signal. >=20 > One nit with this: XRSTOR itself can work with the compacted format or > uncompacted format. Unlike the XSAVE/XSAVEC side where compaction is > explicit from the instruction itself, XRSTOR changes its behavior by > reading XCOMP_BV. There's no XRSTORC. >=20 > The issue with using the compacted format is when legacy software in the > signal handler needs to go access the state. *That* is what can't > handle a change in the XSAVE buffer format (either optimized/XSAVEOPT, > or compacted/XSAVEC). The compacted format isn=E2=80=99t compact enough anyway. If we want to keep= AMX and AVX512 enabled in XCR0 then we need to further muck with the format= to omit the not-in-use features. I *think* we can pull this off in a way th= at still does the right thing wrt XRSTOR. If we go this route, I think we want a way for sigreturn to understand a poi= nter to the state instead of inline state to allow programs to change the st= ate. Or maybe just to have a way to ask sigreturn to skip the restore entir= ely.=