Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp454271pxj; Fri, 7 May 2021 12:23:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5t0VnBH0mmIkHF5XSYBKG/SE2NlFHmm+tyi4QsslbT9jYvgjFPp1lWg77kdU8sXfK7Dlj X-Received: by 2002:a65:640c:: with SMTP id a12mr11314535pgv.229.1620415400020; Fri, 07 May 2021 12:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620415400; cv=none; d=google.com; s=arc-20160816; b=DWrZSMp2hPmUKULX9dGf6NFiLBrpGXBGcksBOKMwyk0clCPcSotrJKo0LbeHKR+Cqr EFIKpMlum5CkVjKVo6JrW9pUI8X/x0Ox05KqhrH6uCsx+1CufDmXuWh7w7l/DzgCBw4k 7O1H8BIbOW4UuP146D6VNdnuMkksBE6W4Tpj/vLApQAr43al6/dUQs6IM7J9dXjGbycZ r8LrT37kOtI/QpPjCBv6Fjxjg5DdoSMlfZGeMFvdXUVhOrqqWl4qcs1yE6nXJ11HLub3 4UDRMbf2Hjxh31chLLstYmUmEMh5uVBntKD1kBlifTvFw2VZnQpfTaVGhn7G74BcS1o/ 1sbA== 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=ORUuoUk8DJpvMhKQmGSDce5dSlAguNz2DeA4Kqt7HbQ=; b=wI6By6eo7v5LIdNzXcjhsc3pEnVDJ+rJP2h1Dk0Dt2VdqpG+4vdwm+W30PnpKnXtXF B3sHwMxGv7I/wM79P+srCl8CF3W7tUHrcql2oe532AbivQMEStfTkgXBeoZ32heEu+ZT UBbeN18YdxhfyGYIy/dr/7Ot3S9qjSp/LXNrHuo5fp1YxhoxNn3e+oCeK6+X2kRaQ0lS 3CvYHkrQIeR8Km15WaKWs11svU0j/S02NeCDgdz/WbHjrf5J431MEV+LSfDYYH1HuNub CnBfKc1oUIL+obWGbt7g7eCHVieSEqP/6qf3pEFIK02j+rCx+SnC/VyXG64k9HriDq8T Y1Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bjhQDjeB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="tclfaHK/"; 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 ay12si8035557plb.357.2021.05.07.12.23.07; Fri, 07 May 2021 12:23:20 -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=bjhQDjeB; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="tclfaHK/"; 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 S229821AbhEGTXV (ORCPT + 99 others); Fri, 7 May 2021 15:23:21 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:51386 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbhEGTXU (ORCPT ); Fri, 7 May 2021 15:23:20 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1620415339; 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=ORUuoUk8DJpvMhKQmGSDce5dSlAguNz2DeA4Kqt7HbQ=; b=bjhQDjeBlOjjsz24EuAiTVQam0CwX43eBcx/62NQHMC/Gb5w0WUzKL9Udvo20IvjRLQeoV GeumJrz+67KiP6l60XJiDJq0BFWsn8qS0rFknBhS6SbOHYk6qX1tj3X6gc8kvSEbrdx5p0 7OZpcEiZhtsn5KA9Y0zOAN9dWrnIGvTA/voSCJdcXK5RgMhWCdZf5oe1322Oe8ULw+RF1V /RQss4faY0+057dfPvfMP8uXrMb9hSC8igfriVyw27yKci7iXHk7ZdRIKWcclpOA5faVWE 208MneA3Q5/7KgtJiLzOAz+e5GWyoM0tiFVJ/k18y4guswq9zgGnqStvTUNuEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1620415339; 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=ORUuoUk8DJpvMhKQmGSDce5dSlAguNz2DeA4Kqt7HbQ=; b=tclfaHK/1ZJRJghVXP1ksCNWC85cpf/DqYc+NVH3+t2rPEjNLEtjYGBffvj0+MxFoT6CLy H/sAnp8YPNvZiRDA== To: Andy Lutomirski Cc: Dave Hansen , Florian Weimer , Len Brown , Borislav Petkov , Willy Tarreau , Andy Lutomirski , "Bae\, Chang Seok" , X86 ML , LKML , linux-abi@vger.kernel.org, "libc-alpha\@sourceware.org" , Rich Felker , Kyle Huey , Keno Fischer Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features In-Reply-To: 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> <87bl9s8kfb.fsf@oldenburg.str.redhat.com> <5d3d513b-77d6-e2e2-779e-ff3ea33deba3@intel.com> <87o8dmmljh.ffs@nanos.tec.linutronix.de> Date: Fri, 07 May 2021 21:22:18 +0200 Message-ID: <87lf8qmjrp.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 Fri, May 07 2021 at 11:50, Andy Lutomirski wrote: > On Fri, May 7, 2021 at 11:44 AM Thomas Gleixner wrote: >> >> On Mon, May 03 2021 at 06:43, Dave Hansen wrote: >> > On 5/2/21 10:18 PM, Florian Weimer wrote: >> >>> 5. If the feature is enabled in XCR0, the user happily uses it. >> >>> >> >>> For AMX, Linux implements "transparent first use" >> >>> so that it doesn't have to allocate 8KB context switch >> >>> buffers for tasks that don't actually use AMX. >> >>> It does this by arming XFD for all tasks, and taking a #NM >> >>> to allocate a context switch buffer only for those tasks >> >>> that actually execute AMX instructions. >> >> What happens if the kernel cannot allocate that additional context >> >> switch buffer? >> > >> > Well, it's vmalloc()'d and currently smaller that the kernel stack, >> > which is also vmalloc()'d. While it can theoretically fail, if it >> > happens you have bigger problems on your hands. >> >> Such a buffer allocation might also exceed a per process/cgroup >> limitation. Anything else which is accounted happens in syscall context >> which then returns an error on which the application can react. >> >> So what's the consequence when the allocation fails? Kill it right away >> from #NM? Kill it on the first signal? Do nothing and see what happens? >> > It has to be an immediate signal or kill. Killing it right there is the only sensible thing to do. > A failure to load FPU state is somewhat tolerable (and has to be for > CET), but a failure to *save* FPU state on a context switch would be a > really nasty can of worms. :) > At the very least we will want arch_prctl(ARCH_ALLOCTE_XSTATE, mask) > to allow HPC workloads to manually allocate the state and get an error > code if it fails. Yes. Thanks, tglx