Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2508104pxj; Mon, 17 May 2021 03:19:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNDdGUcSC+AMx5ehkG/Yx0LP1MyPES5aHRyP1CubuhSif/wADIoAqRhYKQV0kg6Q9IgxpE X-Received: by 2002:a17:906:fa90:: with SMTP id lt16mr17831562ejb.411.1621246777447; Mon, 17 May 2021 03:19:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621246777; cv=none; d=google.com; s=arc-20160816; b=o9puEK3fL8bQgvMS9knI8gfCxYDdI+qgDqGkhPQsI2Kug1k4MlpEsbtDo1n0xw2trn dFPwNsLSKijYh/feG0l8ZT1rgShxPnJdzO1juzY8mlFpvkMZOdVU+BKdHxOb2mTdb/Pk zyfyRZt/wcDWiskp5ZNA0jO75Q/skd2guY0RFqlW9rtgSzNXiiU02WX1XTVL3iIZkABf fLzlxMntkhT0qqp/ut3+RlYxDu90gDcJ2L3DVMCiBuNG7osh9HuOYzu8rOPhmBlc7hRc arVnGmBl7DTYvslJDXdaXCm4QwrhfB4bnm0NyzKGL3YHMNJzTP/NCC0hkR4wVVkA3/g9 REkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=+zz3NPs+wt6StysgikNkYNgGUFeAfLSA7zXm/ZKg27k=; b=LWOn1vhUaG0xONLbmVPSHXlKTSOzEEK+CcAYmTNC1gln/L5dkdYZRSvf5slkHApvYJ GGTdhSidZ5dBLpiFQZZpboSi1JcAC5ijbKrAO9Dqt8T35HYCgNT2mZGExz4moMx9aDid zXUNVZM7AS72OSXsV8Gt8Z16UgtEImAFvttSiOMYONnxCAyJ7rYQR28GvbHAqcrN3kTh RBtHFJSVbiAsbuq87inj/FHG1T4QLF14knchg58eibwspguuqWRa15LSAXQRf+fpFfuo 12R0vw0znMC3D9VHqqa9I9f+H9+Gj6wBDeyygBv+zy/+JviL9SKDMlXZL54dboU1HIDj v+hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DXHJbrfh; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si13605945ejf.699.2021.05.17.03.19.14; Mon, 17 May 2021 03:19:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=DXHJbrfh; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236369AbhEQKTb (ORCPT + 99 others); Mon, 17 May 2021 06:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230248AbhEQKT3 (ORCPT ); Mon, 17 May 2021 06:19:29 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAF60C061573; Mon, 17 May 2021 03:18:11 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621246690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+zz3NPs+wt6StysgikNkYNgGUFeAfLSA7zXm/ZKg27k=; b=DXHJbrfh4uoRQpWx9h9zfiHD+Q5JOAd143oFu1shjaH85Ky7o+V2cari7L/ZvBUb1hLYO8 5wSieOg2XbhI/alz4CI6023AiDJs6hVTk1cukX8VuDXNExOc9KX2CtkJcAwqec9W8j+sJs DnQXwtEdD3dunRZ38Pl4rmKiCWoZdwWFWSEExbHKxmGjM3ZISfWS0J+dsO0pD8FvXg1a2T kUFf8RqIrMEeXqPl+CR2LS6XhbT6WaYoQfT5EOn0mwS+3PapV0t/kEQmEDHDpKablHwjYy dz7DPdTEbKJ3GzwmGMr4PU/N6/jixx70Okrj+Ju7DOT82ZmNCrOUCEnsPnYfNA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621246690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+zz3NPs+wt6StysgikNkYNgGUFeAfLSA7zXm/ZKg27k=; b=mghAS2q0UHTE2Lmbb//Xqw/ACQntH5qxeu2VotZwfZuEumALz9iuphq2aT5JdwvI9gFMi6 04sD7+l4zKemAkBA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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