From: Linus Torvalds <firstname.lastname@example.org> To: George Spelvin <email@example.com> Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>, Andi Kleen <firstname.lastname@example.org>, David Miller <email@example.com>, David Laight <David.Laight@aculab.com>, "Daniel J . Bernstein" <firstname.lastname@example.org>, Eric Biggers <email@example.com>, Eric Dumazet <firstname.lastname@example.org>, Hannes Frederic Sowa <email@example.com>, Jean-Philippe Aumasson <firstname.lastname@example.org>, "email@example.com" <firstname.lastname@example.org>, Linux Crypto Mailing List <email@example.com>, Linux Kernel Mailing List <firstname.lastname@example.org>, Andy Lutomirski <email@example.com>, Network Development <firstname.lastname@example.org>, Tom Herbert <email@example.com>, "Theodore Ts'o" <firstname.lastname@example.org>, Vegard Nossum <email@example.com> Subject: Re: HalfSipHash Acceptable Usage Date: Wed, 21 Dec 2016 09:25:01 -0800 [thread overview] Message-ID: <CA+55aFy8fNOxw3bnwkX1S46jKnW6i26mueaiuOsScyN3kFJp+A@mail.gmail.com> (raw) In-Reply-To: <firstname.lastname@example.org> On Wed, Dec 21, 2016 at 7:55 AM, George Spelvin <email@example.com> wrote: > > How much does kernel_fpu_begin()/kernel_fpu_end() cost? It's now better than it used to be, but it's absolutely disastrous still. We're talking easily many hundreds of cycles. Under some loads, thousands. And I warn you already: it will _benchmark_ a hell of a lot better than it will work in reality. In benchmarks, you'll hit all the optimizations ("oh, I've already saved away all the FP registers, no need to do it again"). In contrast, in reality, especially with things like "do it once or twice per incoming packet", you'll easily hit the absolute worst cases, where not only does it take a few hundred cycles to save the FP state, you'll then return to user space in between packets, which triggers the slow-path return code and reloads the FP state, which is another few hundred cycles plus. Similarly, in benchmarks you'll hit the "modern CPU's power on the AVX unit and keep it powered up for a while afterwards", while in real life you would quite easily hit the "oh, AVX is powered down because we were idle, now it powers up at half speed which is another latency hit _and_ the AVX unit won't run full out anyway". Don't do it. There are basically no real situations where the AVX state optimizations help for the kernel. We just don't have the loop counts to make up for the problems it causes. The one exception is likely if you're doing things like high-throughput disk IO encryption, and then you'd be much better off using SHA256 instead (which often has hw encryption on modern CPU's - both x86 and ARM). (I'm sure that you could see it on some high-throughput network benchmark too when the benchmark entirely saturates the CPU. And then in real life it would suck horribly for all the reasons above). Linus
next prev parent reply other threads:[~2016-12-21 17:25 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-12-19 17:32 Jason A. Donenfeld [not found] ` <CAGiyFdduUNSGq24zfsk0ZU=hnOCmewAw8vw6XvDoS-3f+3UPKQ@mail.gmail.com> 2016-12-19 21:00 ` Jason A. Donenfeld 2016-12-20 21:36 ` Theodore Ts'o 2016-12-20 23:07 ` George Spelvin 2016-12-20 23:55 ` Eric Dumazet 2016-12-21 3:28 ` George Spelvin 2016-12-21 5:29 ` Eric Dumazet 2016-12-21 6:34 ` George Spelvin 2016-12-21 14:24 ` Jason A. Donenfeld 2016-12-21 15:55 ` George Spelvin 2016-12-21 16:37 ` Jason A. Donenfeld 2016-12-21 16:41 ` [kernel-hardening] " Rik van Riel 2016-12-21 17:25 ` Linus Torvalds [this message] 2016-12-21 18:07 ` George Spelvin 2016-12-22 1:54 ` Andy Lutomirski 2016-12-21 14:42 ` Jason A. Donenfeld 2016-12-21 15:56 ` Eric Dumazet 2016-12-21 16:33 ` Jason A. Donenfeld 2016-12-21 16:39 ` [kernel-hardening] " Rik van Riel 2016-12-21 17:08 ` Eric Dumazet 2016-12-21 18:37 ` George Spelvin 2016-12-21 18:40 ` Jason A. Donenfeld 2016-12-21 22:27 ` Theodore Ts'o 2016-12-22 0:18 ` George Spelvin 2016-12-22 1:13 ` George Spelvin
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=CA+55aFy8fNOxw3bnwkX1S46jKnW6i26mueaiuOsScyN3kFJp+A@mail.gmail.com \ --firstname.lastname@example.org \ --cc=David.Laight@aculab.com \ --cc=Jason@zx2c4.com \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: HalfSipHash Acceptable Usage' \ /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
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 NNTP newsgroup(s).