From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by sourceware.org (Postfix) with ESMTPS id 02BBB3857802 for ; Thu, 20 May 2021 21:41:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 02BBB3857802 Received: by mail-ed1-f41.google.com with SMTP id g7so8895717edm.4 for ; Thu, 20 May 2021 14:41:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=f/4LtIOBD6wxF9iMPhLoPX028a1rtI0NTUTVZTA+F+Y=; b=U5gAmhEmRX1G1sohvyXZvLgxXni/H6X8FQzad15rj1ap8J07RzPYecaF+f9XphubO0 +MqSrLO6qO+U21XC1HJQaJOxyUgiA9Yj6r6BD4PAg/d0MpwQhEyCKG+f9IpS0A88564Q 4S8pG78S+NjhBk8qaciYD4KUX1CvlZYe+kB20cqreoYq2kfKa3YM7fGUwqfh6DHcCECj 8LYGENulsEUJg4SerHGNBmO5Ig7tqvdTCSriN5cm3rCkHB6aIDElWJyGpRIyGYI9CELU KnF9e2yKD8JeFNMZcHxJkdvlSTpqMSRsBYnDQ01k2PK/fbzucQWe0hvx9ZxV50AI65w8 n0Jg== X-Gm-Message-State: AOAM532HYntzK2+3IDQMaPz/DcUMd+eB6WduvM81PhhT9bhBW4pAIzR2 VNcwFzVQY68rxArO+XIaQfg9uY0w/RNWiWYfxLs= X-Google-Smtp-Source: ABdhPJxibk2/f4GeDvxy3AIuRa9jRf5Bkoi8neyu/Ok51BwgSMelBKvR44Ci02P9JsQRlgtytkLOnMKlNkh9T3CZyE8= X-Received: by 2002:aa7:c6cd:: with SMTP id b13mr7100076eds.94.1621546917061; Thu, 20 May 2021 14:41:57 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <37833625-3e6b-5d93-cc4d-26164d06a0c6@intel.com> From: Len Brown Date: Thu, 20 May 2021 17:41:45 -0400 Message-ID: Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features To: Dave Hansen Cc: Thomas Gleixner , Borislav Petkov , Willy Tarreau , Andy Lutomirski , Florian Weimer , "Bae, Chang Seok" , X86 ML , LKML , Linux API , "libc-alpha@sourceware.org" , Rich Felker , Kyle Huey , Keno Fischer , Arjan van de Ven Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Thu, 20 May 2021 21:41:59 -0000 On Thu, May 20, 2021 at 5:13 PM Dave Hansen wrote: > >> Regarding error return for allocation failures. ... > * vmalloc() can fail (the memory.kmem cgroup limit is probably the most > likely place to be exposed to this) > * vmalloc() failure in a fault (like #NM) will result in SIGSEGV > * vmalloc() failure in a syscall can be handled with -ENOMEM Thanks for clarifying this, Dave. We added the explicit-allocate to v5, which should be on the list by tomorrow. So the questions are: 1. who calls it -- a call/thread or process? the application? a library -- which library? 2. is it optional, or mandatory? 3. if it is mandatory, what is the best way to enforce it? 4. should we have a "release" system call too? 1. Every thread needs a context switch buffer. Does every thread make the system call? It seems sort of awkward for a library to always make a system call before doing a TMUL. It would be functionally harmless, but it would add latency to an otherwise low-latency operation. If some central library does it, and caches that it has done it before, then it would be ugly, but at least it would remove an unnecessary user/kernel transition. 2. If it is optional, then v5 is code complete -- because it allows you to allocate either explicitly via prtcl, or transparently via #NM. 3. If it is mandatory, then we should re-purpose the XFD mechanism: app starts with XFD armed, by default if app touches AMX before prctl, it takes a signal (and dies). When app calls prctl, allocate buffer disarm XFD for that app (exactly what #NM trap does today). 4. I don't see a justification for a release concept, but it is possible -- though sort of sticky with possible nested calls from combinations of apps and libraries. If that were sorted out by a central library, then the actual system call on the last release per thread would re-arm XFD to prevent access until the next explicit request. Unclear if it is important that the kernel actually do the free -- some things might run faster if we keep it around... Len Brown, Intel Open Source Technology Center