From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by sourceware.org (Postfix) with ESMTPS id A7A683835808 for ; Mon, 17 May 2021 10:18:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A7A683835808 From: Thomas Gleixner To: Florian Weimer Cc: Len Brown , Borislav Petkov , Willy Tarreau , Andy Lutomirski , "Bae\, Chang Seok" , Dave Hansen , X86 ML , LKML , linux-api@vger.kernel.org, "libc-alpha\@sourceware.org" , Rich Felker , Kyle Huey , Keno Fischer , Arjan van de Ven Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features In-Reply-To: <87pmxpk7jo.fsf@oldenburg.str.redhat.com> References: <20210415044258.GA6318@zn.tnic> <20210415052938.GA2325@1wt.eu> <20210415054713.GB6318@zn.tnic> <20210419141454.GE9093@zn.tnic> <20210419191539.GH9093@zn.tnic> <20210419215809.GJ9093@zn.tnic> <874kf11yoz.ffs@nanos.tec.linutronix.de> <87pmxpk7jo.fsf@oldenburg.str.redhat.com> Date: Mon, 17 May 2021 12:18:10 +0200 Message-ID: <87y2cdzmsd.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: Mon, 17 May 2021 10:18:13 -0000 On Mon, May 17 2021 at 11:56, Florian Weimer wrote: > * Thomas Gleixner: > >> Having a proper interface (syscall, prctl) which user space can use to >> ask for permission and allocation of the necessary buffer(s) is clearly >> avoiding the downsides and provides the necessary mechanisms for proper >> control and failure handling. >> >> It's not the end of the world if something which wants to utilize this >> has do issue a syscall during detection. It does not matter whether >> that's a library or just the application code itself. >> >> That's a one off operation and every involved entity can cache the >> result in TLS. > > I'm not sure if it's a good idea to have each AMX consumer to set up its > own TLS cache. How expensive is checking XCR0 via XGETBV instead on the > AMX path? Then AMX can be enabled on the thread via a system call. Right, did not think about that. > It also allows disabling of AMX. That needs reference counting, but yes it's possible. > It would also need an AT_HWCAP2 feature flag telling user space that AMX > support is available after that system call (switching on AMX to check > whether AMX paths should enabled later seems potentially wasteful if the > AMX paths are never taken after all). Either that or just have: prctl(PR_QUERY_XSTATE_FEATURES,.... prctl(PR_ENABLE_XSTATE_FEATURES,.... prctl(PR_DISABLE_XSTATE_FEATURES,.... Thanks, tglx