Re: Candidate Linux ABI for Intel AMX and hypothetical new related features

From: Len Brown
Date: Fri May 21 2021 - 18:07:22 EST


On Fri, May 21, 2021 at 3:10 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> On Fri, May 21 2021 at 09:31, Andy Lutomirski wrote:
> > arch_prctl(SET_XSTATE_INIT_ON_FIRST_USE, TILE_STUFF);?
> >
> > As long as this is allowed to fail, I don’t have a huge problem with
> > it.
>
> I'm fine with that. It's still controlled by the OS and can return
> -EPERM.
>
> If allowed then the application would also accept to be insta killed if
> that #NM allocation fails. Any bug report vs. that will be ignored.

Regarding pre-allocation vs on-demand allocation, consider two scenarios:

1. Synchronous. At process or thread start up time, prctl()
synchronously allocates 8K context switch buffers. Return code is 0
-- good go go! 10 seconds later the program decides to create
additional threads. Woops. vmalloc failed, and the process
synchronously dies. bug filed.

2. On demand. Same scenario, except vmalloc failure upon creation of
those additional threads sends a SIGSEGV at the instruction where AMX
is touched. bug filed.

Why ignore the 2nd bug and not ignore the 1st bug?

My concern about synchronous allocation is that it will be very easy
to abuse. programs and threads can ask for buffers they will never
use. With on-demand allocation, we allocate buffers only if they are
actually needed.

Len Brown, Intel Open Source Technology Center