From: Borislav Petkov <bp@alien8.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>, x86-ml <x86@kernel.org>,
Andy Lutomirski <luto@kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] Improve memset
Date: Thu, 19 Sep 2019 14:55:42 +0200 [thread overview]
Message-ID: <20190919125542.GB18148@nazgul.tnic> (raw)
In-Reply-To: <CAHk-=wjDiDOcz2GHC88rV8gySCMZZko8PFW-ywJDkeY5n+je9Q@mail.gmail.com>
On Tue, Sep 17, 2019 at 01:45:20PM -0700, Linus Torvalds wrote:
> That sounds better, but I'm a bit nervous about the whole thing
> because who knows when the alternatives code itself internally uses
> memset() and then we have a nasty little chicken-and-egg problem.
You mean memcpy()...?
> Also, for it to make sense to inline rep stosb, I think we also need
> to just make the calling conventions for the alternative calls be that
> they _don't_ clobber other registers than the usual rep ones
> (cx/di/si). Otherwise one big code generation advantage of inlining
> the thing just goes away.
Yah, that is tricky and I have no smart idea how. The ABI puts the
operands in rdi,rsi,rdx, ... while REP; STOSB wants them in rax,rcx,rdi.
And if it were only that, then we could probably accept the 2 movs and
a push but then the old functions clobber three more: "rdx", "r8", "r9".
I could try to rewrite the old functions to see if I can save some regs...
> On the whole I get the feeling that this is all painful complexity and
> we shouldn't do it. At least not without some hard performance numbers
> for some huge improvement, which I don't think we've seen.
Yap, it is starting to become hairy.
> Because I find the thing fascinating conceptually, but am not at all
> convinced I want to deal with the pain in practice ;)
I hear ya.
Thx.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
next prev parent reply other threads:[~2019-09-19 12:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 7:22 [RFC] Improve memset Borislav Petkov
2019-09-13 7:35 ` Ingo Molnar
2019-09-13 7:50 ` Borislav Petkov
2019-09-13 8:51 ` Rasmus Villemoes
2019-09-13 9:00 ` Linus Torvalds
2019-09-13 9:18 ` Rasmus Villemoes
2019-09-13 10:42 ` Borislav Petkov
2019-09-13 16:36 ` Borislav Petkov
2019-09-16 9:18 ` Rasmus Villemoes
2019-09-16 17:25 ` Linus Torvalds
2019-09-16 17:40 ` Andy Lutomirski
2019-09-16 21:29 ` Linus Torvalds
2019-09-16 23:13 ` Andy Lutomirski
2019-09-16 23:26 ` Linus Torvalds
2019-09-17 8:15 ` Borislav Petkov
2019-09-17 10:55 ` David Laight
2019-09-17 20:10 ` Josh Poimboeuf
2019-09-17 20:45 ` Linus Torvalds
2019-09-19 12:55 ` Borislav Petkov [this message]
2019-09-19 12:49 ` Borislav Petkov
2019-09-14 9:29 Alexey Dobriyan
2019-09-14 11:39 ` Borislav Petkov
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=20190919125542.GB18148@nazgul.tnic \
--to=bp@alien8.de \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=torvalds@linux-foundation.org \
--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 NNTP newsgroup(s).