From: Vitaly Mayatskikh <v.mayatskih@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Vitaly Mayatskikh <v.mayatskih@gmail.com>,
linux-kernel@vger.kernel.org, Andi Kleen <andi@firstfloor.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 3/3] Fix copy_user on x86_64
Date: Mon, 30 Jun 2008 17:12:10 +0200 [thread overview]
Message-ID: <m3lk0ngdo5.fsf@gravicappa.englab.brq.redhat.com> (raw)
In-Reply-To: <alpine.LFD.1.10.0806281108240.4371@hp.linux-foundation.org> (Linus Torvalds's message of "Sat, 28 Jun 2008 11:26:24 -0700 (PDT)")
Linus Torvalds <torvalds@linux-foundation.org> writes:
>> Added copy_user_64.c instead of copy_user_64.S and
>> copy_user_nocache_64.S
>
> Grr, your patches are as attachements, which means that answering to
> themmakes quoting them much harder.
Sorry... But what was mentioned in Documentation/SubmittingPatches with:
"For this reason, all patches should be submitting e-mail "inline".
WARNING: Be wary of your editor's word-wrap corrupting your patch,
if you choose to cut-n-paste your patch."
My first thought was "should be attached inline".
> Hmm? Sorry for being such a stickler. This code does end up being fairly
> critical, both for correctness and for performance. A lot of user copies
> are actually short (smallish structures, or just small reads and writes),
> and I'd like to make sure that really basic infrastructure like this is
> just basically "known to be optimal", so that we can totally forget about
> it for a few more years.
Agreed. Code was reworked again, will test it a bit more. Two more
questions to you and Andi:
1. Do you see any reasons to do fix alignment for destination as it was
done in copy_user_generic_unrolled (yes, I know, access to unaligned
address is slower)? It tries to byte-copy unaligned bytes first and then
to do a normal copy. I think, most times destination addresses will be
aligned and this check is not so necessary. If it is necessary, then
copy_user_generic_string should do the same.
2. What is the purpose of "minor optimization" in commit
3022d734a54cbd2b65eea9a024564821101b4a9a?
ENTRY(copy_user_generic_string)
CFI_STARTPROC
movl %ecx,%r8d /* save zero flag */
movl %edx,%ecx
shrl $3,%ecx
andl $7,%edx
jz 10f
1: rep
movsq
movl %edx,%ecx
2: rep
movsb
9: movl %ecx,%eax
ret
/* multiple of 8 byte */
10: rep
movsq
xor %eax,%eax
ret
I don't think CPU is able to speculate with 'rep movs*' in both
branches, and I'm not sure if conditional jump is cheaper then empty
'rep movsb' (when ecx is 0). I want to eliminate it if you don't have
any objections.
Thanks.
--
wbr, Vitaly
next prev parent reply other threads:[~2008-06-30 15:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-27 21:52 Vitaly Mayatskikh
2008-06-28 18:26 ` Linus Torvalds
2008-06-30 15:12 ` Vitaly Mayatskikh [this message]
2008-06-30 15:55 ` Linus Torvalds
2008-06-30 16:16 ` Andi Kleen
2008-06-30 18:22 ` Kari Hurtta
2008-07-02 13:48 ` [PATCH 1/2] Introduce copy_user_handle_tail routine Vitaly Mayatskikh
2008-07-02 14:06 ` Andi Kleen
2008-07-02 14:31 ` Vitaly Mayatskikh
2008-07-02 15:06 ` Andi Kleen
2008-07-02 15:32 ` Vitaly Mayatskikh
2008-07-02 15:40 ` Andi Kleen
2008-07-02 15:58 ` Vitaly Mayatskikh
2008-07-02 18:54 ` Andi Kleen
2008-07-03 2:35 ` Linus Torvalds
2008-07-07 12:09 ` Vitaly Mayatskikh
2008-07-07 12:12 ` Vitaly Mayatskikh
2008-07-07 16:43 ` Andi Kleen
2008-07-07 16:21 ` Linus Torvalds
2008-07-07 17:05 ` Vitaly Mayatskikh
2008-07-09 13:03 ` Ingo Molnar
2008-07-09 13:16 ` Vitaly Mayatskikh
2008-07-09 13:52 ` Ingo Molnar
2008-07-02 13:53 ` [PATCH 2/2] Fix copy_user on x86 Vitaly Mayatskikh
2008-07-02 14:08 ` Andi Kleen
2008-07-02 14:36 ` Vitaly Mayatskikh
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=m3lk0ngdo5.fsf@gravicappa.englab.brq.redhat.com \
--to=v.mayatskih@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®