[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <40f6f29f26f14b5b88076f5b12e1ecaa@AcuMS.aculab.com>
Date: Tue, 12 Oct 2021 21:21:09 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Willy Tarreau' <w@....eu>,
Ammar Faizi <ammar.faizi@...dents.amikom.ac.id>
CC: Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"x86@...nel.org" <x86@...nel.org>, "H. Peter Anvin" <hpa@...or.com>
Subject: RE: [PATCH] tools/nolibc: x86: Remove `r8`, `r9` and `r10` from the
clobber list
From: Willy Tarreau
> Sent: 12 October 2021 10:07
>
> On Tue, Oct 12, 2021 at 03:36:44PM +0700, Ammar Faizi wrote:
> > I have tried to search for the documentation about this one, but I
> > couldn't find any. Checking at `Documentation/x86/entry_64.rst`, but
> > it doesn't tell anything relevant.
> (...)
>
> OK thanks for the detailed story, thus I didn't miss any obvious
> reference.
>
> > My stance comes from SO, Telegram group discussion, and reading source
> > code. Therefore, I don't think I can attach the link to it as
> > "authoritative information". Or can I?
>
> You're right, that's not exactly what we can call authoritative :-)
Given the cost of a system call the code benefit from telling
gcc that r8 to r10 are preserved is likely to be noise.
Especially since most syscalls are made from C library stubs
so the application calling code will assume they are trashed.
There may even be a bigger gain from the syscall exit code just
setting the registers to zero (instead of restoring them).
There are probably even bigger gains from zeroing the AVX
registers (which, IIRC, are all caller-saved) somewhere
between syscall entry and the process sleeping.
(This can't be done for non-syscall kernel entry.)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists