public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>, Willy Tarreau <w@1wt.eu>,
	Andy Lutomirski <luto@kernel.org>,
	 Florian Weimer <fweimer@redhat.com>,
	"Bae, Chang Seok" <chang.seok.bae@intel.com>,
	 Dave Hansen <dave.hansen@intel.com>, X86 ML <x86@kernel.org>,
	 LKML <linux-kernel@vger.kernel.org>,
	Linux API <linux-api@vger.kernel.org>,
	 "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>,
	Rich Felker <dalias@libc.org>, Kyle Huey <me@kylehuey.com>,
	 Keno Fischer <keno@juliacomputing.com>,
	Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features
Date: Thu, 20 May 2021 11:35:53 -0400	[thread overview]
Message-ID: <CAJvTdKkYp+zP_9tna6YsrOz2_nmEUDLJaL_i-SNog0m2T9wZ=Q@mail.gmail.com> (raw)
In-Reply-To: <874kf11yoz.ffs@nanos.tec.linutronix.de>

Hi Thomas,

On Mon, May 17, 2021 at 5:45 AM Thomas Gleixner <tglx@linutronix.de> wrote:

> AMX (or whatever comes next) is nothing else than a device and it
> just should be treated as such. The fact that it is not exposed
> via a driver and a device node does not matter at all.

TMM registers are part of the CPU architectural state.
If TMM registers exist for one logical CPU, they exist for all CPUs --
including HT siblings.
(Intel supports only homogeneous ISA)

Ditto for the instructions that access and operate on TMM registers.

One can reasonably predict, that like Intel has done for all other registers,
there will be future instructions added to the ISA to operate on TMM registers,
including in combination with non-TMM registers that are also part
of the architectural state.

It is an unfortunate word choice that some documentation calls the
TMUL instruction
an "accelerator".  It isn't.  It is part of the ISA, like any other instruction.

I agree that a device interface may make sense for real accelerators
that don't run x86 instructions, I don't see long term viability for attempting
to carve a sub-set of x86 instructions into a device, particularly when
the set of instructions will continue to evolve.

> Not doing so requires this awkward buffer allocation issue via #NM with
> all it's downsides; it's just wrong to force the kernel to manage
> resources of a user space task without being able to return a proper
> error code.

The hardware #NM support for fault on first use is a feature to allow the OS
to optimize space so that pages do not have to be dedicated to back registers
unless/until they are actually used.

There is absolutely no requirement that a particular
OS take advantage of that feature.  If you think that this optimization is
awkward, we can easily delete/disable it and simply statically allocate buffers
for all threads at initialization time.  Though you'll have to convince me
why the word "awkward" applies, rather than "elegant".

Regarding error return for allocation failures.

I'm not familiar with the use-case where vmalloc would be likely to fail today,
and I'd be interested if anybody can detail that use-case.
But even if there is none today, I grate that Linux could evolve to make vmalloc
fail in the future, and so an interface to reqeust pre-allocation of buffers
is reasonable insurance.  Chang has implemented this prctl in v5
of the TMUL patch series.

> It also prevents fine grained control over access to this
> functionality. As AMX is clearly a shared resource which is not per HT
> thread (maybe not even per core) and it has impact on power/frequency it
> is important to be able to restrict access on a per process/cgroup
> scope.

AMX is analogous to the multiplier used by AVX-512.
The architectural state must exist on every CPU, including HT siblings.
Today, the HT siblings share the same execution unit,
and I have no reason to expect that will change.

I thought we already addressed the FUD surrounding power/frequency.
As with every kind of instruction -- those that use
more power will leave less power for their peers, and there is a mechanism
to track that power budget.  I acknowledge that the mechanism was overly
conservative and slow to recover in initial AVX-512 systems, and that issue
persists even with the latest publically available hardware today.
I acknowledge that you do not trust that Intel has addressed this
(for both AVX-512 and AMX) in the first hardware that supports AMX.

> 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.
>
> AVX512 has already proven that XSTATE management is fragile and error
> prone, so we really have to stop this instead of creating yet another
> half baked solution.

We fixed the glibc ABI issue.  It is available now and production
release is this summer.
Yes, it should have been addressed when AVX-512 was deployed.

thanks
Len Brown, Intel Open Source Technology Center

  parent reply	other threads:[~2021-05-20 15:36 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 23:12 Andy Lutomirski
2021-03-26 23:18 ` Andy Lutomirski
2021-03-27  3:39   ` Len Brown
2021-03-27  9:14     ` Borislav Petkov
2021-03-27  9:58     ` Greg KH
2021-03-29 15:47       ` Len Brown
2021-03-29 16:38         ` Len Brown
2021-03-29 16:48           ` Florian Weimer
2021-03-29 18:14           ` Andy Lutomirski
2021-03-29 18:16         ` Andy Lutomirski
2021-03-29 22:38           ` Len Brown
2021-03-30  5:08             ` Andy Lutomirski
2021-03-30  5:50               ` Noah Goldstein
2021-03-30 17:01               ` Len Brown
2021-03-30 17:05                 ` Andy Lutomirski
2021-03-30 17:56                   ` Len Brown
2021-03-30 19:12                     ` Dave Hansen
2021-03-30 20:20                       ` Andy Lutomirski
2021-03-30 20:42                         ` Len Brown
2021-03-30 22:01                           ` David Laight
2021-03-31 16:31                             ` Len Brown
2021-03-31 16:53                               ` Andy Lutomirski
2021-03-31 21:42                                 ` Robert O'Callahan
2021-03-31 22:11                                   ` Len Brown
2021-03-31 22:28                                 ` Len Brown
2021-03-31 22:45                                   ` Andy Lutomirski
2021-04-09 20:52                                     ` Len Brown
2021-04-09 21:44                                       ` Andy Lutomirski
2021-04-11 19:07                                         ` Len Brown
2021-04-12  7:59                                           ` David Laight
2021-04-12 12:19                                           ` Borislav Petkov
2021-04-12 17:14                                           ` Sean Christopherson
2021-03-31 22:52                                   ` Borislav Petkov
2021-04-09 20:55                                     ` Len Brown
2021-03-28  0:53   ` Thomas Gleixner
2021-03-29  7:27     ` Peter Zijlstra
2021-03-29 15:06     ` Dave Hansen
2021-03-31  8:24 ` Borislav Petkov
2021-04-12 14:19 ` Florian Weimer
2021-04-12 14:31   ` Borislav Petkov
2021-04-12 14:38     ` Florian Weimer
2021-04-12 15:08       ` Borislav Petkov
2021-04-12 15:10       ` Andy Lutomirski
2021-04-12 15:21   ` Andy Lutomirski
2021-04-12 23:46     ` Len Brown
2021-04-13  0:17       ` Thomas Gleixner
2021-04-13  1:25         ` Len Brown
2021-04-13  3:43       ` Willy Tarreau
2021-04-13 19:51         ` Len Brown
2021-04-14  9:58           ` Borislav Petkov
2021-04-14 10:06             ` Willy Tarreau
2021-04-14 10:08               ` Borislav Petkov
2021-04-14 21:57             ` Len Brown
2021-04-15  4:43               ` Borislav Petkov
2021-04-15  5:29                 ` Willy Tarreau
2021-04-15  5:47                   ` Borislav Petkov
2021-04-16 22:05                     ` Len Brown
2021-04-19 14:14                       ` Borislav Petkov
2021-04-19 18:18                         ` Len Brown
2021-04-19 19:15                           ` Borislav Petkov
2021-04-19 21:33                             ` Len Brown
2021-04-19 21:58                               ` Borislav Petkov
2021-04-23 19:35                                 ` Len Brown
2021-04-23 19:57                                   ` Borislav Petkov
2021-05-02 15:27                                     ` Len Brown
2021-05-03  5:18                                       ` Florian Weimer
2021-05-03 13:43                                         ` Dave Hansen
2021-05-03 13:47                                           ` Florian Weimer
2021-05-03 14:14                                             ` Dave Hansen
2021-05-07 18:44                                           ` Thomas Gleixner
2021-05-07 18:50                                             ` Andy Lutomirski
2021-05-07 19:22                                               ` Thomas Gleixner
2021-05-08  9:45                                       ` Thomas Gleixner
2021-05-18 20:39                                         ` Len Brown
2021-05-19 23:29                                           ` Andy Lutomirski
2021-05-20 19:16                                             ` Len Brown
2021-05-17  9:45                                       ` Thomas Gleixner
2021-05-17  9:56                                         ` Florian Weimer
2021-05-17 10:18                                           ` Thomas Gleixner
2021-05-21 16:29                                           ` Len Brown
2021-05-17 13:49                                         ` Arjan van de Ven
2021-05-20 15:35                                         ` Len Brown [this message]
2021-05-20 20:54                                           ` Thomas Gleixner
2021-05-20 21:13                                             ` Dave Hansen
2021-05-20 21:41                                               ` Len Brown
2021-05-20 22:53                                                 ` Dave Hansen
2021-05-21  9:41                                                   ` Thomas Gleixner
2021-05-21 14:44                                                   ` Florian Weimer
2021-05-21 14:49                                                     ` Peter Zijlstra
2021-06-23 15:06                                                       ` Florian Weimer
2021-06-23 23:11                                                         ` Len Brown
     [not found]                                                           ` <93e3b500-5992-a674-18e6-445d1db7b1f0@metux.net>
2021-06-28 12:49                                                             ` Florian Weimer
     [not found]                                                               ` <84be3cfd-e825-ae75-bbae-2bbd3360daa7@metux.net>
2021-06-30 12:41                                                                 ` Willy Tarreau
2021-06-30 13:55                                                                 ` Arjan van de Ven
2021-06-30 15:20                                                                   ` Len Brown
2021-05-21 16:14                                                     ` Dave Hansen
2021-05-21 16:19                                                       ` Florian Weimer
2021-05-21 16:26                                                         ` Len Brown
2021-05-21 16:28                                                         ` Dave Hansen
2021-05-21 16:31                                                         ` Andy Lutomirski
2021-05-21 19:10                                                           ` Thomas Gleixner
2021-05-21 20:07                                                             ` Andy Lutomirski
2021-05-21 21:43                                                               ` Thomas Gleixner
2021-05-21 22:07                                                             ` Len Brown
2021-05-21 22:46                                                               ` Thomas Gleixner
2021-05-21 23:31                                                                 ` Len Brown
2021-05-22  7:16                                                                   ` Florian Weimer
2021-05-22 23:55                                                                     ` Andy Lutomirski
2021-05-21 23:06                                                               ` Dave Hansen
2021-05-21 23:08                                                                 ` Len Brown
2021-05-21 19:05                                                         ` Thomas Gleixner
2021-05-20 21:22                                             ` Len Brown
2021-05-20 21:41                                               ` Thomas Gleixner
2021-05-20 21:49                                                 ` Len Brown
2021-05-21  9:26                                                   ` Thomas Gleixner
2021-04-19 23:52                               ` Paul Eggert
2021-04-13 20:16       ` Andy Lutomirski
2021-04-13 22:47         ` Len Brown
2021-04-13 22:58           ` Andy Lutomirski
2021-04-14 21:48             ` Len Brown
2021-04-15 16:24               ` Andy Lutomirski
2021-04-15 17:00                 ` Dave Hansen
2021-04-15 17:38                   ` Andy Lutomirski
2021-04-16 21:54                 ` Len Brown
2021-04-16 22:03                   ` Andy Lutomirski
2021-04-16 22:10                     ` Len Brown
2021-04-16 22:14                       ` Andy Lutomirski
2021-04-17  1:57                         ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJvTdKkYp+zP_9tna6YsrOz2_nmEUDLJaL_i-SNog0m2T9wZ=Q@mail.gmail.com' \
    --to=lenb@kernel.org \
    --cc=arjan@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=chang.seok.bae@intel.com \
    --cc=dalias@libc.org \
    --cc=dave.hansen@intel.com \
    --cc=fweimer@redhat.com \
    --cc=keno@juliacomputing.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=me@kylehuey.com \
    --cc=tglx@linutronix.de \
    --cc=w@1wt.eu \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).