Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1402110pxj; Fri, 21 May 2021 13:22:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8iNdtG76DRls/Uhhc/3xVUCD1MEZWHXv7xiJB/8ujLpu5BrFSfx/IVm+9jj2yU4MTM00q X-Received: by 2002:a17:906:1699:: with SMTP id s25mr11752061ejd.238.1621628552142; Fri, 21 May 2021 13:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621628552; cv=none; d=google.com; s=arc-20160816; b=dqvnY8ik3w0WMAP8SdyKs4l8xY7JT1L3E2+zXwtf4+IU5jrhSZgZMknFIqD9e1nRCR YFKHLjq+SoOaaWFYx23giin38i3cP3foGS6Xx6hGWmyQcSQX0tvnr0atGKXBupH4uR1S EZ3rHjm+IZ6dkMgq1x2MU26Hb74bwJ+fRvggbHMqtvk5s8bP+PiAF4VbgkHJYB7Iw1O7 7kkE8HPZKArQ9JOlpG38+bgciAfmywB1/ChzF4rvk+ihTUf55nomWYOSzEshGVBqFmu4 yu2WTIrc1Pk8b3xqWFDkuoTfDqXz4WpuKtqo2DqWLNgo118e5xBLRrrvIlQR/BkhAHPi 2u9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :dkim-signature; bh=MJ0IsQ9+VCFGVeTRAQhGRMaymznLsYZkaVzFkSJD5gU=; b=tw4jA+Xdl6OLFucle7DpAHQoBlb77RLkBlTqCJGeUHq1XPQbT3ckmafSevrLnDAV0J GjWkpnVtqz7C3zXrhKwL49K/UjR1fjA71bo/++Z99Du8VyufNW06lOk6wHDvsQTyJb1p i1pSqJgXm9znMlXEtVztiVVLLF5vG68dxPPQPvjvtmhClacL+7DrD+zdk9alsECQdsgd KBkVPLOsG84YsvnGpcw0hZgGBzuCjsBE2JxFAF8a0lwNf3WXdjJUPay+frDuMbE2rRpL sRgC2jZKBrVl31Ey2Xb6e2k+WiwL4GfLPEaK3KHNRP37BWnlamuUHis2B1mpjM34cRkt yXrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jzlbG+n+; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ne35si5908836ejc.666.2021.05.21.13.22.08; Fri, 21 May 2021 13:22:32 -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=@kernel.org header.s=k20201202 header.b=jzlbG+n+; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234350AbhEUQdP (ORCPT + 99 others); Fri, 21 May 2021 12:33:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:37038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbhEUQdO (ORCPT ); Fri, 21 May 2021 12:33:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C343613AD; Fri, 21 May 2021 16:31:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621614711; bh=oxjGhdUOBodTprFXEf43FPxyTig36c7rbVQyBkMzWLg=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=jzlbG+n+3RHUHPR9mV9Jc108G578I6y623BdePDmtYmpwSHVZGbcGoiY+QtvobDlu W0CGj2p1PYCX29TKhS3xIIwXVtkO6kqgazbIfoHzUDKLnJ6v9cIMTlLJDNl7OL29XH d9ZKECx3M6AsYMc4g5/yViCPxLHKK3OOcwWDjLFqDFDRBC5ijwWy/Cdz1Ll/ZuM1lB b/YkisaLXur2Po7/imHwgzyQeV7j0noQioozwVWexlPwJsix838QROriKeLBsj/rvs 6zSPQK6Afqa+qqybmJSghHKct9CH1zvAQ5maz4vdAzcVldR34b3wzwkW3HWIbSDN+X 2PLIGLiGJD+JQ== Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailauth.nyi.internal (Postfix) with ESMTP id 417E527C0054; Fri, 21 May 2021 12:31:49 -0400 (EDT) Received: from imap21 ([10.202.2.71]) by compute2.internal (MEProxy); Fri, 21 May 2021 12:31:49 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdejfedguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepfdet nhguhicunfhuthhomhhirhhskhhifdcuoehluhhtoheskhgvrhhnvghlrdhorhhgqeenuc ggtffrrghtthgvrhhnpedvleehjeejvefhuddtgeegffdtjedtffegveethedvgfejieev ieeufeevuedvteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpegrnhguhidomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqudduiedu keehieefvddqvdeifeduieeitdekqdhluhhtoheppehkvghrnhgvlhdrohhrgheslhhinh hugidrlhhuthhordhush X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E34EF51C0060; Fri, 21 May 2021 12:31:46 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-448-gae190416c7-fm-20210505.004-gae190416 Mime-Version: 1.0 Message-Id: <263a58a9-26d5-4e55-b3e1-3718baf1b81d@www.fastmail.com> In-Reply-To: <87r1i06ow2.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> <87k0ntazyn.ffs@nanos.tec.linutronix.de> <37833625-3e6b-5d93-cc4d-26164d06a0c6@intel.com> <9c8138eb-3956-e897-ed4e-426bf6663c11@intel.com> <87pmxk87th.fsf@oldenburg.str.redhat.com> <939ec057-3851-d8fb-7b45-993fa07c4cb5@intel.com> <87r1i06ow2.fsf@oldenburg.str.redhat.com> Date: Fri, 21 May 2021 09:31:26 -0700 From: "Andy Lutomirski" To: "Florian Weimer" , "Dave Hansen" Cc: "Dave Hansen via Libc-alpha" , "Len Brown" , "Rich Felker" , "Linux API" , "Bae, Chang Seok" , "the arch/x86 maintainers" , "Linux Kernel Mailing List" , "Kyle Huey" , "Borislav Petkov" , "Thomas Gleixner" , "Keno Fischer" , "Arjan van de Ven" , "Willy Tarreau" Subject: =?UTF-8?Q?Re:_Candidate_Linux_ABI_for_Intel_AMX_and_hypothetical_new_rel?= =?UTF-8?Q?ated_features?= Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021, at 9:19 AM, Florian Weimer wrote: > * Dave Hansen: >=20 > > On 5/21/21 7:44 AM, Florian Weimer wrote: > >> * Dave Hansen via Libc-alpha: > >>> Our system calls are *REALLY* fast. We can even do a vsyscall for= this > >>> if we want to get the overhead down near zero. Userspace can also= cache > >>> the "I did the prctl()" state in thread-local storage if it wants = to > >>> avoid the syscall. > >> Why can't userspace look at XCR0 to make the decision? > > > > The thing we're trying to avoid is a #NM exception from XFD (the new= > > first-use detection feature) that occurs on the first use of AMX. > > XCR0 will have XCR0[AMX]=3D1, even if XFD is "armed" and ready to > > generate the #NM. >=20 > I see. So essentially the hardware wants to offer transparent > initialize-on-use, but Linux does not seem to want to implement it thi= s > way. >=20 > Is there still a chance to bring the hardware and Linux into alignment= ? arch_prctl(SET_XSTATE_INIT_ON_FIRST_USE, TILE_STUFF);? As long as this is allowed to fail, I don=E2=80=99t have a huge problem = with it. I think several things here are regrettable: 1. Legacy XSTATE code might assume that XCR0 is a constant. 2. Intel virt really doesn=E2=80=99t like us context switching XCR0, alt= hough we might say that this is Intel=E2=80=99s fault and therefore Inte= l=E2=80=99s problem. AMD hardware doesn=E2=80=99t appear to have this is= sue. 3. AMX bring tangled up in XSTATE is unfortunate. The whole XSTATE mech= anism is less than amazing. IMO the best we can make of this whole situation is to make XCR0 dynamic= , but the legacy compatibility issues are potentially problematic. >=20 > Thanks, > Florian >=20 >=20