From: Ingo Molnar <mingo@elte.hu>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Brad Parker <brad@heeltoe.com>,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: copy_{to,from}_user
Date: Sun, 11 Jan 2009 03:09:23 +0100 [thread overview]
Message-ID: <20090111020923.GC29153@elte.hu> (raw)
In-Reply-To: <1231538061.29452.8.camel@twins>
* Peter Zijlstra <peterz@infradead.org> wrote:
> On Fri, 2009-01-09 at 12:52 -0500, Brad Parker wrote:
> > I have a question about copy_{to,from}_user.
> >
> > Most implementations I've seen do in-order copies and notice when an
> > exception occurs and report back the progress. This is straight
> > forward.
> >
> > (but to be honest, I have suspicions about how just how accurate those
> > reports are i.e. +/- 1-3 bytes on some architectures)
> >
> > On some cpu's it is advantageous to do an out-of-order copy to take
> > advantage of various cache fill mechanisms.
> >
> > The problem is that the out-of-order copy makes it impossible to know
> > where the exception occurred (in terms of progress).
> >
> > Would it be permissible to have a version of copy_{to,from}_user which
> > does an out-of-order copy and when an exception occurs, restarts the
> > copy from the beginning using a simple in-order copy, to make it
> > possible to identify where the exception occurs?
> >
> > The idea is that exceptions are rare and so the performance hit of doing
> > the "recopy" would be minimal and would provide the required accuracy.
>
> x86_64 already does some unrolling and is inaccurate as to where exactly
> it happens. The only thing that is very important is that you _never_
> say you copied more than you actually did.
>
> That was the source of a data corruption bug a while ago, the code did
> something like sequences: read 8 words, write 8 words. And reported the
> number of bytes read, instead of bytes written, which is an
> over-estimation.
you sure must have meant 'write 7 words' or something like that?
Ingo
next prev parent reply other threads:[~2009-01-11 2:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-09 17:52 copy_{to,from}_user Brad Parker
2009-01-09 21:54 ` copy_{to,from}_user Peter Zijlstra
2009-01-11 2:09 ` Ingo Molnar [this message]
2009-01-11 9:55 ` copy_{to,from}_user Geert Uytterhoeven
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=20090111020923.GC29153@elte.hu \
--to=mingo@elte.hu \
--cc=brad@heeltoe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.