[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210412150824.GF24283@zn.tnic>
Date: Mon, 12 Apr 2021 17:08:24 +0200
From: Borislav Petkov <bp@...en8.de>
To: Florian Weimer <fweimer@...hat.com>
Cc: Andy Lutomirski <luto@...nel.org>,
"Bae, Chang Seok" <chang.seok.bae@...el.com>,
Dave Hansen <dave.hansen@...el.com>, X86 ML <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, linux-abi@...r.kernel.org,
"libc-alpha@...rceware.org" <libc-alpha@...rceware.org>,
Rich Felker <dalias@...c.org>, Kyle Huey <me@...ehuey.com>,
Keno Fischer <keno@...iacomputing.com>
Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related
features
On Mon, Apr 12, 2021 at 04:38:15PM +0200, Florian Weimer wrote:
> Yes, that's why we have the XGETBV handshake. I was imprecise. It's
> CPUID + XGETBV of course. Or even AT_HWCAP2 (for FSGSBASE).
Ok, that sounds better. So looking at glibc sources, I see something
like this:
init_cpu_features
|-> update_usable
|-> CPU_FEATURE_SET_USABLE (cpu_features, XGETBV_ECX_1);
so I'm guessing this happens when the library gets loaded per process,
right?
Which means, once the detection has taken place and the library has
gotten XCR0, it is going to use it and won't re-ask the kernel or so?
I.e., I'm trying to imagine how a per-process thing would work at all.
If at all.
And this sounds especially "fun":
> Code that installs a signal handler often does not have control on
> which thread an asynchronous signal is delivered, or which code it
> interrupts.
In my simplistic approach I'm thinking about something along the lines
of:
Library: hey kernel, can you handle AVX512?
Kernel: yes
Library: ok, I will use that in the signal handler
And since kernel has said yes, kernel is going to take care of handling
AVX512 state and library can assume that.
All those old processes which cannot be recompiled, for them I guess the
kernel should have to say no.
Dunno how much sense that makes...
> > And the CPUID-faulting thing would solve stuff like that because then
> > the kernel can *actually* get involved into answering something where it
> > has a say in, too.
>
> But why wouldn't we use a syscall or an entry in the auxiliary vector
> for that? Why fault a potentially performance-critical instruction?
Oh sure, CPUID faulting was just an example. I think the intent is to
have this important aspect of userspace asking the kernel first what
kind of features it can handle and then do accordingly.
IOW, legacy stuff can work unchanged and new libraries and kernels can
support fancier features and bigger buffers.
Methinks.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists