mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 04:47:05 +00:00
lib/iov_iter: Document _copy_to_iter_mcsafe()
Add some theory of operation documentation to _copy_to_iter_mcsafe(). Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/153108276256.37979.1689794213845539316.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
6d77d3b43a
commit
bf3eeb9b5f
1 changed files with 26 additions and 0 deletions
|
@ -596,6 +596,32 @@ static unsigned long memcpy_mcsafe_to_page(struct page *page, size_t offset,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _copy_to_iter_mcsafe - copy to user with source-read error exception handling
|
||||||
|
* @addr: source kernel address
|
||||||
|
* @bytes: total transfer length
|
||||||
|
* @iter: destination iterator
|
||||||
|
*
|
||||||
|
* The pmem driver arranges for filesystem-dax to use this facility via
|
||||||
|
* dax_copy_to_iter() for protecting read/write to persistent memory.
|
||||||
|
* Unless / until an architecture can guarantee identical performance
|
||||||
|
* between _copy_to_iter_mcsafe() and _copy_to_iter() it would be a
|
||||||
|
* performance regression to switch more users to the mcsafe version.
|
||||||
|
*
|
||||||
|
* Otherwise, the main differences between this and typical _copy_to_iter().
|
||||||
|
*
|
||||||
|
* * Typical tail/residue handling after a fault retries the copy
|
||||||
|
* byte-by-byte until the fault happens again. Re-triggering machine
|
||||||
|
* checks is potentially fatal so the implementation uses source
|
||||||
|
* alignment and poison alignment assumptions to avoid re-triggering
|
||||||
|
* hardware exceptions.
|
||||||
|
*
|
||||||
|
* * ITER_KVEC, ITER_PIPE, and ITER_BVEC can return short copies.
|
||||||
|
* Compare to copy_to_iter() where only ITER_IOVEC attempts might return
|
||||||
|
* a short copy.
|
||||||
|
*
|
||||||
|
* See MCSAFE_TEST for self-test.
|
||||||
|
*/
|
||||||
size_t _copy_to_iter_mcsafe(const void *addr, size_t bytes, struct iov_iter *i)
|
size_t _copy_to_iter_mcsafe(const void *addr, size_t bytes, struct iov_iter *i)
|
||||||
{
|
{
|
||||||
const char *from = addr;
|
const char *from = addr;
|
||||||
|
|
Loading…
Reference in a new issue